Skip to content

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

refactor(ui,web): W4 — layout, navigation, notices and data move into the UI package (#902)

Yaowei Zheng686b1918030e
diff --git a/changelog/unreleased/2026-09-30-ui-migration-w4.md b/changelog/unreleased/2026-09-30-ui-migration-w4.md
new file mode 100644
index 00000000..23fe53af
--- /dev/null
+++ b/changelog/unreleased/2026-09-30-ui-migration-w4.md
@@ -0,0 +1,37 @@
+# Layout, navigation, notices and data move into the shared UI package
+
+- **Date:** 2026-09-30
+- **Type:** refactor
+- **Scope:** `ui`, `web`, `ui-gallery`
+
+[中文版](2026-09-30-ui-migration-w4.zh.md)
+
+W4 of the UI-package migration moves the Web App's page structure into `@prismshadow/penguin-ui` and converts the pages to it: page headers, cards, tables, sections, notices, progress and stats.
+
+## What moved
+
+- **Moved:** `Tabs`, the group list (`GroupHeader`, `FolderSection`, `MoreRow`, and a new `Pager`), `CreateButtons`, `TodoNotice`, `BetaBadge`, `DisclosureRow`, `LiveDuration`, and `StatTile`.
+- **New layout:** `PageFrame` and `PageHeader`, `Card` and `CardHeader`, `RuledSection`, `CollapsibleSection`, `EntityHeader`.
+- **New data:** the `Table` family, `KeyValue`, `ListRow`, `LogView`, `StatChip`.
+- **New feedback and navigation:** `Notice` (strip, callout and inline on the notice strip, with dismiss, retry and action), `ProgressBar`, `DurationSlot`, and `NavList` / `NavRow`, which now draw the settings dialog's and the Project settings' rails.
+
+## Details
+
+- The agents, agent settings, models, plugins, Evaluation Center, Trace, machines and schedules pages, and every company-mode page, now use these components; their de-slop allowlist entries are gone.
+- Page titles keep their size in every theme.
+- An indeterminate progress bar (the update dialog's install phase) pulses as a live signal in each theme's own way.
+- The package's accessibility fallbacks gain expand / collapse, more / fewer, previous / next and the page position.
+- The package's `FolderSection` takes a trailing action outside its toggle, which the company sidebar's Temporary group uses for "Close all".
+- The gallery gains Layout and Data pages, and its Notice, Loading and Badges pages show the new components.
+
+## Visible changes in the default theme (Primer)
+
+- Most 10–11 px captions, counts, tags and meta lines across these pages become 12 px, and 2 px gaps become 4 px.
+- Tables share one header: medium weight instead of bold, 4 px shorter, ruled below, with a row hover and no rule under the last row.
+- Page headers space their actions 16 px from the title and right-align them when they wrap on narrow screens.
+- Collapsible groups (memory, plugins) have a bordered box and no hover fill on the head; the chevron sits before the actions.
+- The work group's title in the transcript is no longer uppercase.
+- Rails: inactive rows one step lighter; the Project settings glyphs 16 px in the subtle ink.
+- Finance tables, the calendar and ticket cards take the 12 px rung, token lines and a little more padding.
+- Model marks (default, vision, free, discount …) become 12 px on the model picker's rows as well, which share them with the models page's cards.
+- The benchmark case browser's tree is wider (380 px in English, 270 px in Chinese) so folder names fit.
diff --git a/changelog/unreleased/2026-09-30-ui-migration-w4.zh.md b/changelog/unreleased/2026-09-30-ui-migration-w4.zh.md
new file mode 100644
index 00000000..cca781e3
--- /dev/null
+++ b/changelog/unreleased/2026-09-30-ui-migration-w4.zh.md
@@ -0,0 +1,37 @@
+# 布局、导航、提示与数据迁入共享 UI 包
+
+- **Date:** 2026-09-30
+- **Type:** refactor
+- **Scope:** `ui`, `web`, `ui-gallery`
+
+[English](2026-09-30-ui-migration-w4.md)
+
+UI 包迁移的 W4 把 Web App 的页面结构搬进 `@prismshadow/penguin-ui`,并让各页改用它们:页头、卡片、表格、分节、提示、进度与统计。
+
+## 迁入的内容
+
+- **迁入**:`Tabs`、分组列表(`GroupHeader`、`FolderSection`、`MoreRow`,以及新增的 `Pager`)、`CreateButtons`、`TodoNotice`、`BetaBadge`、`DisclosureRow`、`LiveDuration` 与 `StatTile`。
+- **新增布局**:`PageFrame` 与 `PageHeader`、`Card` 与 `CardHeader`、`RuledSection`、`CollapsibleSection`、`EntityHeader`。
+- **新增数据**:`Table` 系列、`KeyValue`、`ListRow`、`LogView`、`StatChip`。
+- **新增提示与导航**:`Notice`(建在提示条上的 strip、callout、inline 三种形态,可带关闭、重试与操作)、`ProgressBar`、`DurationSlot`,以及 `NavList` / `NavRow`——设置对话框与项目设置的侧栏已改用它们。
+
+## 细节
+
+- 智能体、智能体设置、模型、插件、评估中心、Trace、机器与定时任务各页,以及公司模式的全部页面改用这些组件,其去 AI 味白名单条目随之清空。
+- 各主题下的页面标题字号保持不变。
+- 不定进度条(更新对话框的安装阶段)作为实时信号脉动,由各主题自定节奏。
+- 包自带的无障碍兜底文案新增展开 / 收起、更多 / 更少、上一页 / 下一页与页码位置。
+- 包里的 `FolderSection` 可在折叠开关之外带一个尾部操作,公司侧栏的「临时」分组用它放「全部关闭」。
+- 画廊新增「布局」与「数据」两页,「提示条」「加载」「徽章」各页展示新组件。
+
+## 通用主题下可见的变化
+
+- 这些页面中多数 10–11 px 的说明、计数、标签与元信息改为 12 px,2 px 的间距改为 4 px。
+- 表格统一表头:字重由粗体改为中等,高度减 4 px,下方加分隔线,行带悬停底色,末行不再有分隔线。
+- 页头的操作与标题相距 16 px,窄屏换行时靠右对齐。
+- 可折叠分组(记忆、插件)带边框外框,标题行不再有悬停底色,展开箭头位于操作之前。
+- 对话中工作组的标题不再全大写。
+- 侧栏:未选中项的文字浅一级;项目设置的图标为 16 px,取次要墨色。
+- 财务表格、日历与工单卡片改用 12 px 字阶与令牌线色,内边距略增。
+- 模型标记(默认、视觉、免费、折扣等)在模型选择器的行里同样改为 12 px,它与模型页的卡片共用这组标记。
+- 评估用例浏览器的目录树加宽(英文 380 px、中文 270 px),以放下文件夹名。
diff --git a/packages/ui-gallery/src/library/boards.tsx b/packages/ui-gallery/src/library/boards.tsx
index af7d1919..b12603ae 100644
--- a/packages/ui-gallery/src/library/boards.tsx
+++ b/packages/ui-gallery/src/library/boards.tsx
@@ -17,10 +17,12 @@ import { BadgesBoard } from "./boards/badges";
import { ButtonsBoard } from "./boards/buttons";
import { ChartsBoard } from "./boards/charts";
import { ContentBoard } from "./boards/content";
+import { DataBoard } from "./boards/data";
import { DialogsBoard } from "./boards/dialogs";
import { EmptyBoard } from "./boards/empty";
import { FilesBoard } from "./boards/files";
import { InputsBoard } from "./boards/inputs";
+import { LayoutBoard } from "./boards/layout";
import { LoadingBoard } from "./boards/loading";
import { NoticesBoard } from "./boards/notices";
import { PickersBoard } from "./boards/pickers";
@@ -47,6 +49,8 @@ export const BOARDS: Readonly<Record<TopicId, ComponentType>> = {
avatars: AvatarsBoard,
files: FilesBoard,
content: ContentBoard,
+ layout: LayoutBoard,
+ data: DataBoard,
colour: ColourBoard,
type: TypeBoard,
shape: ShapeBoard,
diff --git a/packages/ui-gallery/src/library/boards/badges.tsx b/packages/ui-gallery/src/library/boards/badges.tsx
index 3143c57d..65577fa9 100644
--- a/packages/ui-gallery/src/library/boards/badges.tsx
+++ b/packages/ui-gallery/src/library/boards/badges.tsx
@@ -1,6 +1,7 @@
/**
* 徽标与状态: Badge in every tone and weight, the count, the state dot, StatusIcon in every run
- * state, the session activity marks, and the update dot and pill.
+ * state, the session activity marks, the update dot and pill, and the two readings — the stat
+ * tile and the stat chip.
*/
import {
ActivityIcon,
@@ -8,8 +9,11 @@ import {
Badge,
Count,
Dot,
+ ICONS,
ICON_SIZE,
ScheduleMark,
+ StatChip,
+ StatTile,
StatusIcon,
TONES,
UpdateDot,
@@ -106,6 +110,25 @@ export function BadgesBoard() {
</span>
</div>
</BoardGroup>
+ <BoardGroup title={t.statTile}>
+ <div className="grid max-w-xl grid-cols-2 gap-3">
+ <StatTile icon={ICONS.coin} label={t.spend} value="$12.40" detail={t.spendDetail} />
+ <StatTile
+ icon={ICONS.info}
+ label={t.alerts}
+ value={2}
+ tone="danger"
+ detail={t.alertsDetail}
+ />
+ </div>
+ </BoardGroup>
+ <BoardGroup title={t.statChip}>
+ <div className="lib-row text-xs text-fg-subtle">
+ <StatChip glyph={ICONS.arrowUpFromLine} value="18.2k" label={t.input} />
+ <StatChip glyph={ICONS.arrowDownToLine} value="1.4k" label={t.output} />
+ <StatChip glyph={ICONS.clockCompact} value="12.7s" compactValue="13s" label={t.elapsed} />
+ </div>
+ </BoardGroup>
</div>
);
}
diff --git a/packages/ui-gallery/src/library/boards/data.tsx b/packages/ui-gallery/src/library/boards/data.tsx
new file mode 100644
index 00000000..da810f10
--- /dev/null
+++ b/packages/ui-gallery/src/library/boards/data.tsx
@@ -0,0 +1,165 @@
+/**
+ * 数据: the table framed on its own and bare inside a card at the small density, list rows plain
+ * and opening what they name, label/value pairs at both rungs, and a running job's log — all from
+ * the package.
+ */
+import {
+ AgentAvatar,
+ Badge,
+ Button,
+ Card,
+ CardHeader,
+ GlyphIcon,
+ ICONS,
+ ICON_SIZE,
+ IconButton,
+ KeyValue,
+ KeyValueRow,
+ ListRow,
+ LogView,
+ Table,
+ TableBody,
+ TableCell,
+ TableHead,
+ TableHeaderCell,
+ TableRow,
+} from "@prismshadow/penguin-ui";
+import { BoardGroup } from "../../foundations/shared";
+import { useGallery } from "../../state";
+
+/** Ids, schedules, figures and command output are the same in both languages: data, not copy. */
+const SCHEDULES = [
+ { name: "daily-digest", period: "0 9 * * *", cost: "$0.42", enabled: true },
+ { name: "inbox-triage", period: "*/30 * * * *", cost: "$1.08", enabled: true },
+ { name: "weekly-report", period: "0 17 * * 5", cost: "$0.00", enabled: false },
+];
+const SPEND = ["$12.40", "$8.75", "$3.10"];
+const SKILLS = ["pdf", "web-design", "continual-learning"];
+const ROOT = "~/.penguin/data";
+const MACHINE_ID = "m_7f3a9c21";
+const LOG = [
+ "Pulling penguin-harness 0.2.13",
+ "Verifying the download",
+ "Stopping the server",
+ "Starting the server on port 8930",
+];
+
+export function DataBoard() {
+ const { S } = useGallery();
+ const t = S.library.data;
+ return (
+ <div className="gf-board">
+ <BoardGroup title={t.table} aside={t.tableHint}>
+ <Table caption={t.caption} tableClassName="min-w-[32rem]">
+ <TableHead>
+ <TableHeaderCell>{t.columns.name}</TableHeaderCell>
+ <TableHeaderCell>{t.columns.status}</TableHeaderCell>
+ <TableHeaderCell>{t.columns.period}</TableHeaderCell>
+ <TableHeaderCell align="right">{t.columns.cost}</TableHeaderCell>
+ <TableHeaderCell />
+ </TableHead>
+ <TableBody>
+ {SCHEDULES.map((row) => (
+ <TableRow key={row.name}>
+ <TableCell className="font-mono text-xs">{row.name}</TableCell>
+ <TableCell nowrap>
+ <Badge tone={row.enabled ? "success" : "neutral"}>
+ {row.enabled ? t.enabled : t.paused}
+ </Badge>
+ </TableCell>
+ <TableCell nowrap className="font-mono text-xs text-fg-muted">
+ {row.period}
+ </TableCell>
+ <TableCell numeric>{row.cost}</TableCell>
+ <TableCell align="right" nowrap>
+ <Button size="sm" variant="ghost">
+ {row.enabled ? t.pause : t.enable}
+ </Button>
+ </TableCell>
+ </TableRow>
+ ))}
+ </TableBody>
+ </Table>
+ </BoardGroup>
+ <BoardGroup title={t.bare}>
+ <div className="lib-stack">
+ <Card>
+ <CardHeader title={t.spendTitle} />
+ <Table framed={false} size="sm">
+ <TableHead>
+ <TableHeaderCell>{t.columns.employee}</TableHeaderCell>
+ <TableHeaderCell align="right">{t.columns.cost}</TableHeaderCell>
+ </TableHead>
+ <TableBody>
+ {t.employees.map((employee, i) => (
+ <TableRow key={employee}>
+ <TableCell>{employee}</TableCell>
+ <TableCell numeric>{SPEND[i]}</TableCell>
+ </TableRow>
+ ))}
+ </TableBody>
+ </Table>
+ </Card>
+ </div>
+ </BoardGroup>
+ <BoardGroup title={t.rows} aside={t.rowsHint}>
+ <div className="lib-stack lib-stack-wide">
+ <Card padding="none">
+ {SKILLS.map((skill, i) => (
+ <ListRow
+ key={skill}
+ leading={<AgentAvatar id={skill} size={32} />}
+ title={<span className="font-mono">{skill}</span>}
+ description={t.skillDescriptions[i]}
+ meta={t.skillMeta}
+ trailing={
+ <IconButton label={t.exportSkill(skill)} size="sm" variant="ghost">
+ <GlyphIcon d={ICONS.download} size={ICON_SIZE.inlineGlyph} />
+ </IconButton>
+ }
+ />
+ ))}
+ </Card>
+ <span className="lib-caption">{t.clickable}</span>
+ <Card padding="none" as="section">
+ {t.cases.map((title, i) => (
+ <ListRow
+ key={title}
+ title={title}
+ description={`case-0${i + 1}`}
+ onClick={() => {}}
+ />
+ ))}
+ </Card>
+ </div>
+ </BoardGroup>
+ <BoardGroup title={t.keyValue}>
+ <div className="lib-row">
+ <Card>
+ <KeyValue>
+ <KeyValueRow label={t.labels.version}>0.2.13</KeyValueRow>
+ <KeyValueRow label={t.labels.started}>2026-09-30 09:12</KeyValueRow>
+ <KeyValueRow label={t.labels.root} mono>
+ {ROOT}
+ </KeyValueRow>
+ <KeyValueRow label={t.labels.machineId} mono>
+ {MACHINE_ID}
+ </KeyValueRow>
+ </KeyValue>
+ </Card>
+ <KeyValue size="sm">
+ <KeyValueRow label={t.labels.version}>0.2.13</KeyValueRow>
+ <KeyValueRow label={t.labels.root} mono>
+ {ROOT}
+ </KeyValueRow>
+ </KeyValue>
+ </div>
+ </BoardGroup>
+ <BoardGroup title={t.log} aside={t.logHint}>
+ <div className="lib-stack">
+ <LogView lines={LOG} highlightLast label={t.logLabel} maxHeight="sm" />
+ </div>
+ </BoardGroup>
+ </div>
+ );
+}
diff --git a/packages/ui-gallery/src/library/boards/layout.tsx b/packages/ui-gallery/src/library/boards/layout.tsx
new file mode 100644
index 00000000..17687651
--- /dev/null
+++ b/packages/ui-gallery/src/library/boards/layout.tsx
@@ -0,0 +1,215 @@
+/**
+ * 布局: a page frame with its header (the display title and its "?", the line under it, the way
+ * back and the actions), the card padded and flush, the ruled section, the collapsible section
+ * open and folded, the entity header, and the navigation list at both densities — all from the
+ * package.
+ */
+import { useState } from "react";
+import {
+ AgentAvatar,
+ Badge,
+ Button,
+ Card,
+ CardHeader,
+ CollapsibleSection,
+ CopyButton,
+ Count,
+ EntityHeader,
+ GlyphIcon,
+ ICONS,
+ ICON_SIZE,
+ IconButton,
+ Input,
+ ListRow,
+ NavList,
+ NavRow,
+ PageFrame,
+ PageHeader,
+ ProviderLogo,
+ RuledSection,
+ Text,
+} from "@prismshadow/penguin-ui";
+import { BoardGroup } from "../../foundations/shared";
+import { useGallery } from "../../state";
+
+/** Model ids are the same in both languages: they are data, not copy. */
+const MODELS = ["gpt-5.4", "gpt-5.4-mini", "o4-mini"];
+const AGENT_ID = "code-reviewer";
+
+/** The rail's pages and their glyphs; the last one has nowhere to go yet. */
+const NAV_PAGES = [
+ { key: "overview", glyph: ICONS.gear },
+ { key: "models", glyph: ICONS.chip },
+ { key: "schedules", glyph: ICONS.alarmClock },
+ { key: "vault", glyph: ICONS.key },
+ { key: "billing", glyph: ICONS.dollarCircle },
+] as const;
+type NavPage = (typeof NAV_PAGES)[number]["key"];
+
+export function LayoutBoard() {
+ const { S } = useGallery();
+ const t = S.library.layout;
+ const [query, setQuery] = useState("");
+ const [groupOpen, setGroupOpen] = useState(true);
+ const [navPage, setNavPage] = useState<NavPage>("overview");
+ return (
+ <div className="gf-board">
+ <BoardGroup title={t.page} aside={t.pageHint}>
+ <div className="lib-box">
+ <PageFrame width="full">
+ <PageHeader
+ title={t.pageTitle}
+ info={t.pageInfo}
+ description={t.pageDescription}
+ back={{ label: t.back, onClick: () => {} }}
+ actions={
+ <>
+ <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={t.search}
+ aria-label={t.search}
+ />
+ </div>
+ <Button
+ size="sm"
+ variant="primary"
+ leading={<GlyphIcon d={ICONS.plus} size={ICON_SIZE.inlineGlyph} />}
+ >
+ {t.create}
+ </Button>
+ </>
+ }
+ />
+ <Text variant="caption">{t.pageBody}</Text>
+ </PageFrame>
+ </div>
+ </BoardGroup>
+ <BoardGroup title={t.cards}>
+ <div className="lib-stack lib-stack-wide">
+ <span className="lib-caption">{t.padded}</span>
+ <Card>
+ <CardHeader
+ title={t.cardTitle}
+ info={t.cardInfo}
+ actions={
+ <Button size="xs" variant="ghost">
+ {t.cardAction}
+ </Button>
+ }
+ />
+ <p className="text-lg font-semibold tabular-nums">{t.cardValue}</p>
+ <Text variant="caption">{t.cardBody}</Text>
+ </Card>
+ <span className="lib-caption">{t.flush}</span>
+ <Card padding="none">
+ <CardHeader title={t.flushTitle} description={t.flushDescription} />
+ {t.flushRows.map((row) => (
+ <ListRow key={row} title={row} />
+ ))}
+ </Card>
+ </div>
+ </BoardGroup>
+ <BoardGroup title={t.ruled}>
+ <RuledSection
+ title={t.ruledTitle}
+ info={t.ruledInfo}
+ count={3}
+ actions={
+ <Button size="xs" variant="ghost">
+ {t.ruledAction}
+ </Button>
+ }
+ >
+ <Text variant="small" className="text-fg-muted">
+ {t.ruledBody}
+ </Text>
+ </RuledSection>
+ </BoardGroup>
+ <BoardGroup title={t.collapsible} aside={t.collapsibleHint}>
+ <div className="lib-stack lib-stack-wide">
+ <CollapsibleSection
+ title={t.providerName}
+ leading={<ProviderLogo provider="openai" className="size-5" />}
+ meta={t.modelCount(MODELS.length)}
+ open={groupOpen}
+ onOpenChange={setGroupOpen}
+ actions={
+ <IconButton label={t.addModel} size="sm" variant="ghost">
+ <GlyphIcon d={ICONS.plus} size={ICON_SIZE.inlineGlyph} />
+ </IconButton>
+ }
+ >
+ {MODELS.map((model) => (
+ <ListRow key={model} title={model} />
+ ))}
+ </CollapsibleSection>
+ <CollapsibleSection title={t.foldedTitle} meta={t.modelCount(0)} defaultOpen={false}>
+ <p className="px-3 py-2 text-xs text-fg-subtle">{t.foldedBody}</p>
+ </CollapsibleSection>
+ </div>
+ </BoardGroup>
+ <BoardGroup title={t.entity}>
+ <EntityHeader
+ media={<AgentAvatar id={AGENT_ID} name={t.entityName} size={40} />}
+ name={t.entityName}
+ meta={
+ <>
+ <span className="font-mono">{AGENT_ID}</span>
+ <CopyButton text={AGENT_ID} label={t.copyId} size="sm" />
+ </>
+ }
+ description={t.entityDescription}
+ actions={
+ <Button size="sm" variant="primary">
+ {t.entityAction}
+ </Button>
+ }
+ >
+ <div className="flex flex-wrap gap-1.5">
+ {t.entityTags.map((tag) => (
+ <Badge key={tag}>{tag}</Badge>
+ ))}
+ </div>
+ </EntityHeader>
+ </BoardGroup>
+ <BoardGroup title={t.nav} aside={t.navHint}>
+ <div className="lib-stack lib-stack-wide">
+ <span className="lib-caption">{t.navRail}</span>
+ <div className="lib-box" data-narrow>
+ <NavList label={t.navLabel} className="p-3">
+ {NAV_PAGES.map((page) => (
+ <NavRow
+ key={page.key}
+ label={t.navRows[page.key]}
+ glyph={page.glyph}
+ active={navPage === page.key}
+ disabled={page.key === "billing"}
+ badge={page.key === "schedules" ? <Count n={3} /> : undefined}
+ onClick={() => setNavPage(page.key)}
+ />
+ ))}
+ </NavList>
+ </div>
+ <span className="lib-caption">{t.navDense}</span>
+ <div className="lib-box" data-narrow>
+ <NavList label={t.navDense} className="p-2">
+ {NAV_PAGES.slice(0, 3).map((page) => (
+ <NavRow
+ key={page.key}
+ density="sm"
+ label={t.navRows[page.key]}
+ glyph={page.glyph}
+ active={navPage === page.key}
+ onClick={() => setNavPage(page.key)}
+ />
+ ))}
+ </NavList>
+ </div>
+ </div>
+ </BoardGroup>
+ </div>
+ );
+}
diff --git a/packages/ui-gallery/src/library/boards/loading.tsx b/packages/ui-gallery/src/library/boards/loading.tsx
index fb9d25cd..8a84f2ff 100644
--- a/packages/ui-gallery/src/library/boards/loading.tsx
+++ b/packages/ui-gallery/src/library/boards/loading.tsx
@@ -1,6 +1,15 @@
-/** 加载: the running-state spinner on its three rungs, and the skeleton line, list and card. */
-import { Skeleton, SkeletonCard, SkeletonList, StatusIcon } from "@prismshadow/penguin-ui";
-import type { StatusIconSize } from "@prismshadow/penguin-ui";
+/**
+ * 加载: the running-state spinner on its three rungs, the skeleton line, list and card, and the
+ * progress bar on its three heights, toned and indeterminate.
+ */
+import {
+ ProgressBar,
+ Skeleton,
+ SkeletonCard,
+ SkeletonList,
+ StatusIcon,
+} from "@prismshadow/penguin-ui";
+import type { ProgressBarSize, StatusIconSize } from "@prismshadow/penguin-ui";
import { BoardGroup } from "../../foundations/shared";
import { useGallery } from "../../state";
@@ -11,6 +20,13 @@ const SPINNER_RUNGS: readonly (readonly [StatusIconSize, number])[] = [
["md", 14],
];
+/** The bar's heights, each at its own reading. */
+const BAR_RUNGS: readonly (readonly [ProgressBarSize, number])[] = [
+ ["xs", 30],
+ ["sm", 60],
+ ["md", 90],
+];
+
export function LoadingBoard() {
const { S } = useGallery();
const t = S.library.loading;
@@ -44,6 +60,26 @@ export function LoadingBoard() {
<SkeletonCard />
</div>
</BoardGroup>
+ <BoardGroup title={t.progress} aside={t.progressHint}>
+ <div className="lib-stack">
+ {BAR_RUNGS.map(([size, value]) => (
+ <div key={size} className="grid gap-1">
+ <span className="lib-caption">
+ {size} · {value}%
+ </span>
+ <ProgressBar size={size} value={value} label={t.progressLabel} />
+ </div>
+ ))}
+ <div className="grid gap-1">
+ <span className="lib-caption">{t.progressOver}</span>
+ <ProgressBar value={100} tone="danger" label={t.progressLabel} />
+ </div>
+ <div className="grid gap-1">
+ <span className="lib-caption">{t.progressIndeterminate}</span>
+ <ProgressBar indeterminate size="md" label={t.progressLabel} />
+ </div>
+ </div>
+ </BoardGroup>
</div>
);
}
diff --git a/packages/ui-gallery/src/library/boards/notices.tsx b/packages/ui-gallery/src/library/boards/notices.tsx
index 7025f40a..7e281d7e 100644
--- a/packages/ui-gallery/src/library/boards/notices.tsx
+++ b/packages/ui-gallery/src/library/boards/notices.tsx
@@ -1,8 +1,9 @@
/**
* 提示条: the package's NoticeStrip in every tone — plain, with the leading mark a call site draws
- * (`data-slot="icon"`, which a theme that draws its own tone mark hides), and with actions.
+ * (`data-slot="icon"`, which a theme that draws its own tone mark hides), and with actions — then
+ * the Notice built on it in its three variants with its action slots, and the page to-do.
*/
-import { Button, Dot, NoticeStrip } from "@prismshadow/penguin-ui";
+import { Button, Dot, ICONS, Notice, NoticeStrip, TodoNotice } from "@prismshadow/penguin-ui";
import type { NoticeStripTone } from "@prismshadow/penguin-ui";
import { BoardGroup } from "../../foundations/shared";
import { useGallery } from "../../state";
@@ -52,6 +53,44 @@ export function NoticesBoard() {
))}
</div>
</BoardGroup>
+ <BoardGroup title={t.variants}>
+ <div className="lib-stack">
+ <span className="lib-caption">{t.variantNames.strip}</span>
+ <div className="lib-box">
+ <Notice tone="danger" variant="strip" retry={{ label: t.retry, onClick: noop }}>
+ {t.texts.danger}
+ </Notice>
+ </div>
+ <span className="lib-caption">{t.variantNames.callout}</span>
+ <Notice
+ tone="attention"
+ variant="callout"
+ title={t.calloutTitle}
+ glyph={ICONS.info}
+ dismiss={{ label: t.dismiss, onClick: noop }}
+ action={{ label: t.action, onClick: noop }}
+ >
+ {t.calloutBody}
+ </Notice>
+ <span className="lib-caption">{t.variantNames.inline}</span>
+ <Notice tone="info" variant="inline" dismiss={{ onClick: noop }}>
+ {t.texts.info}
+ </Notice>
+ </div>
+ </BoardGroup>
+ <BoardGroup title={t.todo}>
+ <div className="lib-stack">
+ <TodoNotice
+ text={t.todoText}
+ actionLabel={t.todoAction}
+ onAction={noop}
+ dismissLabel={t.todoDismiss}
+ onDismiss={noop}
+ />
+ </div>
+ </BoardGroup>
</div>
);
}
+
+function noop() {}
diff --git a/packages/ui-gallery/src/library/boards/tabs.tsx b/packages/ui-gallery/src/library/boards/tabs.tsx
index e6dbea99..4b024e5c 100644
--- a/packages/ui-gallery/src/library/boards/tabs.tsx
+++ b/packages/ui-gallery/src/library/boards/tabs.tsx
@@ -1,6 +1,6 @@
/** 标签页: the app's Tabs, plain and with an update badge on one tab. */
import { useState } from "react";
-import { Tabs } from "../../../../web/src/components/ui/tabs";
+import { Tabs } from "@prismshadow/penguin-ui";
import { BoardGroup } from "../../foundations/shared";
import { useGallery } from "../../state";
diff --git a/packages/ui-gallery/src/library/topics.ts b/packages/ui-gallery/src/library/topics.ts
index e75af7d7..54d71713 100644
--- a/packages/ui-gallery/src/library/topics.ts
+++ b/packages/ui-gallery/src/library/topics.ts
@@ -28,6 +28,8 @@ export const TOPIC_IDS = [
"avatars",
"files",
"content",
+ "layout",
+ "data",
"colour",
"type",
"shape",
@@ -64,6 +66,8 @@ export const TOPICS: readonly Topic[] = [
component("avatars"),
component("files"),
component("content"),
+ component("layout"),
+ component("data"),
foundation("colour"),
foundation("type"),
foundation("shape"),
diff --git a/packages/ui-gallery/src/strings-en.ts b/packages/ui-gallery/src/strings-en.ts
index bba30aa9..a1818fd8 100644
--- a/packages/ui-gallery/src/strings-en.ts
+++ b/packages/ui-gallery/src/strings-en.ts
@@ -412,7 +412,8 @@ export const en: GalleryStrings = {
},
notices: {
title: "Notice strips",
- description: "A notice that owns a row: every tone, with and without actions.",
+ description:
+ "A notice that owns a row: every tone, with and without actions; the three notice variants built on it, and the page to-do.",
},
dialogs: {
title: "Dialogs",
@@ -427,13 +428,16 @@ export const en: GalleryStrings = {
badges: {
title: "Badges and status",
description:
- "Badges and counts, state dots, run-state icons, session activity marks and the update dot.",
+ "Badges and counts, state dots, run-state icons, session activity marks, the update dot, and the stat tile and chip.",
},
empty: {
title: "Empty states",
description: "The placeholder for a list or detail with nothing in it, with an action.",
},
- loading: { title: "Loading", description: "The spinner and the skeletons." },
+ loading: {
+ title: "Loading",
+ description: "The spinner, the skeletons and the progress bar.",
+ },
streaming: {
title: "Streaming",
description:
@@ -454,6 +458,15 @@ export const en: GalleryStrings = {
description:
"Headings and text roles, inline code, Markdown prose, code blocks and surfaces, and the diff viewer.",
},
+ layout: {
+ title: "Layout",
+ description:
+ "The page frame and header, cards and their headers, ruled and collapsible sections, the entity header and the navigation list.",
+ },
+ data: {
+ title: "Data",
+ description: "Tables, list rows, label/value pairs and the log view.",
+ },
colour: {
title: "Colour",
description: "Surfaces, inks, lines, the accent, the tones, chart series and code colours.",
@@ -629,6 +642,19 @@ export const en: GalleryStrings = {
},
action: "View",
dismiss: "Dismiss",
+ variants: "Three variants",
+ variantNames: {
+ strip: "Strip: across a panel",
+ callout: "Callout: a block of its own",
+ inline: "Inline: inside the content",
+ },
+ retry: "Retry",
+ calloutTitle: "The template has no memory placeholder",
+ calloutBody: "Insert the placeholder into the prompt template to inject memory.",
+ todo: "Page to-do",
+ todoText: "3 skills can be updated",
+ todoAction: "Update all",
+ todoDismiss: "Mark as read",
},
dialogs: {
modal: "Modal",
@@ -719,6 +745,15 @@ export const en: GalleryStrings = {
dotAnchor: "Plugins",
pill: "Update pill",
pillText: "3 updates",
+ statTile: "Stat tiles",
+ spend: "Spend this month",
+ spendDetail: "Organization budget $40",
+ alerts: "Alerts",
+ alertsDetail: "1 over budget, 1 paused",
+ statChip: "Stat chips",
+ input: "Input",
+ output: "Output",
+ elapsed: "Elapsed",
},
empty: {
page: "Page empty state",
@@ -734,6 +769,11 @@ export const en: GalleryStrings = {
skeleton: "Skeletons",
list: "List",
card: "Card",
+ progress: "Progress bar",
+ progressHint: "Three heights; still while indeterminate",
+ progressLabel: "Download progress",
+ progressOver: "Over the limit",
+ progressIndeterminate: "Indeterminate",
},
streaming: {
reply: "Assistant reply",
@@ -882,5 +922,111 @@ export const en: GalleryStrings = {
diffLabel: "Changes to src/config.ts",
patchLabel: "Changes to src/limits.ts",
},
+ layout: {
+ page: "Page and header",
+ pageHint:
+ "A page header has one display title and no eyebrow; the way back sits above the title, the actions at the end of its row.",
+ pageTitle: "Agents",
+ pageInfo: "Each agent has its own prompt, tools, skills and memory.",
+ pageDescription: "4 agents in this project.",
+ pageBody: "The page's content starts here.",
+ back: "Back to the list",
+ search: "Search agents",
+ create: "New",
+ cards: "Cards",
+ padded: "Padded: a title row above the content",
+ cardTitle: "Spend this month",
+ cardInfo: "What every agent spent on models this month.",
+ cardAction: "Export",
+ cardValue: "$128.45",
+ cardBody: "12% less than last month.",
+ flush: "Flush: rows run edge to edge under a ruled strip",
+ flushTitle: "Recent sessions",
+ flushDescription: "By their last message.",
+ flushRows: [
+ "Draft this week's release notes",
+ "Find the skipped scheduled run",
+ "Add three cases to the eval set",
+ ],
+ ruled: "Ruled section",
+ ruledTitle: "Inbox",
+ ruledInfo: "Tickets waiting on you: to review, or sent back.",
+ ruledAction: "Mark all read",
+ ruledBody: "Three tickets wait for your review.",
+ collapsible: "Collapsible section",
+ collapsibleHint:
+ "The fold is layout motion: the body's grid row goes between 1fr and 0fr, and the theme decides how it moves.",
+ providerName: "OpenAI",
+ modelCount: (n: number) => (n === 1 ? "1 model" : `${n} models`),
+ addModel: "Add a model",
+ foldedTitle: "Custom",
+ foldedBody: "This group has no models yet.",
+ entity: "Entity header",
+ entityName: "Code reviewer",
+ entityDescription:
+ "Reads every PR's diff and raises only the problems that would cause a bug.",
+ copyId: "Copy id",
+ entityAction: "Open a session",
+ entityTags: ["review", "read-only"],
+ nav: "Navigation list",
+ navHint:
+ "The current row takes the solid fill and is the current page; a glyph is decoration beside a label that already says it. A dialog's rail scrolls sideways on a phone.",
+ navLabel: "Agent settings",
+ navRail: "A rail: glyph, label and a trailing count; the last row has nowhere to go yet",
+ navDense: "Dense, inside a panel",
+ navRows: {
+ overview: "Overview",
+ models: "Models",
+ schedules: "Schedules",
+ vault: "Vault",
+ billing: "Billing",
+ },
+ },
+ data: {
+ table: "Table",
+ tableHint:
+ "One header style: the small rung, medium weight, muted ink and a rule; a table on its own is framed, its header on the muted surface.",
+ caption: "Schedules",
+ columns: {
+ name: "Name",
+ status: "Status",
+ period: "Period",
+ cost: "Cost",
+ employee: "Employee",
+ },
+ enabled: "Enabled",
+ paused: "Paused",
+ pause: "Pause",
+ enable: "Enable",
+ bare: "A compact table inside a card",
+ spendTitle: "Spend by employee",
+ employees: ["Researcher", "Writer", "Editor"],
+ rows: "List rows",
+ rowsHint:
+ "A row that opens what it names makes its mark and text one button; its actions stay outside it.",
+ skillDescriptions: [
+ "Reads PDFs and fills in their forms.",
+ "Builds web pages to a design system.",
+ "Distils reusable lessons from sessions.",
+ ],
+ skillMeta: "2 days ago",
+ exportSkill: (name: string) => `Export ${name}`,
+ clickable: "Rows that open what they name",
+ cases: [
+ "Form validation on the sign-in page",
+ "First commit in an empty repository",
+ "Truncating a very long file name",
+ ],
+ keyValue: "Label and value",
+ labels: {
+ version: "Version",
+ started: "Started",
+ root: "Data root",
+ machineId: "Machine id",
+ },
+ log: "Log",
+ logHint: "A job still running: its latest line in the body ink.",
+ logLabel: "Update output",
+ },
},
};
diff --git a/packages/ui-gallery/src/strings.ts b/packages/ui-gallery/src/strings.ts
index 0baf0324..1d58f5a0 100644
--- a/packages/ui-gallery/src/strings.ts
+++ b/packages/ui-gallery/src/strings.ts
@@ -417,7 +417,10 @@ export const zh = {
title: "提示弹窗",
description: "完成操作后的弹出提示:成功、信息、注意与错误,按按钮触发。",
},
- notices: { title: "提示条", description: "占据一行的提示:每种语气,带与不带操作。" },
+ notices: {
+ title: "提示条",
+ description: "占据一行的提示:每种语气,带与不带操作;建在其上的三种提示变体与页面待办。",
+ },
dialogs: {
title: "对话框",
description: "模态对话框、确认框、分页对话框、抽屉、底部面板与图片放大。",
@@ -429,10 +432,10 @@ export const zh = {
tabs: { title: "标签页", description: "下划线式标签切换,可带更新标记。" },
badges: {
title: "徽标与状态",
- description: "徽标与计数、状态点、运行状态图标、会话活动标记与更新点。",
+ description: "徽标与计数、状态点、运行状态图标、会话活动标记与更新点,以及统计卡与统计值。",
},
empty: { title: "空状态", description: "列表或详情为空时的占位文字,可带操作。" },
- loading: { title: "加载", description: "转圈与骨架屏。" },
+ loading: { title: "加载", description: "转圈、骨架屏与进度条。" },
streaming: {
title: "流式输出",
description:
@@ -449,6 +452,11 @@ export const zh = {
title: "内容",
description: "标题与文字角色、行内代码、Markdown 正文、代码块与代码面,以及差异视图。",
},
+ layout: {
+ title: "布局",
+ description: "页面框架与页头、卡片与卡片头、分节、可折叠分节、实体头部,以及导航列表。",
+ },
+ data: { title: "数据", description: "表格、列表行、键值对与日志。" },
colour: {
title: "颜色",
description: "表面、文字、线条、强调色、语义色调、图表序列与代码色。",
@@ -604,6 +612,19 @@ export const zh = {
},
action: "查看",
dismiss: "忽略",
+ variants: "三种变体",
+ variantNames: {
+ strip: "条带:横贯面板",
+ callout: "提示块:独立成块",
+ inline: "行内:嵌在内容里",
+ },
+ retry: "重试",
+ calloutTitle: "模板里缺少记忆占位符",
+ calloutBody: "在提示词模板里插入占位符后,记忆才会注入对话。",
+ todo: "页面待办",
+ todoText: "有 3 个技能可更新",
+ todoAction: "全部更新",
+ todoDismiss: "标为已读",
},
dialogs: {
modal: "模态对话框",
@@ -693,6 +714,15 @@ export const zh = {
dotAnchor: "插件市场",
pill: "更新提示",
pillText: "3 个可更新",
+ statTile: "统计卡",
+ spend: "本月花费",
+ spendDetail: "组织预算 $40",
+ alerts: "告警",
+ alertsDetail: "1 人超出预算、1 人已暂停",
+ statChip: "统计值",
+ input: "输入",
+ output: "输出",
+ elapsed: "耗时",
},
empty: {
page: "页面空状态",
@@ -708,6 +738,11 @@ export const zh = {
skeleton: "骨架屏",
list: "列表",
card: "卡片",
+ progress: "进度条",
+ progressHint: "三档高度;不定进度时静止",
+ progressLabel: "下载进度",
+ progressOver: "超出上限",
+ progressIndeterminate: "不定进度",
},
streaming: {
reply: "助手回答",
@@ -851,6 +886,100 @@ export const zh = {
diffLabel: "src/config.ts 的改动",
patchLabel: "src/limits.ts 的改动",
},
+ layout: {
+ page: "页面与页头",
+ pageHint: "页头只有一个展示标题,不加眉题;返回在标题上方,操作在标题行末尾。",
+ pageTitle: "智能体",
+ pageInfo: "每个智能体有自己的提示词、工具、技能与记忆。",
+ pageDescription: "当前项目里的 4 个智能体。",
+ pageBody: "页面内容从这里开始。",
+ back: "返回列表",
+ search: "搜索智能体",
+ create: "新建",
+ cards: "卡片",
+ padded: "带内边距:标题行在内容上方",
+ cardTitle: "本月花费",
+ cardInfo: "本月所有智能体的模型花费。",
+ cardAction: "导出",
+ cardValue: "$128.45",
+ cardBody: "比上月少 12%。",
+ flush: "贴边:行铺满卡片,标题是一条分隔带",
+ flushTitle: "最近的会话",
+ flushDescription: "按最后一条消息排序。",
+ flushRows: ["整理本周的发布说明", "排查定时任务漏跑", "给评测集补三个用例"],
+ ruled: "分节",
+ ruledTitle: "收件箱",
+ ruledInfo: "等你处理的工单:待审核的与被退回的。",
+ ruledAction: "全部标为已读",
+ ruledBody: "三张工单等你审核。",
+ collapsible: "可折叠分节",
+ collapsibleHint: "折叠是布局动效:正文的网格行在 1fr 与 0fr 之间变化,由主题决定怎么动。",
+ providerName: "OpenAI",
+ modelCount: (n: number) => `${n} 个模型`,
+ addModel: "添加模型",
+ foldedTitle: "自定义",
+ foldedBody: "这个分组还没有模型。",
+ entity: "实体头部",
+ entityName: "代码审查员",
+ entityDescription: "阅读每个 PR 的改动,只指出会导致错误的问题。",
+ copyId: "复制 ID",
+ entityAction: "打开会话",
+ entityTags: ["审查", "只读"],
+ nav: "导航列表",
+ navHint:
+ "当前行用实色填充,并标为当前页;图标只是装饰,旁边的标签已经说明了它。对话框的侧栏在手机上横向滚动。",
+ navLabel: "智能体设置",
+ navRail: "侧栏:图标、标签与行尾计数;最后一行暂时无处可去",
+ navDense: "紧凑:用在面板里",
+ navRows: {
+ overview: "概览",
+ models: "模型",
+ schedules: "定时任务",
+ vault: "密钥库",
+ billing: "账单",
+ },
+ },
+ data: {
+ table: "表格",
+ tableHint:
+ "表头只有一种:小号字阶、中等字重、次要墨色与一条分隔线;独立的表格自带边框,表头在次级表面上。",
+ caption: "定时任务",
+ columns: {
+ name: "名称",
+ status: "状态",
+ period: "周期",
+ cost: "花费",
+ employee: "员工",
+ },
+ enabled: "已启用",
+ paused: "已暂停",
+ pause: "暂停",
+ enable: "启用",
+ bare: "卡片里的紧凑表格",
+ spendTitle: "按员工的花费",
+ employees: ["研究员", "撰稿人", "审校"],
+ rows: "列表行",
+ rowsHint: "可点击的行把标志与文字合成一个按钮,行尾的操作留在按钮之外。",
+ skillDescriptions: [
+ "读取 PDF 并填写其中的表单。",
+ "按设计规范搭建网页。",
+ "从会话中总结可复用的经验。",
+ ],
+ skillMeta: "2 天前",
+ exportSkill: (name: string) => `导出 ${name}`,
+ clickable: "打开所指内容的行",
+ cases: ["登录页的表单校验", "空仓库的首次提交", "超长文件名的截断"],
+ keyValue: "键值对",
+ labels: {
+ version: "版本",
+ started: "启动于",
+ root: "数据根",
+ machineId: "机器 ID",
+ },
+ log: "日志",
+ logHint: "仍在运行的任务:最后一行用正文墨色。",
+ logLabel: "更新输出",
+ },
},
};
diff --git a/packages/ui-gallery/test/library.test.ts b/packages/ui-gallery/test/library.test.ts
index 9987d5ef..75c64b96 100644
--- a/packages/ui-gallery/test/library.test.ts
+++ b/packages/ui-gallery/test/library.test.ts
@@ -65,6 +65,8 @@ describe("the library's topics", () => {
"avatars",
"files",
"content",
+ "layout",
+ "data",
]);
const foundations = TOPIC_GROUPS.find((group) => group.id === "foundations")!.topics;
expect(foundations.map((topic) => topic.id)).toEqual([
@@ -282,6 +284,50 @@ describe("the content board", () => {
});
});
+describe("the layout and data boards", () => {
+ it("show every layout and data component from the package, and nothing from the app", () => {
+ const boards = {
+ layout: [
+ "PageFrame",
+ "PageHeader",
+ "Card",
+ "CardHeader",
+ "RuledSection",
+ "CollapsibleSection",
+ "EntityHeader",
+ "NavList",
+ "NavRow",
+ ],
+ data: [
+ "Table",
+ "TableHead",
+ "TableHeaderCell",
+ "TableRow",
+ "TableCell",
+ "ListRow",
+ "KeyValue",
+ "KeyValueRow",
+ "LogView",
+ ],
+ };
+ for (const [topic, components] of Object.entries(boards)) {
+ const board = read(`../src/library/boards/${topic}.tsx`);
+ expect(board).toMatch(/from "@prismshadow\/penguin-ui";/);
+ expect(board).not.toMatch(/web\/src/);
+ for (const component of components) {
+ expect(board, `${topic}: ${component}`).toMatch(new RegExp(`<${component}[\\s/>]`));
+ }
+ }
+ // Both paddings of the card, a folded section, a bare table and a row that opens something.
+ const layout = read("../src/library/boards/layout.tsx");
+ expect(layout).toMatch(/<Card padding="none">/);
+ expect(layout).toMatch(/defaultOpen=\{false\}/);
+ const data = read("../src/library/boards/data.tsx");
+ expect(data).toMatch(/<Table framed=\{false\} size="sm">/);
+ expect(data).toMatch(/onClick=\{/);
+ });
+});
+
describe("the streaming board", () => {
it("plays the streaming Session's answer through the app's reply body, on one seed, with a replay", () => {
const board = read("../src/library/boards/streaming.tsx");
diff --git a/packages/web/src/features/ai-create/create-buttons.tsx b/packages/ui/src/components/actions/create-buttons/create-buttons.tsx
similarity index 75%
rename from packages/web/src/features/ai-create/create-buttons.tsx
rename to packages/ui/src/components/actions/create-buttons/create-buttons.tsx
index be20b063..5717b758 100644
--- a/packages/web/src/features/ai-create/create-buttons.tsx
+++ b/packages/ui/src/components/actions/create-buttons/create-buttons.tsx
@@ -4,18 +4,23 @@
* other — the reader chooses between two things they can see, instead of discovering the second
* one inside the first. The wand button always carries the accent and the hand button never
* does, so the pair reads the same on every page.
+ *
+ * Both labels are the caller's: the app names the two paths ("Create with AI" / "Create
+ * manually", or an object's own verb, "Import with AI").
*/
-import { Button, GlyphIcon, ICONS } from "@prismshadow/penguin-ui";
-import { S } from "../../lib/strings";
+import { Button } from "../button/button";
+import { GlyphIcon } from "../../icons/glyph-icon/glyph-icon";
+import { ICONS } from "../../icons/icons";
export interface CreateButtonsProps {
onAi: () => void;
- /** Absent: the manual path is not offered on this surface (a member who may not write the form's target still gets the AI path). */
+ /** The AI path's label. */
+ aiLabel: string;
+ /** Absent: the manual path is not offered on this surface. */
onManual?: () => void;
- size?: "sm" | "md";
- /** Labels when the object has its own verb ("Import with AI" / "Import manually"); default S.aiCreate.withAi / S.aiCreate.manual. */
- aiLabel?: string;
+ /** The manual path's label; required wherever `onManual` is given. */
manualLabel?: string;
+ size?: "sm" | "md";
/** Greys both paths. */
disabled?: boolean;
/**
@@ -29,10 +34,10 @@ export interface CreateButtonsProps {
export function CreateButtons({
onAi,
- onManual,
- size = "sm",
aiLabel,
+ onManual,
manualLabel,
+ size = "sm",
disabled,
manualDisabled,
className,
@@ -41,7 +46,7 @@ export function CreateButtons({
<div className={`flex flex-wrap items-center gap-2 ${className ?? ""}`}>
<Button size={size} variant="primary" disabled={disabled} onClick={onAi}>
<GlyphIcon d={ICONS.wand} />
- {aiLabel ?? S.aiCreate.withAi}
+ {aiLabel}
</Button>
{onManual !== undefined && (
<Button
@@ -51,7 +56,7 @@ export function CreateButtons({
onClick={onManual}
>
<GlyphIcon d={ICONS.hand} />
- {manualLabel ?? S.aiCreate.manual}
+ {manualLabel}
</Button>
)}
</div>
diff --git a/packages/ui/src/components/data/key-value/key-value.tsx b/packages/ui/src/components/data/key-value/key-value.tsx
new file mode 100644
index 00000000..d271b033
--- /dev/null
+++ b/packages/ui/src/components/data/key-value/key-value.tsx
@@ -0,0 +1,53 @@
+/**
+ * Label/value pairs: a description list laid out as two columns, the labels as wide as the
+ * longest one and the values taking the rest. A version, a count, a date or a path sits in the
+ * value column, so the list sets its figures tabular — numbers in rows above each other align.
+ *
+ * A value that is an identifier (an id, a path, a command) takes `mono`; every value breaks
+ * anywhere rather than widen the list.
+ */
+import type { ReactNode } from "react";
+
+export type KeyValueSize = "xs" | "sm";
+
+const SIZE: Record<KeyValueSize, string> = {
+ xs: "gap-y-1.5 text-xs",
+ sm: "gap-y-1 text-sm",
+};
+
+export interface KeyValueProps {
+ /** `xs` in a card or a detail block (the default), `sm` in a dialog's body. */
+ size?: KeyValueSize;
+ className?: string;
+ /** The pairs, as `KeyValueRow`s. */
+ children?: ReactNode;
+}
+
+export function KeyValue({ size = "xs", className = "", children }: KeyValueProps) {
+ return (
+ <dl
+ className={`grid grid-cols-[auto_minmax(0,1fr)] gap-x-4 tabular-nums ${SIZE[size]} ${className}`}
+ >
+ {children}
+ </dl>
+ );
+}
+
+export interface KeyValueRowProps {
+ label: ReactNode;
+ /** The value is an identifier: an id, a path, a command. */
+ mono?: boolean;
+ children?: ReactNode;
+}
+
+/** One pair: the label in the muted ink, the value in the body ink. */
+export function KeyValueRow({ label, mono = false, children }: KeyValueRowProps) {
+ return (
+ <>
+ <dt className="text-fg-muted">{label}</dt>
+ <dd className={`min-w-0 text-fg [overflow-wrap:anywhere] ${mono ? "font-mono" : ""}`}>
+ {children}
+ </dd>
+ </>
+ );
+}
diff --git a/packages/ui/src/components/data/list-row/list-row.tsx b/packages/ui/src/components/data/list-row/list-row.tsx
new file mode 100644
index 00000000..8ddc468d
--- /dev/null
+++ b/packages/ui/src/components/data/list-row/list-row.tsx
@@ -0,0 +1,69 @@
+/**
+ * One row of a list in a flush card: a leading mark, a title with an optional line under it, a
+ * quiet meta text and the row's own actions at the end. Rows rule themselves off from the next
+ * one and lighten under the pointer, so a row's actions read as its own.
+ *
+ * A row that opens what it names takes `onClick`: the mark and the text become one button, and
+ * the trailing actions stay outside it, since a button cannot hold another. Title and description
+ * truncate to one line each; the caller puts the whole text in a tooltip where it matters.
+ */
+import type { ReactNode } from "react";
+
+export interface ListRowProps {
+ /** A mark before the text: an avatar, a tile, a glyph. */
+ leading?: ReactNode;
+ title: ReactNode;
+ /** One line under the title. */
+ description?: ReactNode;
+ /** Quiet text before the actions: a date, a size, a version. */
+ meta?: ReactNode;
+ /** The row's own actions. */
+ trailing?: ReactNode;
+ /** Opens what the row names: the mark and the text become one button. */
+ onClick?: () => void;
+ /** `li` inside a `ul` or `ol`; a `div` otherwise (the default). */
+ as?: "div" | "li";
+ className?: string;
+}
+
+export function ListRow({
+ leading,
+ title,
+ description,
+ meta,
+ trailing,
+ onClick,
+ as: Tag = "div",
+ className = "",
+}: ListRowProps) {
+ const text = (
+ <>
+ {leading !== undefined && <span className="flex shrink-0 items-center">{leading}</span>}
+ <span className="min-w-0 flex-1">
+ <span className="block truncate text-sm font-medium text-fg">{title}</span>
+ {description !== undefined && (
+ <span className="mt-0.5 block truncate text-xs text-fg-muted">{description}</span>
+ )}
+ </span>
+ </>
+ );
+ return (
+ <Tag
+ className={`flex items-center gap-3 border-b border-line-muted px-3 py-2.5 transition-colors duration-150 last:border-b-0 hover:bg-surface-muted ${className}`}
+ >
+ {onClick !== undefined ? (
+ <button
+ type="button"
+ onClick={onClick}
+ className="flex min-w-0 flex-1 items-center gap-3 text-left"
+ >
+ {text}
+ </button>
+ ) : (
+ <div className="flex min-w-0 flex-1 items-center gap-3">{text}</div>
+ )}
+ {meta !== undefined && <span className="shrink-0 text-xs text-fg-subtle">{meta}</span>}
+ {trailing !== undefined && <div className="flex shrink-0 items-center gap-1">{trailing}</div>}
+ </Tag>
+ );
+}
diff --git a/packages/ui/src/components/data/log-view/log-view.tsx b/packages/ui/src/components/data/log-view/log-view.tsx
new file mode 100644
index 00000000..a751b99e
--- /dev/null
+++ b/packages/ui/src/components/data/log-view/log-view.tsx
@@ -0,0 +1,56 @@
+/**
+ * A command's output: monospace lines in an inset well that scrolls on its own past its height,
+ * wrapping long lines rather than scrolling sideways. The latest line of a job still running can
+ * stand out in the body ink while the earlier ones stay muted.
+ *
+ * It is a `log` region, so a screen reader hears lines as they are appended, and it takes focus,
+ * so a keyboard can scroll it.
+ */
+import type { HTMLAttributes } from "react";
+
+export type LogViewHeight = "sm" | "md" | "lg";
+
+const HEIGHT: Record<LogViewHeight, string> = {
+ sm: "max-h-48",
+ md: "max-h-64",
+ lg: "max-h-72",
+};
+
+export interface LogViewProps extends Omit<HTMLAttributes<HTMLPreElement>, "children"> {
+ lines: readonly string[];
+ /** The last line in the body ink: the step a running job is on. */
+ highlightLast?: boolean;
+ /** How tall the well grows before it scrolls: 12, 16 or 18 rem. */
+ maxHeight?: LogViewHeight;
+ /** The region's accessible name: what the output is of. */
+ label?: string;
+}
+
+export function LogView({
+ lines,
+ highlightLast = false,
+ maxHeight = "md",
+ label,
+ className = "",
+ ...rest
+}: LogViewProps) {
+ const last = highlightLast && lines.length > 0 ? lines[lines.length - 1] : undefined;
+ const body = last === undefined ? lines : lines.slice(0, -1);
+ return (
+ <pre
+ role="log"
+ aria-label={label}
+ tabIndex={0}
+ {...rest}
+ className={`${HEIGHT[maxHeight]} overflow-auto rounded-md bg-surface-inset p-3 font-mono text-xs leading-relaxed whitespace-pre-wrap text-fg-muted [overflow-wrap:anywhere] ${className}`}
+ >
+ {body.join("\n")}
+ {last !== undefined && (
+ <>
+ {body.length > 0 ? "\n" : ""}
+ <span className="text-fg">{last}</span>
+ </>
+ )}
+ </pre>
+ );
+}
diff --git a/packages/ui/src/components/data/stat-chip/stat-chip.tsx b/packages/ui/src/components/data/stat-chip/stat-chip.tsx
new file mode 100644
index 00000000..d1a1d7c7
--- /dev/null
+++ b/packages/ui/src/components/data/stat-chip/stat-chip.tsx
@@ -0,0 +1,49 @@
+/**
+ * A glyph with a value: one reading in a row of readings (a turn's input, output, speed, cost and
+ * time). The glyph alone does not say which reading it is, so `label` names the chip — as its
+ * tooltip and its accessible name. The value is in tabular figures, so a row of chips that
+ * updates does not jitter.
+ *
+ * `compactValue`, when it differs, replaces the value below the `sm` breakpoint (fewer decimals,
+ * so a row fits a phone); `wideOnly` drops the whole chip there (the least useful reading of a
+ * crowded row).
+ */
+import type { ReactNode } from "react";
+import { ICON_GAP } from "../../../icon-scale";
+import { GlyphIcon } from "../../icons/glyph-icon/glyph-icon";
+
+export function StatChip({
+ glyph,
+ value,
+ compactValue,
+ label,
+ wideOnly = false,
+}: {
+ /** A 24×24 line path. */
+ glyph: string;
+ /** The reading: text, or a live element (a clock that ticks while a run is open). */
+ value: ReactNode;
+ compactValue?: string;
+ /** What the reading is: the chip's tooltip and accessible name. */
+ label: string;
+ /** Shown from the `sm` breakpoint up only. */
+ wideOnly?: boolean;
+}) {
+ return (
+ <span
+ data-tooltip={label}
+ aria-label={label}
+ className={`${wideOnly ? "hidden sm:flex" : "flex"} items-center ${ICON_GAP.tight} tabular-nums`}
+ >
+ <GlyphIcon d={glyph} />
+ {compactValue !== undefined && compactValue !== value ? (
+ <>
+ <span className="sm:hidden">{compactValue}</span>
+ <span className="hidden sm:inline">{value}</span>
+ </>
+ ) : (
+ value
+ )}
+ </span>
+ );
+}
diff --git a/packages/ui/src/components/data/stat-tile/stat-tile.tsx b/packages/ui/src/components/data/stat-tile/stat-tile.tsx
new file mode 100644
index 00000000..489d99f1
--- /dev/null
+++ b/packages/ui/src/components/data/stat-tile/stat-tile.tsx
@@ -0,0 +1,61 @@
+/**
+ * One KPI as its own bordered tile: a small glyph beside the label, the value bold beneath it,
+ * and a quiet line of detail under that. A tone inks the glyph and the value together, so the
+ * reading and its mark say the same thing.
+ *
+ * The tile is plain elements — a KPI is a reading, not a control, and a whole-tile click would
+ * swallow whatever sits inside it. Anything extra rides beside the value as children (a gauge
+ * that pictures the number).
+ */
+import type { ReactNode } from "react";
+import type { ToneName } from "../../../tokens";
+import { ICON_GAP, ICON_SIZE } from "../../../icon-scale";
+import { GlyphIcon } from "../../icons/glyph-icon/glyph-icon";
+
+const INK: Readonly<Record<ToneName, string>> = {
+ success: "text-tone-success-fg",
+ attention: "text-tone-attention-fg",
+ danger: "text-tone-danger-fg",
+ done: "text-tone-done-fg",
+ neutral: "text-tone-neutral-fg",
+ info: "text-tone-info-fg",
+};
+
+export function StatTile({
+ icon,
+ label,
+ value,
+ tone,
+ detail,
+ children,
+}: {
+ /** A 24×24 line path for the label's glyph. */
+ icon?: string;
+ label: string;
+ value: ReactNode;
+ /** A reading that is a judgement (over budget, alerts raised): inks the glyph and the value. */
+ tone?: ToneName;
+ /** One quiet line under the value: what the number is measured against. */
+ detail?: ReactNode;
+ /** A visual beside the value. */
+ children?: ReactNode;
+}) {
+ const ink = tone !== undefined ? INK[tone] : "";
+ return (
+ <div className="rounded-md border border-line bg-surface p-3">
+ <p className={`mb-1.5 flex items-center ${ICON_GAP.row} text-xs text-fg-muted`}>
+ {icon !== undefined && <GlyphIcon d={icon} size={ICON_SIZE.inlineGlyph} className={ink} />}
+ <span className="truncate">{label}</span>
+ </p>
+ <div className="flex items-center justify-between gap-2">
+ <div className="min-w-0">
+ <p className={`truncate text-lg font-semibold tabular-nums ${ink}`}>{value}</p>
+ {detail !== undefined && (
+ <p className="mt-0.5 text-xs leading-snug text-fg-muted">{detail}</p>
+ )}
+ </div>
+ {children}
+ </div>
+ </div>
+ );
+}
diff --git a/packages/ui/src/components/data/table/table.tsx b/packages/ui/src/components/data/table/table.tsx
new file mode 100644
index 00000000..cd70cc33
--- /dev/null
+++ b/packages/ui/src/components/data/table/table.tsx
@@ -0,0 +1,186 @@
+/**
+ * The data table: a header row in the small rung, medium weight and muted ink, ruled off from the
+ * body; rows ruled off from each other that lighten under the pointer; two densities.
+ *
+ * A table on its own is framed — a bordered box on the surface that scrolls sideways when the
+ * columns outgrow it, with the header on the muted strip — and carries the `ui-frame` hook like a
+ * card, so a theme redraws both boxes alike. A table inside a card is bare (`framed={false}`): the
+ * card is the box, and the header keeps its rung and its rule without a strip.
+ *
+ * <Table>
+ * <TableHead>
+ * <TableHeaderCell>Name</TableHeaderCell>
+ * <TableHeaderCell align="right">Cost</TableHeaderCell>
+ * </TableHead>
+ * <TableBody>
+ * <TableRow>
+ * <TableCell>alpha</TableCell>
+ * <TableCell numeric>$0.12</TableCell>
+ * </TableRow>
+ * </TableBody>
+ * </Table>
+ */
+import { createContext, useContext } from "react";
+import type {
+ HTMLAttributes,
+ ReactNode,
+ TableHTMLAttributes,
+ TdHTMLAttributes,
+ ThHTMLAttributes,
+} from "react";
+
+export type TableSize = "sm" | "md";
+
+interface TableContextValue {
+ size: TableSize;
+ framed: boolean;
+}
+
+const TableContext = createContext<TableContextValue>({ size: "md", framed: true });
+
+/** A cell's padding per density; the header and the body share it, so columns line up. */
+const CELL: Record<TableSize, string> = {
+ sm: "px-2 py-1.5",
+ md: "px-3 py-2",
+};
+
+export interface TableProps extends TableHTMLAttributes<HTMLTableElement> {
+ /** `md` on a page (the default), `sm` in a dialog, a card or a dense panel. */
+ size?: TableSize;
+ /** Its own bordered box (the default); `false` inside a card, which is the box. */
+ framed?: boolean;
+ /** Read by assistive technology only: what the table lists. */
+ caption?: ReactNode;
+ /** On the box around the table: its place in the page. */
+ className?: string;
+ /** On the table: a minimum width for the columns, a fixed layout. */
+ tableClassName?: string;
+ children?: ReactNode;
+}
+
+export function Table({
+ size = "md",
+ framed = true,
+ caption,
+ className = "",
+ tableClassName = "",
+ children,
+ ...rest
+}: TableProps) {
+ return (
+ <TableContext.Provider value={{ size, framed }}>
+ <div
+ className={`${
+ framed
+ ? "ui-frame overflow-x-auto overflow-y-clip rounded-md border border-line bg-surface"
+ : "overflow-x-auto"
+ } ${className}`}
+ >
+ <table
+ {...rest}
+ className={`w-full text-left ${size === "sm" ? "text-xs" : "text-sm"} ${tableClassName}`}
+ >
+ {caption !== undefined && <caption className="sr-only">{caption}</caption>}
+ {children}
+ </table>
+ </div>
+ </TableContext.Provider>
+ );
+}
+
+/** The header: one row of `TableHeaderCell`s. */
+export function TableHead({ children }: { children?: ReactNode }) {
+ const { framed } = useContext(TableContext);
+ return (
+ <thead>
+ <tr
+ className={`border-b border-line text-xs text-fg-muted ${framed ? "bg-surface-muted" : ""}`}
+ >
+ {children}
+ </tr>
+ </thead>
+ );
+}
+
+export type TableAlign = "left" | "center" | "right";
+
+const ALIGN: Record<TableAlign, string> = {
+ left: "text-left",
+ center: "text-center",
+ right: "text-right",
+};
+
+export interface TableHeaderCellProps extends ThHTMLAttributes<HTMLTableCellElement> {
+ align?: TableAlign;
+ children?: ReactNode;
+}
+
+/** A column's name. Headers never wrap; an empty one heads an actions column. */
+export function TableHeaderCell({
+ align = "left",
+ className = "",
+ children,
+ ...rest
+}: TableHeaderCellProps) {
+ const { size } = useContext(TableContext);
+ return (
+ <th
+ scope="col"
+ {...rest}
+ className={`${CELL[size]} whitespace-nowrap font-medium ${ALIGN[align]} ${className}`}
+ >
+ {children}
+ </th>
+ );
+}
+
+export function TableBody({ children }: { children?: ReactNode }) {
+ return <tbody>{children}</tbody>;
+}
+
+/** A body row: ruled off from the next, lighter under the pointer. */
+export function TableRow({
+ className = "",
+ children,
+ ...rest
+}: HTMLAttributes<HTMLTableRowElement> & { children?: ReactNode }) {
+ return (
+ <tr
+ {...rest}
+ className={`border-b border-line-muted transition-colors duration-150 last:border-b-0 hover:bg-surface-muted ${className}`}
+ >
+ {children}
+ </tr>
+ );
+}
+
+export interface TableCellProps extends TdHTMLAttributes<HTMLTableCellElement> {
+ align?: TableAlign;
+ /** A figure: tabular, and right-aligned unless `align` says otherwise. */
+ numeric?: boolean;
+ /** Keep the cell on one line. */
+ nowrap?: boolean;
+ children?: ReactNode;
+}
+
+export function TableCell({
+ align,
+ numeric = false,
+ nowrap = false,
+ className = "",
+ children,
+ ...rest
+}: TableCellProps) {
+ const { size } = useContext(TableContext);
+ const side = align ?? (numeric ? "right" : "left");
+ return (
+ <td
+ {...rest}
+ className={`${CELL[size]} ${ALIGN[side]} ${numeric ? "tabular-nums" : ""} ${
+ nowrap ? "whitespace-nowrap" : ""
+ } ${className}`}
+ >
+ {children}
+ </td>
+ );
+}
diff --git a/packages/ui/src/components/feedback/beta-badge/beta-badge.tsx b/packages/ui/src/components/feedback/beta-badge/beta-badge.tsx
new file mode 100644
index 00000000..149360a6
--- /dev/null
+++ b/packages/ui/src/components/feedback/beta-badge/beta-badge.tsx
@@ -0,0 +1,18 @@
+/**
+ * The beta tag: a small bordered superscript that qualifies the word it rides on ("Company" in
+ * the work-mode switch) rather than reporting a state, so it must not read as a status badge —
+ * hence the muted ink and hairline, and no tone. On the smallest text rung.
+ *
+ * Its host positions it out of flow and folds its text into the host's accessible name (a
+ * `Segmented` option's badge), so the tooltip is the only thing the tag says on its own.
+ */
+export function BetaBadge({ label, title }: { label: string; title?: string }) {
+ return (
+ <span
+ {...(title !== undefined ? { "data-tooltip": title } : {})}
+ className="whitespace-nowrap rounded-sm border border-line-emphasis px-0.5 py-px text-xs font-medium leading-none text-fg-muted"
+ >
+ {label}
+ </span>
+ );
+}
diff --git a/packages/ui/src/components/feedback/duration-slot/duration-slot.tsx b/packages/ui/src/components/feedback/duration-slot/duration-slot.tsx
new file mode 100644
index 00000000..7f05448d
--- /dev/null
+++ b/packages/ui/src/components/feedback/duration-slot/duration-slot.tsx
@@ -0,0 +1,100 @@
+/**
+ * A running item's elapsed time, and the duration it settles into.
+ *
+ * `LiveDuration` is the clock on a running card: it ticks every second and shows whole seconds
+ * only — the tenth appears on the settled value once the item finishes. `sinceMs` comes from a
+ * server-side timestamp and may drift from the local clock, so a negative span reads as zero; a
+ * missing start shows an ellipsis. `offsetMs` is the settled duration of an earlier segment (a
+ * tool call's argument generation), added under the live one as it ticks.
+ *
+ * `DurationSlot` is the slot a row keeps for that number: the live clock while the item runs, the
+ * settled duration once it has one, nothing before either is known.
+ *
+ * `useElapsedPast` answers a single threshold question instead, and re-renders once, at the
+ * crossing — a caller that only shows or hides something has nothing to do with a tick.
+ */
+import { useEffect, useState } from "react";
+import type { HTMLAttributes } from "react";
+import { formatDuration, formatDurationLive } from "./format-duration";
+
+export { formatDuration, formatDurationLive } from "./format-duration";
+
+/**
+ * Whether `sinceMs` has been running for `thresholdMs`: false until that moment, then true. One
+ * re-render at the crossing rather than a ticking clock. An undefined `sinceMs` (nothing running,
+ * or no start known) reads as false for as long as it stays undefined.
+ */
+export function useElapsedPast(sinceMs: number | undefined, thresholdMs: number): boolean {
+ const [reached, setReached] = useState(
+ () => sinceMs !== undefined && Date.now() - sinceMs >= thresholdMs,
+ );
+ useEffect(() => {
+ if (sinceMs === undefined) {
+ setReached(false);
+ return;
+ }
+ const remaining = thresholdMs - (Date.now() - sinceMs);
+ if (remaining <= 0) {
+ setReached(true);
+ return;
+ }
+ setReached(false);
+ const id = setTimeout(() => setReached(true), remaining);
+ return () => clearTimeout(id);
+ }, [sinceMs, thresholdMs]);
+ // The `sinceMs` term is load-bearing: on the render where it goes undefined the effect that
+ // clears `reached` has not run yet, so the state still holds the previous subject's answer.
+ return reached && sinceMs !== undefined;
+}
+
+export function LiveDuration({ sinceMs, offsetMs = 0 }: { sinceMs?: number; offsetMs?: number }) {
+ const [now, setNow] = useState(() => Date.now());
+ useEffect(() => {
+ const id = setInterval(() => setNow(Date.now()), 1000);
+ return () => clearInterval(id);
+ }, []);
+ if (sinceMs === undefined) return <>…</>;
+ return <>{formatDurationLive(Math.max(0, offsetMs) + Math.max(0, now - sinceMs))}</>;
+}
+
+/**
+ * The duration slot of a row: mono small figures in the subtle ink, holding the live clock while
+ * `running` (an ellipsis until its start is known), the settled `durationMs` otherwise, and
+ * nothing for a settled item with no duration.
+ * Other attributes (a `data-slot="detail"` for the activity hook) pass through.
+ */
+export function DurationSlot({
+ running,
+ sinceMs,
+ durationMs,
+ offsetMs,
+ className = "",
+ ...rest
+}: {
+ running: boolean;
+ /** When the running item started (a server timestamp). */
+ sinceMs?: number;
+ /** The settled duration, once known. */
+ durationMs?: number;
+ /** A settled earlier segment the live clock counts on top of. */
+ offsetMs?: number;
+ /** Layout only (a responsive `hidden`, a margin). */
+ className?: string;
+} & Omit<HTMLAttributes<HTMLSpanElement>, "className" | "children">) {
+ if (!running && durationMs === undefined) return null;
+ return (
+ <span
+ {...rest}
+ className={`shrink-0 font-mono text-xs tabular-nums text-fg-subtle ${className}`}
+ >
+ {running ? (
+ <LiveDuration
+ {...(sinceMs !== undefined ? { sinceMs } : {})}
+ {...(offsetMs !== undefined ? { offsetMs } : {})}
+ />
+ ) : (
+ formatDuration(durationMs ?? 0)
+ )}
+ </span>
+ );
+}
diff --git a/packages/ui/src/components/feedback/duration-slot/format-duration.ts b/packages/ui/src/components/feedback/duration-slot/format-duration.ts
new file mode 100644
index 00000000..cf2f884c
--- /dev/null
+++ b/packages/ui/src/components/feedback/duration-slot/format-duration.ts
@@ -0,0 +1,37 @@
+/**
+ * Durations as the app and the CLI print them: `820ms`, `2.3s`, `1m3s`. Two forms, because a
+ * settled duration and a running clock read differently: the settled one keeps a tenth of a
+ * second below a minute, the running one shows whole seconds only — a live timer showing tenths
+ * reads as jitter.
+ */
+
+/** One decimal place, a trailing `.0` dropped. */
+function trimZero(v: number): string {
+ const s = v.toFixed(1);
+ return s.endsWith(".0") ? s.slice(0, -2) : s;
+}
+
+/**
+ * A settled duration: `820ms`, `2.3s`, `1m3s`. `compact` (a narrow row) drops the tenth from 10s
+ * up (`12s`, not `12.7s`); below 10s the tenth is significant and stays.
+ */
+export function formatDuration(ms: number, opts?: { compact?: boolean }): string {
+ if (ms < 1000) return `${Math.round(ms)}ms`;
+ const s = ms / 1000;
+ if (s < 60 && !(opts?.compact && s >= 10)) return `${trimZero(s)}s`;
+ // Round the total before splitting it: rounding the remainder while flooring the minutes
+ // would print 119.7s as `1m60s` instead of `2m0s`.
+ const whole = Math.round(s);
+ if (whole < 60) return `${whole}s`;
+ return `${Math.floor(whole / 60)}m${whole % 60}s`;
+}
+
+/**
+ * A running clock: whole seconds only (`0s`, `7s`, `1m3s`), counting up and never showing a
+ * second early. A negative span (a start stamp from a clock ahead of this one) reads as `0s`.
+ */
+export function formatDurationLive(ms: number): string {
+ const s = Math.max(0, Math.floor(ms / 1000));
+ if (s < 60) return `${s}s`;
+ return `${Math.floor(s / 60)}m${s % 60}s`;
+}
diff --git a/packages/ui/src/components/feedback/notice/notice.tsx b/packages/ui/src/components/feedback/notice/notice.tsx
new file mode 100644
index 00000000..1a4bdc09
--- /dev/null
+++ b/packages/ui/src/components/feedback/notice/notice.tsx
@@ -0,0 +1,161 @@
+/**
+ * The notice: one component for the strip across a panel, the callout above a form and the
+ * inline notice inside one, built on {@link NoticeStrip} — which owns the tone, the neutral line
+ * and the theme's notice hook — so this file only lays the parts out.
+ *
+ * Three variants, one anatomy:
+ *
+ * - `strip` — a band across its container: no radius, a rule under it (a load error above a
+ * channel, a failure over a workflow tab).
+ * - `callout` — a block standing on its own in a page or a form: roomier, rounder, with the
+ * actions at its end (a page's to-do, a template missing its placeholder).
+ * - `inline` — a compact box inside the content (a form's auth failure, a refresh that failed
+ * while the old data stays on screen, with its retry).
+ *
+ * The parts are marked with the hook's slots: the leading mark in `icon` (a theme that draws its
+ * own tone mark hides it, so the mark never shows twice), an optional `title`, the `body`, and the
+ * `actions`. Three action slots, in reading order: `dismiss` (a clearing action with a label of
+ * its own, or, with none, the close cross named by the interface's "Dismiss"), `retry`, then the
+ * affirmative `action` last — where every dialog in the app puts its confirm.
+ */
+import type { ReactNode } from "react";
+import { useUiStrings } from "../../../strings";
+import { Button } from "../../actions/button/button";
+import { CloseButton } from "../../actions/close-button/close-button";
+import { GlyphIcon } from "../../icons/glyph-icon/glyph-icon";
+import { ICON_GAP } from "../../../icon-scale";
+import { NoticeStrip } from "./notice-strip";
+import type { NoticeStripTone } from "./notice-strip";
+
+export type NoticeVariant = "strip" | "callout" | "inline";
+
+/** A button a notice offers. */
+export interface NoticeAction {
+ label: string;
+ onClick: () => void;
+ /** The accessible name, when the label needs the notice's own words to say what it acts on. */
+ ariaLabel?: string;
+ /** In flight: the button shows the spinner and takes no presses. */
+ busy?: boolean;
+ disabled?: boolean;
+}
+
+/** The clearing action: a labelled button, or — with no label — the close cross. */
+export interface NoticeDismiss {
+ onClick: () => void;
+ /** A visible label ("Mark as read"); without one the notice shows the close cross. */
+ label?: string;
+ /** The accessible name; the cross's defaults to the interface's "Dismiss". */
+ ariaLabel?: string;
+ disabled?: boolean;
+}
+
+/** Layout per variant; the tone, the line colour and the hook are the strip's. */
+const VARIANT: Readonly<Record<NoticeVariant, string>> = {
+ strip: "flex flex-wrap items-center justify-between gap-x-3 gap-y-2 border-b px-3 py-1.5 text-xs",
+ callout: "flex items-center justify-between gap-4 rounded-lg border px-4 py-3 text-xs",
+ inline:
+ "flex flex-wrap items-center justify-between gap-x-3 gap-y-2 rounded-md border px-3 py-2 text-xs",
+};
+
+export function Notice({
+ tone,
+ variant = "inline",
+ title,
+ glyph,
+ dismiss,
+ retry,
+ action,
+ role,
+ className = "",
+ children,
+}: {
+ tone: NoticeStripTone;
+ variant?: NoticeVariant;
+ /** A heading above the body. */
+ title?: ReactNode;
+ /** The leading mark: a 24×24 line path, or a mark the caller draws (a dot). */
+ glyph?: string | ReactNode;
+ dismiss?: NoticeDismiss;
+ retry?: NoticeAction;
+ /** The affirmative action, drawn last and in the accent. */
+ action?: NoticeAction;
+ /** `alert` for a failure the reader must hear at once, `status` for news that can wait. */
+ role?: "alert" | "status";
+ /** Layout only (a margin); the variant owns the box. */
+ className?: string;
+ /** The body. */
+ children: ReactNode;
+}) {
+ const strings = useUiStrings();
+ const labelledDismiss = dismiss !== undefined && dismiss.label !== undefined;
+ const hasActions = dismiss !== undefined || retry !== undefined || action !== undefined;
+ return (
+ <NoticeStrip
+ tone={tone}
+ {...(role !== undefined ? { role } : {})}
+ className={`${VARIANT[variant]} ${className}`}
+ >
+ <div className={`flex min-w-0 items-center ${ICON_GAP.menu}`}>
+ {glyph !== undefined && (
+ <span data-slot="icon" aria-hidden className="flex shrink-0">
+ {typeof glyph === "string" ? <GlyphIcon d={glyph} /> : glyph}
+ </span>
+ )}
+ <div className="min-w-0">
+ {title !== undefined && (
+ <p data-slot="title" className="font-medium">
+ {title}
+ </p>
+ )}
+ <div data-slot="body">{children}</div>
+ </div>
+ </div>
+ {hasActions && (
+ <div data-slot="actions" className="flex shrink-0 items-center gap-2">
+ {labelledDismiss && (
+ <Button
+ size="sm"
+ disabled={dismiss.disabled}
+ {...(dismiss.ariaLabel !== undefined ? { "aria-label": dismiss.ariaLabel } : {})}
+ onClick={dismiss.onClick}
+ >
+ {dismiss.label}
+ </Button>
+ )}
+ {retry !== undefined && <NoticeButton {...retry} />}
+ {action !== undefined && <NoticeButton {...action} primary />}
+ {dismiss !== undefined && !labelledDismiss && (
+ <CloseButton
+ onClose={dismiss.onClick}
+ label={dismiss.ariaLabel ?? strings.dismiss}
+ disabled={dismiss.disabled}
+ />
+ )}
+ </div>
+ )}
+ </NoticeStrip>
+ );
+}
+
+function NoticeButton({
+ label,
+ onClick,
+ ariaLabel,
+ busy = false,
+ disabled,
+ primary = false,
+}: NoticeAction & { primary?: boolean }) {
+ return (
+ <Button
+ size="sm"
+ variant={primary ? "primary" : "secondary"}
+ loading={busy}
+ disabled={disabled}
+ {...(ariaLabel !== undefined ? { "aria-label": ariaLabel } : {})}
+ onClick={onClick}
+ >
+ {label}
+ </Button>
+ );
+}
diff --git a/packages/ui/src/components/feedback/progress-bar/progress-bar.tsx b/packages/ui/src/components/feedback/progress-bar/progress-bar.tsx
new file mode 100644
index 00000000..e10635b2
--- /dev/null
+++ b/packages/ui/src/components/feedback/progress-bar/progress-bar.tsx
@@ -0,0 +1,79 @@
+/**
+ * A progress bar: how much of something is done (a download), or how much of a limit is used (a
+ * budget). A rounded track in the rule ink with a fill in the accent or in a tone, on three
+ * heights.
+ *
+ * Determinate: the fill's width is `value / max`, clamped, and it moves between readings on the
+ * theme's layout motion (`data-layout-motion`), which reduced motion stills. Indeterminate (a
+ * backend that reports a phase but no amount): a segment at the start of the track that pulses as
+ * a live signal (`ui-live`, `data-live="bar"`: each theme times it, reduced motion stills it) and
+ * no `aria-valuenow`, so assistive technology reads it as busy rather than as a third done; the
+ * words beside the bar say which phase it is in.
+ *
+ * `label` names the bar; the caller's other attributes (a tooltip) pass through to it.
+ */
+import type { HTMLAttributes } from "react";
+import type { ToneName } from "../../../tokens";
+
+export type ProgressBarSize = "xs" | "sm" | "md";
+
+const HEIGHT: Readonly<Record<ProgressBarSize, string>> = {
+ xs: "h-1",
+ sm: "h-1.5",
+ md: "h-2",
+};
+
+/** The fill: the accent by default, a tone's solid fill when the reading is a judgement. */
+const FILL: Readonly<Record<ToneName | "accent", string>> = {
+ accent: "bg-accent",
+ success: "bg-tone-success-emphasis",
+ attention: "bg-tone-attention-emphasis",
+ danger: "bg-tone-danger-emphasis",
+ done: "bg-tone-done-emphasis",
+ neutral: "bg-tone-neutral-emphasis",
+ info: "bg-tone-info-emphasis",
+};
+
+export function ProgressBar({
+ value,
+ max = 100,
+ indeterminate = false,
+ size = "sm",
+ tone = "accent",
+ label,
+ className = "",
+ ...rest
+}: {
+ /** How far along, from 0 to `max`; ignored while indeterminate. */
+ value?: number;
+ max?: number;
+ indeterminate?: boolean;
+ size?: ProgressBarSize;
+ tone?: ToneName | "accent";
+ /** The bar's accessible name. */
+ label: string;
+ /** Layout only (a width, a margin). */
+ className?: string;
+} & Omit<HTMLAttributes<HTMLDivElement>, "className" | "children" | "role">) {
+ const known = !indeterminate && value !== undefined;
+ const clamped = known ? Math.min(max, Math.max(0, value)) : 0;
+ const share = max > 0 ? (clamped / max) * 100 : 0;
+ return (
+ <div
+ {...rest}
+ role="progressbar"
+ aria-label={label}
+ aria-valuemin={0}
+ aria-valuemax={max}
+ {...(known ? { "aria-valuenow": clamped } : {})}
+ className={`w-full overflow-hidden rounded-full bg-line-muted ${HEIGHT[size]} ${className}`}
+ >
+ <div
+ {...(known ? { "data-layout-motion": "" } : {})}
+ data-live={known ? undefined : "bar"}
+ className={`h-full rounded-full ${FILL[tone]} ${known ? "" : "ui-live w-1/3 animate-pulse"}`}
+ style={known ? { width: `${share}%` } : undefined}
+ />
+ </div>
+ );
+}
diff --git a/packages/ui/src/components/feedback/todo-notice/todo-notice.tsx b/packages/ui/src/components/feedback/todo-notice/todo-notice.tsx
new file mode 100644
index 00000000..ee7f9e9b
--- /dev/null
+++ b/packages/ui/src/components/feedback/todo-notice/todo-notice.tsx
@@ -0,0 +1,82 @@
+/**
+ * The last stop on each of the dismissible update trails: one notice directly under the page
+ * title saying what is waiting, the control that acts on all of it at once, and the control that
+ * puts the dot down.
+ *
+ * It exists because those trails can end in a decision not to act — a model table kept off the
+ * catalog, an agent left on the generation it was tuned against, an error read and understood —
+ * and a dot with no way down is a dot that stops meaning anything. What the trail already said in
+ * every tooltip above is repeated here, so arriving confirms rather than re-explains.
+ *
+ * One shape on every page that has one: the same block in the same place, directly below the
+ * `<h1>`, a {@link Notice} callout in the `attention` tone — "unfinished: waiting on time, a queue
+ * or the user" is exactly what every trail is. Not `danger`, which means failed, destructive or
+ * over a limit; a copy with a newer version in the library is none of those.
+ *
+ * The update dot stays inside the block, in the fill it carried down the trail, so the notice
+ * reads as "this is that dot": the dot is the trail's identity and the tone is the notice's
+ * shape. It is decorative — the sentence beside it is the carrier, and each button folds that
+ * sentence into its own accessible name, keeping its visible label as the prefix.
+ *
+ * The bulk action is optional, and its absence is meaningful: a page that can act on everything
+ * the notice counts passes `actionLabel`, one where there is nothing to update (an error that
+ * has already happened) passes none and shows the dismiss control alone. `onAction` opens the
+ * page's confirmation rather than writing: a bulk overwrite is consented to before it runs.
+ *
+ * The top margin is built in: every page wants the same gap under its title. A page whose
+ * container spaces its children overrides it, which is the right answer there too.
+ */
+import { UPDATE_DOT_INLINE } from "../../icons/update-dot/update-dot";
+import { Notice } from "../notice/notice";
+
+export function TodoNotice({
+ text,
+ actionLabel,
+ onAction,
+ busy = false,
+ dismissLabel,
+ onDismiss,
+}: {
+ /** What is waiting — the trail's own sentence, unchanged from the dot's tooltip. */
+ text: string;
+ /** The bulk action's wording, on the pages that have one. */
+ actionLabel?: string;
+ /**
+ * Opens the page's confirmation for updating everything the notice counts. Not the write
+ * itself: a bulk overwrite is consented to before it runs, never after.
+ */
+ onAction?: () => void;
+ /** Disables both controls while the confirmed batch is in flight. */
+ busy?: boolean;
+ /** The clearing action's wording; "mark as read" where nothing is being updated. */
+ dismissLabel: string;
+ onDismiss: () => void;
+}) {
+ const offersAction = actionLabel !== undefined && onAction !== undefined;
+ return (
+ <Notice
+ tone="attention"
+ variant="callout"
+ className="mt-3"
+ glyph={<span className={`block shrink-0 ${UPDATE_DOT_INLINE}`} />}
+ dismiss={{
+ label: dismissLabel,
+ ariaLabel: `${dismissLabel} · ${text}`,
+ onClick: onDismiss,
+ disabled: busy,
+ }}
+ {...(offersAction
+ ? {
+ action: {
+ label: actionLabel,
+ ariaLabel: `${actionLabel} · ${text}`,
+ onClick: onAction,
+ disabled: busy,
+ },
+ }
+ : {})}
+ >
+ {text}
+ </Notice>
+ );
+}
diff --git a/packages/ui/src/components/layout/card/card.tsx b/packages/ui/src/components/layout/card/card.tsx
new file mode 100644
index 00000000..ede4ce06
--- /dev/null
+++ b/packages/ui/src/components/layout/card/card.tsx
@@ -0,0 +1,114 @@
+/**
+ * The card: a bordered box on the surface that holds one thing — a chart, a summary, a list of
+ * rows, a table — with an optional header row naming it.
+ *
+ * Two paddings cover the app's shells. A padded card (`sm`, the common one, or `md` for a roomy
+ * intro block) keeps its content inside the padding, and its header is a title row above the
+ * content. A flush card (`none`) lets rows and tables run edge to edge and clips them to its
+ * radius, so a row's hover fill never squares off the corners; its header is a strip ruled off
+ * from the rows below.
+ *
+ * The card carries the `ui-frame` hook, so a theme can redraw the box — Console squares it off,
+ * Frost softens the line — without a call site knowing. A flush card's header strip is the
+ * frame's `head` slot, which a theme may rule or unfill; a padded card's title row sits inside
+ * the padding, not across the frame, and is no slot. One card per region: a card never sits in
+ * another card; a table inside one is a bare `Table` (`framed={false}`).
+ */
+import { createContext, useContext } from "react";
+import type { HTMLAttributes, ReactNode } from "react";
+import { ICON_GAP } from "../../../icon-scale";
+import { InfoPopover } from "../../overlays/info-popover/info-popover";
+
+export type CardPadding = "none" | "sm" | "md";
+
+const PADDING: Record<CardPadding, string> = {
+ none: "overflow-hidden",
+ sm: "p-3",
+ md: "p-4",
+};
+
+/** The enclosing card's padding, so a header knows whether it is a title row or a ruled strip. */
+const CardPaddingContext = createContext<CardPadding>("sm");
+
+export interface CardProps extends HTMLAttributes<HTMLElement> {
+ /** The element to render: a `section` for a titled panel, an `li` for a card in a list. */
+ as?: "div" | "section" | "article" | "li";
+ /** `sm` (the default) and `md` pad the content; `none` lets rows run edge to edge. */
+ padding?: CardPadding;
+ children?: ReactNode;
+}
+
+export function Card({
+ as: Tag = "div",
+ padding = "sm",
+ className = "",
+ children,
+ ...rest
+}: CardProps) {
+ return (
+ <CardPaddingContext.Provider value={padding}>
+ <Tag
+ {...rest}
+ className={`ui-frame min-w-0 rounded-md border border-line bg-surface ${PADDING[padding]} ${className}`}
+ >
+ {children}
+ </Tag>
+ </CardPaddingContext.Provider>
+ );
+}
+
+export interface CardHeaderProps {
+ /** What the card holds, in the small muted rung. */
+ title: ReactNode;
+ /** One quiet line under the title. */
+ description?: ReactNode;
+ /** What the card means, disclosed by a "?" beside the title. */
+ info?: ReactNode;
+ /** Controls at the end of the row: a filter, a range switch, an add button. */
+ actions?: ReactNode;
+ /** The title's outline level: 3 under a page's sections (the default), 2 under the page title. */
+ level?: 2 | 3 | 4;
+ className?: string;
+}
+
+/**
+ * The card's header: the title (with its "?"), an optional line under it, and the actions at the
+ * end. In a padded card it is the row above the content; in a flush card, a strip ruled off from
+ * the rows below.
+ */
+export function CardHeader({
+ title,
+ description,
+ info,
+ actions,
+ level = 3,
+ className = "",
+}: CardHeaderProps) {
+ const flush = useContext(CardPaddingContext) === "none";
+ const Title = level === 2 ? "h2" : level === 4 ? "h4" : "h3";
+ return (
+ <div
+ data-slot={flush ? "head" : undefined}
+ className={`flex flex-wrap items-center justify-between gap-x-2 gap-y-1 ${
+ flush ? "border-b border-line-muted px-3 py-2" : "mb-2"
+ } ${className}`}
+ >
+ <div className="min-w-0">
+ <Title
+ className={`flex min-w-0 items-center ${ICON_GAP.row} text-xs font-medium text-fg-muted`}
+ >
+ {title}
+ {info !== undefined && (
+ <InfoPopover label={typeof title === "string" ? title : undefined}>{info}</InfoPopover>
+ )}
+ </Title>
+ {description !== undefined && (
+ <p className="mt-0.5 text-xs text-fg-subtle">{description}</p>
+ )}
+ </div>
+ {actions !== undefined && (
+ <div className="flex shrink-0 flex-wrap items-center gap-2">{actions}</div>
+ )}
+ </div>
+ );
+}
diff --git a/packages/ui/src/components/layout/collapsible-section/collapsible-section.tsx b/packages/ui/src/components/layout/collapsible-section/collapsible-section.tsx
new file mode 100644
index 00000000..b024692a
--- /dev/null
+++ b/packages/ui/src/components/layout/collapsible-section/collapsible-section.tsx
@@ -0,0 +1,90 @@
+/**
+ * A collapsible section: a flush card whose head strip folds its body away — a provider's model
+ * group, a memory scope, a plugin list.
+ *
+ * The head's toggle is one button over the leading mark, the title, the meta and the chevron;
+ * the section's own controls sit after it, outside the button, because a button cannot hold
+ * another. The body stays mounted while folded and is `inert` then, so its rows are neither
+ * focusable nor clickable at zero height.
+ *
+ * The fold is a layout tween, not a measured height: the body is a grid whose one row goes from
+ * `1fr` to `0fr`, and it carries `data-layout-motion`, so the theme's layout motion moves it (and
+ * nothing does under reduced motion). A component never transitions a size itself.
+ *
+ * Open or folded is the caller's when it passes `open` (a page that remembers it), the section's
+ * own otherwise, starting from `defaultOpen`.
+ */
+import { useId, useState } from "react";
+import type { ReactNode } from "react";
+import { Chevron } from "../../icons/chevron/chevron";
+import { Card } from "../card/card";
+
+export interface CollapsibleSectionProps {
+ title: ReactNode;
+ /** A mark before the title: a provider logo, a glyph, an avatar. */
+ leading?: ReactNode;
+ /** Quiet text after the title: a count, a summary of what is folded. */
+ meta?: ReactNode;
+ /** The section's own controls, after the toggle. */
+ actions?: ReactNode;
+ /** Whether the body shows, when the caller keeps it. */
+ open?: boolean;
+ /** Where an uncontrolled section starts. */
+ defaultOpen?: boolean;
+ onOpenChange?: (open: boolean) => void;
+ /** Layout on the card. */
+ className?: string;
+ children?: ReactNode;
+}
+
+export function CollapsibleSection({
+ title,
+ leading,
+ meta,
+ actions,
+ open: openProp,
+ defaultOpen = true,
+ onOpenChange,
+ className = "",
+ children,
+}: CollapsibleSectionProps) {
+ const [openState, setOpenState] = useState(defaultOpen);
+ const open = openProp ?? openState;
+ const bodyId = useId();
+ const toggle = () => {
+ if (openProp === undefined) setOpenState(!open);
+ onOpenChange?.(!open);
+ };
+ return (
+ <Card as="section" padding="none" className={className}>
+ <div
+ data-slot="head"
+ className={`flex items-center gap-2 bg-surface-muted ${actions !== undefined ? "pr-2" : ""}`}
+ >
+ <button
+ type="button"
+ aria-expanded={open}
+ aria-controls={bodyId}
+ onClick={toggle}
+ className="flex min-w-0 flex-1 items-center gap-2 px-3 py-2.5 text-left"
+ >
+ {leading !== undefined && <span className="flex shrink-0 items-center">{leading}</span>}
+ <span className="min-w-0 truncate text-sm font-semibold text-fg">{title}</span>
+ {meta !== undefined && <span className="shrink-0 text-xs text-fg-muted">{meta}</span>}
+ <span className="min-w-0 flex-1" />
+ <Chevron open={open} className="text-fg-subtle" />
+ </button>
+ {actions !== undefined && <div className="flex shrink-0 items-center gap-1">{actions}</div>}
+ </div>
+ <div
+ data-slot="body"
+ data-layout-motion
+ className={`grid ${open ? "grid-rows-[1fr]" : "grid-rows-[0fr]"}`}
+ >
+ <div id={bodyId} className="min-h-0 overflow-hidden" inert={!open}>
+ <div className="border-t border-line-muted">{children}</div>
+ </div>
+ </div>
+ </Card>
+ );
+}
diff --git a/packages/ui/src/components/layout/disclosure-row/disclosure-row.tsx b/packages/ui/src/components/layout/disclosure-row/disclosure-row.tsx
new file mode 100644
index 00000000..7584fd74
--- /dev/null
+++ b/packages/ui/src/components/layout/disclosure-row/disclosure-row.tsx
@@ -0,0 +1,178 @@
+/**
+ * The collapsible one-liner: a full-width row — status icon, label, optional trailing detail,
+ * chevron — that expands to a caller-styled body. Every disclosure row in the transcript
+ * (thinking, compaction, the background completion notice) shares it, so their width, padding,
+ * both colour states and the chevron interaction cannot drift apart. The tool cards and the work
+ * group keep their own richer rows but read the same class constants below.
+ */
+import { useRef, useState } from "react";
+import type { ReactNode } from "react";
+import { Chevron } from "../../icons/chevron/chevron";
+import type { RunState } from "../../icons/status-icon/status-icon";
+
+/**
+ * The row itself (collapsed and expanded share it; the hover fill is the "open or close me"
+ * affordance).
+ */
+export const DISCLOSURE_ROW_CLASS =
+ "flex w-full items-center gap-2 bg-surface px-3 py-1.5 text-left transition-colors duration-150 hover:bg-surface-muted";
+
+/**
+ * Stacked-sticky positioning for rows inside the work group: while a row's expanded body scrolls,
+ * the row pins right below the stuck group header (top-4 = the header's -top-4 offset plus its
+ * 2rem height). A standalone row (a single-row card) omits it.
+ */
+export const DISCLOSURE_ROW_STICKY_CLASS = "sticky top-4 z-[4]";
+
+/** The row's text label. */
+export const DISCLOSURE_LABEL_CLASS = "shrink-0 text-xs text-fg-muted";
+
+/**
+ * The header-family row — the work group's "Running / Done" summary bar: a muted ground, taller
+ * padding, a stronger hover. A standalone disclosure that should read like a settled work group
+ * (the background completion notice) uses this variant.
+ */
+export const DISCLOSURE_HEADER_ROW_CLASS =
+ "flex w-full items-center gap-2 bg-surface-muted px-3 py-2 text-left transition-colors duration-150 hover:bg-line-muted";
+
+/** Header-level sticky positioning: pins against the message list's scrollport, one z level above the nested rows. */
+export const DISCLOSURE_HEADER_STICKY_CLASS = "sticky -top-4 z-[5]";
+
+/**
+ * The header-family title, minus the state-dependent ink the caller appends. Sentence case on
+ * the small rung: a theme that sets work steps as a transcript uppercases them through the
+ * activity hook, never the component.
+ */
+export const DISCLOSURE_HEADER_TITLE_CLASS = "shrink-0 text-xs font-semibold";
+
+/**
+ * The expanded plain-text body, the tool cards' output styling (an exec_command's expanded
+ * output): a ruled, mono-sized `<pre>` block under its row.
+ */
+export const DISCLOSURE_OUTPUT_PRE_CLASS =
+ "max-h-72 overflow-auto whitespace-pre-wrap border-t border-line-muted px-3 py-2 text-xs leading-5 text-fg-muted";
+
+/**
+ * The expanded Markdown body — the thinking and compaction sections. The block the output body
+ * wears, minus the parts that only fit command output: full-bleed under its row, separated by
+ * the same divider and inset by the same padding, so it reads as another kind of output rather
+ * than as a quotation inset inside the card.
+ *
+ * It keeps prose type rather than the output block's: the output block is monospace, and the
+ * app's sans at that size reads visibly smaller beside it. `leading-relaxed` is within a hair of
+ * the prose paragraphs' own line height, so paragraphs, list items and headings land on one
+ * rhythm. `md-body-flush` drops the outermost block's margin at each end, so the body's own
+ * `py-2` is the whole gap. It is a rule in the prose stylesheet (`prose.css`), not a
+ * `[&>*:first-child]:mt-0` utility here: the `.md-body` margins it has to beat are unlayered, and
+ * an unlayered declaration wins over `@layer utilities` at any specificity.
+ *
+ * No `whitespace-pre-wrap` (these bodies are prose) and no height cap: both bodies stream, and a
+ * nested scrollbox would strand the live tail the transcript's own follow scrolls to.
+ */
+export const DISCLOSURE_BODY_MD_CLASS =
+ "md-body md-body-flush border-t border-line-muted px-3 py-2 text-sm leading-relaxed text-fg-muted";
+
+/**
+ * The card a row (or a group of rows) sits in — the work group's chrome. A standalone disclosure
+ * row wraps itself in one so its width and framing match the neighbouring groups.
+ */
+export const DISCLOSURE_CARD_CLASS =
+ "anim-msg my-2 overflow-clip rounded-md border border-line bg-surface";
+
+/**
+ * What a work step is and where it stands, for the `ui-activity` hook: the transcript's thinking
+ * and tool rows and the work group's header carry it, so a theme can render work in progress its
+ * own way (a glow while running, a transcript line with a block progress bar).
+ */
+export interface ActivityMark {
+ kind: "thinking" | "tool";
+ state: "running" | "done" | "error";
+}
+
+/**
+ * The run states the status icon shows, folded onto the three the activity hook knows. Waiting
+ * on an approval is unfinished work, so it reads as running; a stopped step is settled.
+ */
+export function activityState(state: RunState): ActivityMark["state"] {
+ if (state === "failed") return "error";
+ return state === "running" || state === "waiting" ? "running" : "done";
+}
+
+/**
+ * The activity hook's progress slot, rendered only while the step is actually executing (not
+ * while it waits on an approval), empty and `hidden`: the default theme draws no bar, and a
+ * hidden node leaves no gap in the row's flex spacing, so a theme that draws one sets its own
+ * `display`.
+ */
+export function ActivityProgress({ running }: { running: boolean }) {
+ return running ? <span data-slot="progress" aria-hidden className="hidden" /> : null;
+}
+
+export function DisclosureRow({
+ icon,
+ label,
+ trailing,
+ variant = "row",
+ sticky = false,
+ defaultOpen = false,
+ activity,
+ children,
+}: {
+ /** The leading status icon slot (a StatusIcon, matching the thinking and tool rows). */
+ icon: ReactNode;
+ /** The row's one-line label. */
+ label: string;
+ /** Optional detail between the label and the spacer (a duration, a failure tag). */
+ trailing?: ReactNode;
+ /**
+ * "row" = a line inside the work group (the thinking block's form); "header" = the work
+ * group's own summary-bar form (the background notice's standalone card).
+ */
+ variant?: "row" | "header";
+ /** Pins the row while its body scrolls: nested rows under the stuck group header, a header against the scrollport. */
+ sticky?: boolean;
+ defaultOpen?: boolean;
+ /** A work step (the thinking row): the row carries the `ui-activity` hook with this mark. */
+ activity?: ActivityMark;
+ /** The expanded body; the caller styles it (a Markdown body, an output `<pre>`, …). */
+ children: ReactNode;
+}) {
+ const [open, setOpen] = useState(defaultOpen);
+ const rootRef = useRef<HTMLDivElement>(null);
+ const header = variant === "header";
+ const rowClass = header ? DISCLOSURE_HEADER_ROW_CLASS : DISCLOSURE_ROW_CLASS;
+ const stickyClass = header ? DISCLOSURE_HEADER_STICKY_CLASS : DISCLOSURE_ROW_STICKY_CLASS;
+ const labelClass = header
+ ? `${DISCLOSURE_HEADER_TITLE_CLASS} text-fg-muted`
+ : DISCLOSURE_LABEL_CLASS;
+ return (
+ <div ref={rootRef}>
+ <button
+ type="button"
+ onClick={() => {
+ // Collapsing while the row is stuck: its real top sits above the fold, so land the
+ // view back on the row (`nearest` does not move for an expand or an in-view collapse).
+ const willClose = open;
+ setOpen((v) => !v);
+ if (willClose) {
+ requestAnimationFrame(() => rootRef.current?.scrollIntoView({ block: "nearest" }));
+ }
+ }}
+ aria-expanded={open}
+ className={`${activity ? "ui-activity " : ""}${sticky ? `${stickyClass} ` : ""}${rowClass}`}
+ data-kind={activity?.kind}
+ data-state={activity?.state}
+ >
+ {icon}
+ <span className={labelClass} {...(activity ? { "data-slot": "label" } : {})}>
+ {label}
+ </span>
+ {trailing}
+ {activity && <ActivityProgress running={activity.state === "running"} />}
+ <span className="min-w-0 flex-1" />
+ <Chevron open={open} className="text-fg-subtle" />
+ </button>
+ {open && children}
+ </div>
+ );
+}
diff --git a/packages/ui/src/components/layout/entity-header/entity-header.tsx b/packages/ui/src/components/layout/entity-header/entity-header.tsx
new file mode 100644
index 00000000..da2b7b05
--- /dev/null
+++ b/packages/ui/src/components/layout/entity-header/entity-header.tsx
@@ -0,0 +1,58 @@
+/**
+ * The head of a detail page or dialog about one thing — an agent, a plugin, a model, a
+ * Benchmark: its mark (an avatar, a logo, an icon tile), its name as the heading, the facts that
+ * sit on the name's line (a version, an id with its copy button), a description under it, and
+ * the actions that act on the whole thing at the end.
+ *
+ * The name is a heading on its level's rung. An identifier-shaped name is still a name: set it in
+ * the heading's face and put the raw id in `meta`, where it may be mono — a heading never is.
+ */
+import type { ReactNode } from "react";
+import { Heading } from "../../content/typography/typography";
+
+export interface EntityHeaderProps {
+ /** The thing's mark, before everything else. */
+ media?: ReactNode;
+ name: ReactNode;
+ /** The name's outline level and rung: 1 on a detail page (the default), 2 in a dialog. */
+ level?: 1 | 2 | 3;
+ /** Facts on the name's line, baseline-aligned after it. */
+ meta?: ReactNode;
+ /** A sentence or two under the name. */
+ description?: ReactNode;
+ /** Actions on the whole thing, at the end of the header. */
+ actions?: ReactNode;
+ /** More rows under the description: a row of badges, the hook points a plugin answers at. */
+ children?: ReactNode;
+ className?: string;
+}
+
+export function EntityHeader({
+ media,
+ name,
+ level = 1,
+ meta,
+ description,
+ actions,
+ children,
+ className = "",
+}: EntityHeaderProps) {
+ return (
+ <div className={`flex items-start gap-3 ${className}`}>
+ {media !== undefined && <div className="flex shrink-0 items-center">{media}</div>}
+ <div className="min-w-0 flex-1">
+ <div className="flex flex-wrap items-baseline gap-x-2 gap-y-1">
+ <Heading level={level} className="min-w-0 [overflow-wrap:anywhere]">
+ {name}
+ </Heading>
+ {meta !== undefined && (
+ <span className="flex min-w-0 items-center gap-1.5 text-xs text-fg-subtle">{meta}</span>
+ )}
+ </div>
+ {description !== undefined && <p className="mt-1 text-sm text-fg-muted">{description}</p>}
+ {children !== undefined && <div className="mt-2">{children}</div>}
+ </div>
+ {actions !== undefined && <div className="flex shrink-0 items-center gap-2">{actions}</div>}
+ </div>
+ );
+}
diff --git a/packages/ui/src/components/layout/page/page.tsx b/packages/ui/src/components/layout/page/page.tsx
new file mode 100644
index 00000000..23e2979c
--- /dev/null
+++ b/packages/ui/src/components/layout/page/page.tsx
@@ -0,0 +1,120 @@
+/**
+ * A page of the app: `PageFrame` is the scrolling column a page sits in, at the width it reads
+ * best at, and `PageHeader` its title row — the page's one display title with its "?", a line
+ * under it, the page's actions at the end, and an optional way back above it.
+ *
+ * The title is the page's one `h1`, carrying the display hook (`ui-display`) so a theme restyles
+ * every page title at once. It keeps the app's page-title size (`text-xl`, semibold), not the
+ * theme's h1 rung. A page header never carries an eyebrow: the title is the page's name, not a
+ * group label over it.
+ */
+import type { ReactNode } from "react";
+import { ICON_GAP, ICON_SIZE } from "../../../icon-scale";
+import { Button } from "../../actions/button/button";
+import { GlyphIcon } from "../../icons/glyph-icon/glyph-icon";
+import { ICONS } from "../../icons/icons";
+import { InfoPopover } from "../../overlays/info-popover/info-popover";
+
+/**
+ * How wide the column grows: `sm` a settings-shaped page, `md` a detail page, `lg` a list page
+ * (the default), `xl` a dashboard, `full` a board that takes the whole width.
+ */
+export type PageWidth = "sm" | "md" | "lg" | "xl" | "full";
+
+const WIDTH: Record<PageWidth, string> = {
+ sm: "mx-auto max-w-3xl",
+ md: "mx-auto max-w-4xl",
+ lg: "mx-auto max-w-5xl",
+ xl: "mx-auto max-w-6xl",
+ full: "min-w-0",
+};
+
+export interface PageFrameProps {
+ width?: PageWidth;
+ /** On the scroller: e.g. a stable scrollbar gutter for a page whose filters change its height. */
+ className?: string;
+ /** On the column inside it: e.g. a vertical rhythm between the page's blocks. */
+ contentClassName?: string;
+ children?: ReactNode;
+}
+
+/** The page's scroller: it fills the main column, scrolls on its own, and centres the column. */
+export function PageFrame({
+ width = "lg",
+ className = "",
+ contentClassName = "",
+ children,
+}: PageFrameProps) {
+ return (
+ <div className={`h-full overflow-y-auto p-4 md:p-6 ${className}`}>
+ <div className={`${WIDTH[width]} ${contentClassName}`}>{children}</div>
+ </div>
+ );
+}
+
+export interface PageHeaderProps {
+ /** The page's name. */
+ title: ReactNode;
+ /** One line under the title: what the page holds, or the entity's id. */
+ description?: ReactNode;
+ /** What the page is for, disclosed by a "?" beside the title. */
+ info?: ReactNode;
+ /** The page's own controls (search, filters, create buttons), at the end of the title row. */
+ actions?: ReactNode;
+ /** The way back to the list this page was opened from, drawn above the title. */
+ back?: { label: ReactNode; onClick: () => void };
+ /** Blocks that belong to the header, under the title row: a notice, a row of guide steps. */
+ children?: ReactNode;
+ className?: string;
+}
+
+/**
+ * The page's title row. The actions wrap under the title on a narrow screen and take the line
+ * there, so a search box among them can grow into it.
+ */
+export function PageHeader({
+ title,
+ description,
+ info,
+ actions,
+ back,
+ children,
+ className = "",
+}: PageHeaderProps) {
+ return (
+ <div className={`mb-4 min-w-0 ${className}`}>
+ {back !== undefined && (
+ <Button
+ variant="ghost"
+ size="sm"
+ leading={<GlyphIcon d={ICONS.arrowLeft} size={ICON_SIZE.rowLead} />}
+ onClick={back.onClick}
+ className="-ml-2 mb-3"
+ >
+ {back.label}
+ </Button>
+ )}
+ <div className="flex flex-wrap items-center justify-between gap-x-4 gap-y-2">
+ <div className="min-w-0">
+ <h1
+ className={`ui-display flex min-w-0 items-center ${ICON_GAP.row} text-xl font-semibold`}
+ >
+ {title}
+ {info !== undefined && (
+ <InfoPopover label={typeof title === "string" ? title : undefined}>
+ {info}
+ </InfoPopover>
+ )}
+ </h1>
+ {description !== undefined && <p className="mt-1 text-sm text-fg-muted">{description}</p>}
+ </div>
+ {actions !== undefined && (
+ <div className="flex min-w-0 max-w-full grow flex-wrap items-center justify-end gap-2 sm:grow-0">
+ {actions}
+ </div>
+ )}
+ </div>
+ {children}
+ </div>
+ );
+}
diff --git a/packages/ui/src/components/layout/ruled-section/ruled-section.tsx b/packages/ui/src/components/layout/ruled-section/ruled-section.tsx
new file mode 100644
index 00000000..41265468
--- /dev/null
+++ b/packages/ui/src/components/layout/ruled-section/ruled-section.tsx
@@ -0,0 +1,61 @@
+/**
+ * A ruled section: a titled run of content on a page, separated from the one above by a rule
+ * under its title rather than drawn as a box, so a page of sections reads as one column instead
+ * of a grid of cards.
+ *
+ * The title names the items below it, so it is a group label — the eyebrow role
+ * (`Text variant="eyebrow"`) inside the section's heading element, which keeps the outline — with
+ * an optional count, the "?" that says what the section means, and trailing controls on the
+ * other end of the rule.
+ */
+import type { ReactNode } from "react";
+import { ICON_GAP } from "../../../icon-scale";
+import { Text } from "../../content/typography/typography";
+import { Count } from "../../feedback/badge/badge";
+import { InfoPopover } from "../../overlays/info-popover/info-popover";
+
+export interface RuledSectionProps {
+ title: ReactNode;
+ /** What the section means, disclosed by a "?" beside the title. */
+ info?: ReactNode;
+ /** How many items the body holds, after the title; omit it for a section that is not a list. */
+ count?: number;
+ /** Controls at the other end of the rule. */
+ actions?: ReactNode;
+ /** The heading's outline level: 2 on a page (the default), 3 inside a dialog or a card. */
+ level?: 2 | 3;
+ /** Layout on the section: the space above it, a grid placement. */
+ className?: string;
+ children?: ReactNode;
+}
+
+export function RuledSection({
+ title,
+ info,
+ count,
+ actions,
+ level = 2,
+ className = "",
+ children,
+}: RuledSectionProps) {
+ const Title = level === 3 ? "h3" : "h2";
+ return (
+ <section className={`min-w-0 ${className}`}>
+ <div className="mb-3 flex items-center justify-between gap-2 border-b border-line pb-2">
+ <Title className={`flex min-w-0 items-center ${ICON_GAP.row}`}>
+ <Text variant="eyebrow" as="span">
+ {title}
+ </Text>
+ {count !== undefined && <Count n={count} />}
+ {info !== undefined && (
+ <InfoPopover label={typeof title === "string" ? title : undefined}>{info}</InfoPopover>
+ )}
+ </Title>
+ {actions !== undefined && (
+ <div className="flex shrink-0 items-center gap-1.5">{actions}</div>
+ )}
+ </div>
+ {children}
+ </section>
+ );
+}
diff --git a/packages/ui/src/components/navigation/group-header/group-header.tsx b/packages/ui/src/components/navigation/group-header/group-header.tsx
new file mode 100644
index 00000000..60da0571
--- /dev/null
+++ b/packages/ui/src/components/navigation/group-header/group-header.tsx
@@ -0,0 +1,238 @@
+/**
+ * The grouped list's building blocks: the group header, the collapsed lazy folder, and the
+ * "more" row that reveals or pages a list. They came out of the chat sidebar, which is why the
+ * markup reads like its rows; the sidebar, the company channel list and the organization's
+ * session list all build on them.
+ *
+ * The words a row says on its own — "More", "Show less", a header's "Expand" / "Collapse" and the
+ * loading label of a pending row — are the interface's (`UiStrings`); anything that counts or
+ * names what the row holds ("Show 7 more chats") is the caller's.
+ *
+ * The rows sit on the sidebar's muted surface, so their hover is a thin wash of the ink
+ * (`bg-fg/5`) rather than a surface step, which on that surface would not show.
+ */
+import type { DragEvent as ReactDragEvent, ReactNode } from "react";
+import { useUiStrings } from "../../../strings";
+import { Chevron } from "../../icons/chevron/chevron";
+import { ICON_SIZE } from "../../../icon-scale";
+
+/** A folder toggle's and a "more" row's shape: a dense, muted row with a chevron column. */
+const FOLDER_ROW_CLASS =
+ "flex w-full items-center gap-1 rounded px-1.5 py-1 text-left text-xs font-medium text-fg-subtle transition-colors duration-150 hover:bg-fg/5";
+
+/**
+ * A "more"-style row (a group's load-next-page, a folder's paging, the reveal-more-groups cap):
+ * the folder row's styling with the chevron column left blank. While `pending` the row disables
+ * and reads the interface's loading label.
+ */
+export function MoreRow({
+ label,
+ ariaLabel,
+ pending = false,
+ onClick,
+ className,
+}: {
+ /** What the row says; the interface's "More" when omitted. */
+ label?: string;
+ /**
+ * The accessible name, when the row's own wording is not the bare "More" — a name that
+ * contradicted the visible text would announce a different row than the one on screen.
+ * Defaults to "More", which is what the count-carrying rows announce.
+ */
+ ariaLabel?: string;
+ /** A fetch is in flight: disable and show the loading label. */
+ pending?: boolean;
+ onClick: () => void;
+ /** Extra spacing classes (the active list's row adds mt-0.5, the groups row mt-1). */
+ className?: string;
+}) {
+ const strings = useUiStrings();
+ return (
+ <button
+ type="button"
+ aria-label={ariaLabel ?? strings.more}
+ disabled={pending}
+ onClick={onClick}
+ className={`${FOLDER_ROW_CLASS}${className ? ` ${className}` : ""} disabled:opacity-60`}
+ >
+ <span className="w-3" aria-hidden />
+ {pending ? strings.loading : (label ?? strings.more)}
+ </button>
+ );
+}
+
+/**
+ * A collapsed-by-default lazy folder (subagent, scheduled, archived): the toggle row shows the
+ * label (typically with the group's exact share), the body renders only while open, and an
+ * optional "more" row reveals and pages the folder on its own. The "show less" row below it
+ * folds the folder back to its first page; the two can stand at once, since a folder revealed
+ * part-way still has rows to show and rows to fold away.
+ */
+export function FolderSection({
+ label,
+ open,
+ onToggle,
+ action,
+ more = false,
+ moreLabel,
+ pending = false,
+ onMore,
+ less = false,
+ onLess,
+ children,
+}: {
+ label: string;
+ open: boolean;
+ onToggle: () => void;
+ /**
+ * A flat action at the right end of the folder's row, outside its toggle, so a click on it
+ * never folds the folder (the company sidebar's Temporary "Close all").
+ */
+ action?: ReactNode;
+ /** Show the folder's own "more" row (its share is not fully loaded and there is more to fetch). */
+ more?: boolean;
+ /**
+ * The wording of that row, when the caller can count what is still hidden in this folder
+ * ("Show 7 more chats"). Defaults to the bare "More", the honest label where the caller has no
+ * per-folder remainder to name.
+ */
+ moreLabel?: string;
+ /** The folder's "more" fetch is in flight. */
+ pending?: boolean;
+ onMore?: () => void;
+ /** Show the folder's "show less" row (it is revealed past its first page). */
+ less?: boolean;
+ onLess?: () => void;
+ children?: ReactNode;
+}) {
+ const strings = useUiStrings();
+ const toggle = (
+ <button
+ type="button"
+ onClick={onToggle}
+ aria-expanded={open}
+ className={action === undefined ? FOLDER_ROW_CLASS : `${FOLDER_ROW_CLASS} min-w-0 flex-1`}
+ >
+ <Chevron open={open} size={ICON_SIZE.chevronDense} />
+ {label}
+ </button>
+ );
+ return (
+ <div className="mt-1">
+ {action === undefined ? (
+ toggle
+ ) : (
+ <div className="flex items-center gap-1">
+ {toggle}
+ {action}
+ </div>
+ )}
+ {open && children}
+ {open && more && (
+ <MoreRow
+ {...(moreLabel !== undefined ? { label: moreLabel, ariaLabel: moreLabel } : {})}
+ pending={pending}
+ onClick={() => onMore?.()}
+ />
+ )}
+ {open && less && (
+ <MoreRow label={strings.fewer} ariaLabel={strings.fewer} onClick={() => onLess?.()} />
+ )}
+ </div>
+ );
+}
+
+/**
+ * A group header row: the collapse toggle (leading icon, label, optional count, chevron)
+ * stretching across, with optional action buttons trailing outside it. The toggle's hover pill
+ * spans the full row height set by any h-7 actions (`self-stretch`).
+ *
+ * An uppercase label is a group label naming the rows below it, so it takes the eyebrow rung
+ * (`ui-eyebrow`) rather than spelling its own case and tracking; a label whose casing means
+ * something (a directory's basename) keeps the plain small rung.
+ *
+ * The header doubles as the drag handle when the caller makes it draggable (a manual group
+ * order). The handle is the header rather than the whole group, so the rows inside keep their
+ * own drag, and it is the element itself rather than an added grip, so the row costs no width —
+ * the list is a drawer at phone width and already carries up to three actions.
+ */
+export function GroupHeader({
+ open,
+ onToggle,
+ icon,
+ label,
+ uppercase = false,
+ muted = false,
+ count,
+ title,
+ actions,
+ draggable = false,
+ onDragStart,
+ onDragEnd,
+ onDragOver,
+ onDragLeave,
+ onDrop,
+}: {
+ open: boolean;
+ onToggle: () => void;
+ /** The leading visual (an avatar, a folder glyph), sized by the caller. */
+ icon: ReactNode;
+ label: string;
+ /** A group label rather than a name whose casing matters: set on the eyebrow rung. */
+ uppercase?: boolean;
+ /** Dim the label one step (a group with nothing active of its own); the count keeps its ink. */
+ muted?: boolean;
+ /** An optional trailing count (a workspace group's active total). */
+ count?: number;
+ /** An optional tooltip (a workspace group's full path). */
+ title?: string;
+ /** Trailing header actions (pin, new chat, settings, import). */
+ actions?: ReactNode;
+ /** The header acts as the drag handle; the caller wires the handlers below. */
+ draggable?: boolean;
+ onDragStart?: (e: ReactDragEvent) => void;
+ onDragEnd?: () => void;
+ onDragOver?: (e: ReactDragEvent) => void;
+ onDragLeave?: (e: ReactDragEvent) => void;
+ onDrop?: (e: ReactDragEvent) => void;
+}) {
+ const strings = useUiStrings();
+ const ink = muted ? "text-fg-subtle" : "text-fg-muted";
+ return (
+ <div
+ // cursor-grab while the header is a handle: groups have no sort toggle, so the cursor is
+ // the one thing on screen that says the row can be dragged at all.
+ // min-w-0: the row never asks for more than its column; the title button gives way (it
+ // truncates) and the actions after it keep their size.
+ className={`group/header flex min-w-0 items-center gap-1 px-1 pb-0.5${
+ draggable ? " cursor-grab" : ""
+ }`}
+ {...(draggable
+ ? { draggable: true, onDragStart, onDragEnd, onDragOver, onDragLeave, onDrop }
+ : {})}
+ >
+ <button
+ type="button"
+ onClick={onToggle}
+ aria-expanded={open}
+ aria-label={open ? strings.collapse : strings.expand}
+ {...(title !== undefined ? { "data-tooltip": title } : {})}
+ className="flex min-w-0 flex-1 items-center gap-1 self-stretch rounded px-1 py-0.5 text-left transition-colors duration-150 hover:bg-fg/5"
+ >
+ {icon}
+ <span
+ className={`min-w-0 truncate ${uppercase ? "ui-eyebrow" : "text-xs font-semibold"} ${ink}`}
+ >
+ {label}
+ </span>
+ {count !== undefined && (
+ <span className="shrink-0 text-xs tabular-nums text-fg-subtle">{count}</span>
+ )}
+ {/* The expand/collapse indicator sits right after the label. */}
+ <Chevron open={open} size={ICON_SIZE.chevronDense} className="text-fg-subtle" />
+ <span className="min-w-0 flex-1" />
+ </button>
+ {actions}
+ </div>
+ );
+}
diff --git a/packages/ui/src/components/navigation/group-header/pager.tsx b/packages/ui/src/components/navigation/group-header/pager.tsx
new file mode 100644
index 00000000..38bb66fb
--- /dev/null
+++ b/packages/ui/src/components/navigation/group-header/pager.tsx
@@ -0,0 +1,121 @@
+/**
+ * The page stepper of a paged list: a step back, where the reader stands, a step forward.
+ * `page` is 0-based; the readout and the accessible names count from 1.
+ *
+ * Two looks, one control:
+ *
+ * - `compact` — two flat chevron buttons around a "2/5" readout, no wider than the rows it sits
+ * under (a grouped list in a drawer at phone width). The buttons are glyphs, so their names and
+ * tooltips carry the words.
+ * - `labelled` — the readout, then two bordered text buttons (a table's footer, where the steps
+ * have names of their own: "Newer", "Older").
+ *
+ * The readout is a live region: a step is audible without counting the rows that swapped under
+ * it. The buttons disable at the ends, and while `disabled` (a page is loading), so the control
+ * never offers a step that goes nowhere.
+ */
+import { useUiStrings } from "../../../strings";
+import { GlyphIcon } from "../../icons/glyph-icon/glyph-icon";
+import { ICONS } from "../../icons/icons";
+
+export type PagerVariant = "compact" | "labelled";
+
+const COMPACT_STEP =
+ "flex h-6 w-6 shrink-0 items-center justify-center rounded text-fg-subtle transition-colors duration-150 hover:bg-fg/5 hover:text-fg disabled:pointer-events-none disabled:opacity-40";
+
+const LABELLED_STEP =
+ "rounded-md border border-line px-2 py-0.5 transition-colors duration-150 hover:bg-line-muted disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:bg-transparent";
+
+export function Pager({
+ page,
+ pageCount,
+ onChange,
+ variant = "compact",
+ previousLabel,
+ nextLabel,
+ readout,
+ readoutLabel,
+ disabled = false,
+ className = "",
+}: {
+ page: number;
+ pageCount: number;
+ onChange: (page: number) => void;
+ variant?: PagerVariant;
+ /** The step back's words: its name and tooltip (compact), or its label (labelled). */
+ previousLabel?: string;
+ /** The step forward's words. */
+ nextLabel?: string;
+ /** The position as shown; "2/5" when omitted. */
+ readout?: string;
+ /** The position as announced, when the readout is not words; the interface's "Page 2 of 5" by default. */
+ readoutLabel?: string;
+ /** Both steps off, e.g. while the next page loads. */
+ disabled?: boolean;
+ /** Layout only (a margin, an alignment). */
+ className?: string;
+}) {
+ const strings = useUiStrings();
+ const step = (delta: number) => {
+ const next = page + delta;
+ if (next >= 0 && next < pageCount) onChange(next);
+ };
+ const back = previousLabel ?? strings.previous;
+ const forward = nextLabel ?? strings.next;
+ const atStart = disabled || page <= 0;
+ const atEnd = disabled || page >= pageCount - 1;
+ const spoken =
+ readoutLabel ?? (readout === undefined ? strings.pagePosition(page + 1, pageCount) : undefined);
+ const position = (
+ <span
+ aria-live="polite"
+ {...(spoken !== undefined ? { "aria-label": spoken } : {})}
+ className={
+ variant === "compact"
+ ? "min-w-[2.5rem] text-center text-xs font-medium tabular-nums text-fg-subtle"
+ : "tabular-nums"
+ }
+ >
+ {readout ?? `${page + 1}/${pageCount}`}
+ </span>
+ );
+
+ if (variant === "labelled") {
+ return (
+ <div className={`flex items-center gap-2 text-xs text-fg-muted ${className}`}>
+ {position}
+ <button type="button" disabled={atStart} onClick={() => step(-1)} className={LABELLED_STEP}>
+ {back}
+ </button>
+ <button type="button" disabled={atEnd} onClick={() => step(1)} className={LABELLED_STEP}>
+ {forward}
+ </button>
+ </div>
+ );
+ }
+ return (
+ <div className={`flex items-center justify-center gap-1.5 px-1.5 py-0.5 ${className}`}>
+ <button
+ type="button"
+ data-tooltip={back}
+ aria-label={back}
+ disabled={atStart}
+ onClick={() => step(-1)}
+ className={COMPACT_STEP}
+ >
+ <GlyphIcon d={ICONS.chevronLeft} size={12} />
+ </button>
+ {position}
+ <button
+ type="button"
+ data-tooltip={forward}
+ aria-label={forward}
+ disabled={atEnd}
+ onClick={() => step(1)}
+ className={COMPACT_STEP}
+ >
+ <GlyphIcon d={ICONS.chevronRight} size={12} />
+ </button>
+ </div>
+ );
+}
diff --git a/packages/ui/src/components/navigation/nav-list/nav-list.tsx b/packages/ui/src/components/navigation/nav-list/nav-list.tsx
new file mode 100644
index 00000000..2aa4de96
--- /dev/null
+++ b/packages/ui/src/components/navigation/nav-list/nav-list.tsx
@@ -0,0 +1,169 @@
+/**
+ * A navigation list and its rows: the rail of a paged dialog, a settings rail, and (later) the
+ * sidebar's page links and the dock's picker. A row is a glyph, a label and an optional trailing
+ * badge; the current row takes a solid fill and `aria-current="page"`, the others a lighter fill
+ * under the pointer.
+ *
+ * `NavList` is the named `<nav>`. Vertical, its rows stack at the rail's width; responsive, it is
+ * a horizontal strip that scrolls sideways below the `sm` breakpoint and a vertical rail from it
+ * up, the way a dialog's rail folds above its pane on a phone. The list lays its rows out only:
+ * the rail's width, padding and rule are the caller's.
+ *
+ * `NavRow` is a button by default (a rail that switches panes), a link with `href`. The glyph is
+ * decoration — the label beside it already says what it says — so it carries the
+ * `ui-icon-decor` hook with the `nav` role, and a theme may recolour or drop it. A label is text,
+ * never mono. A router link takes the row's look through {@link navRowClass}.
+ */
+import { createContext, useContext } from "react";
+import type { ReactNode } from "react";
+import { ICON_GAP, ICON_SIZE } from "../../../icon-scale";
+import { GlyphIcon } from "../../icons/glyph-icon/glyph-icon";
+
+export type NavListOrientation = "vertical" | "responsive";
+
+/** `md` for a rail or a sidebar (the default); `sm` for a dense list inside a panel. */
+export type NavRowDensity = "sm" | "md";
+
+const NavOrientationContext = createContext<NavListOrientation>("vertical");
+
+export interface NavListProps {
+ /** The navigation's accessible name: what the rows switch between. */
+ label: string;
+ orientation?: NavListOrientation;
+ /** The rail's own box: its width, padding and rule. */
+ className?: string;
+ children?: ReactNode;
+}
+
+const LIST: Record<NavListOrientation, string> = {
+ vertical: "flex flex-col gap-1",
+ responsive: "flex gap-1 overflow-x-auto sm:flex-col sm:overflow-x-visible",
+};
+
+export function NavList({
+ label,
+ orientation = "vertical",
+ className = "",
+ children,
+}: NavListProps) {
+ return (
+ <NavOrientationContext.Provider value={orientation}>
+ <nav aria-label={label} className={`${LIST[orientation]} ${className}`}>
+ {children}
+ </nav>
+ </NavOrientationContext.Provider>
+ );
+}
+
+const DENSITY: Record<NavRowDensity, string> = {
+ md: `${ICON_GAP.menu} px-2.5 py-1.5 text-sm`,
+ sm: `${ICON_GAP.row} px-2 py-1 text-xs`,
+};
+
+const GLYPH_SIZE: Record<NavRowDensity, number> = {
+ md: ICON_SIZE.navRow,
+ sm: ICON_SIZE.inlineGlyph,
+};
+
+/**
+ * A row's classes, for an element the row cannot render itself (a router's link). The width
+ * follows the list: full in a vertical rail, the label's own in a horizontal strip, which keeps
+ * every row whole rather than squeezing their labels.
+ */
+export function navRowClass({
+ active = false,
+ disabled = false,
+ density = "md",
+ orientation = "vertical",
+}: {
+ active?: boolean;
+ disabled?: boolean;
+ density?: NavRowDensity;
+ orientation?: NavListOrientation;
+} = {}): string {
+ const width = orientation === "responsive" ? "shrink-0 sm:w-full" : "w-full";
+ const state = disabled
+ ? "cursor-not-allowed text-fg-subtle"
+ : active
+ ? "bg-line-muted font-medium text-fg"
+ : "text-fg-muted hover:bg-surface-muted hover:text-fg";
+ return `flex ${width} items-center whitespace-nowrap rounded-md text-left transition-colors duration-150 ${DENSITY[density]} ${state}`;
+}
+
+export interface NavRowProps {
+ label: ReactNode;
+ /** A 24×24 line path drawn on the row's glyph rung, or a mark the caller sizes. Decorative. */
+ glyph?: string | ReactNode;
+ /** Trailing: a count, a badge, an update dot. */
+ badge?: ReactNode;
+ /** The current page: the solid fill and `aria-current="page"`. */
+ active?: boolean;
+ /** Nowhere to go right now: muted, no hover fill, not focusable as a link. */
+ disabled?: boolean;
+ density?: NavRowDensity;
+ /** Renders a link to this address instead of a button. */
+ href?: string;
+ onClick?: () => void;
+ /** The accessible name, when the badge adds to what the label says. */
+ ariaLabel?: string;
+ /** A hint on hover and focus. */
+ tooltip?: string;
+ className?: string;
+}
+
+export function NavRow({
+ label,
+ glyph,
+ badge,
+ active = false,
+ disabled = false,
+ density = "md",
+ href,
+ onClick,
+ ariaLabel,
+ tooltip,
+ className = "",
+}: NavRowProps) {
+ const orientation = useContext(NavOrientationContext);
+ const classes = `${navRowClass({ active, disabled, density, orientation })} ${className}`;
+ const current = active && !disabled ? ("page" as const) : undefined;
+ const named = {
+ ...(ariaLabel !== undefined ? { "aria-label": ariaLabel } : {}),
+ ...(tooltip !== undefined ? { "data-tooltip": tooltip } : {}),
+ };
+ const content = (
+ <>
+ {glyph !== undefined && (
+ <span aria-hidden className="ui-icon-decor shrink-0 text-fg-subtle" data-role="nav">
+ {typeof glyph === "string" ? <GlyphIcon d={glyph} size={GLYPH_SIZE[density]} /> : glyph}
+ </span>
+ )}
+ <span className="min-w-0 truncate">{label}</span>
+ {badge !== undefined && <span className="ml-auto flex shrink-0 items-center">{badge}</span>}
+ </>
+ );
+ if (href !== undefined) {
+ // A link with nowhere to go keeps its place in the list but leaves the tab order.
+ return disabled ? (
+ <span role="link" aria-disabled="true" {...named} className={classes}>
+ {content}
+ </span>
+ ) : (
+ <a href={href} aria-current={current} onClick={onClick} {...named} className={classes}>
+ {content}
+ </a>
+ );
+ }
+ return (
+ <button
+ type="button"
+ aria-current={current}
+ disabled={disabled}
+ onClick={onClick}
+ {...named}
+ className={classes}
+ >
+ {content}
+ </button>
+ );
+}
diff --git a/packages/web/src/components/ui/tabs.tsx b/packages/ui/src/components/navigation/tabs/tabs.tsx
similarity index 54%
rename from packages/web/src/components/ui/tabs.tsx
rename to packages/ui/src/components/navigation/tabs/tabs.tsx
index 8673247a..e64a579b 100644
--- a/packages/web/src/components/ui/tabs.tsx
+++ b/packages/ui/src/components/navigation/tabs/tabs.tsx
@@ -1,16 +1,21 @@
/**
- * Tab switcher component (controlled): GitHub-style underline; scrolls
- * horizontally on narrow screens.
+ * The tab switcher (controlled): an underline tab bar that scrolls sideways on a narrow screen.
+ *
+ * The selected tab's marker is the theme's to draw: the bar carries the `ui-underline-nav` hook,
+ * and the recipes select the tabs by `role="tab"` and `aria-selected`; in Primer the marker is the
+ * tab's own bottom border.
+ *
+ * A tab may carry an update badge: a sentence saying what is updatable behind it. The dot itself
+ * says nothing; the sentence is folded into the tab's tooltip and accessible name.
*/
-import { UpdateDot } from "@prismshadow/penguin-ui";
+import { UpdateDot } from "../../icons/update-dot/update-dot";
export interface TabItem<K extends string = string> {
key: K;
label: string;
/**
* Something updatable behind this tab: raises an update badge and folds this sentence into
- * the tab's tooltip and accessible name (the dot itself carries nothing). Null / omitted =
- * no badge.
+ * the tab's tooltip and accessible name. Null or omitted: no badge.
*/
badge?: string | null;
}
@@ -27,31 +32,31 @@ export function Tabs<K extends string>({
return (
<div
role="tablist"
- // overflow-y-hidden: only allow horizontal scroll on narrow screens, otherwise some browsers reserve a vertical scrollbar gutter for overflow-x-auto.
- // ui-underline-nav: the selected-tab marker is the theme's to draw (the recipes select the
- // tabs by role and aria-selected); in the default theme it is the border below.
- className="ui-underline-nav flex max-w-full gap-1 overflow-x-auto overflow-y-hidden border-b border-gray-200 dark:border-gray-800"
+ // overflow-y-hidden: only the horizontal axis scrolls; with overflow-x-auto alone some
+ // browsers reserve a vertical scrollbar gutter.
+ className="ui-underline-nav flex max-w-full gap-1 overflow-x-auto overflow-y-hidden border-b border-line"
>
{items.map((item) => {
const badge = item.badge ?? null;
+ const selected = item.key === active;
return (
<button
key={item.key}
type="button"
role="tab"
- aria-selected={item.key === active}
+ aria-selected={selected}
{...(badge !== null
? { "data-tooltip": badge, "aria-label": `${item.label} · ${badge}` }
: {})}
onClick={() => onChange(item.key)}
className={`relative -mb-px whitespace-nowrap border-b-2 px-3 py-2 text-sm transition-colors duration-150 ${
- item.key === active
- ? "border-gray-900 font-semibold text-gray-900 dark:border-gray-100 dark:text-gray-100"
- : "border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-800 dark:text-gray-400 dark:hover:border-gray-700 dark:hover:text-gray-200"
+ selected
+ ? "border-fg font-semibold text-fg"
+ : "border-transparent text-fg-muted hover:border-line-emphasis hover:text-fg"
}`}
>
{item.label}
- {/* Inside the button's own padding, not hanging off its corner: the strip clips
+ {/* Inside the button's own padding, not hanging off its corner: the bar clips
vertically (overflow-y-hidden above), so an overhanging dot would be cut. */}
{badge !== null && <UpdateDot size="inline" position="right-1 top-1" />}
</button>
diff --git a/packages/ui/src/components/overlays/paged-dialog/paged-dialog.tsx b/packages/ui/src/components/overlays/paged-dialog/paged-dialog.tsx
index d46e5755..f2cfc98c 100644
--- a/packages/ui/src/components/overlays/paged-dialog/paged-dialog.tsx
+++ b/packages/ui/src/components/overlays/paged-dialog/paged-dialog.tsx
@@ -2,8 +2,8 @@
* PagedDialog: a large modal whose left rail switches sub-pages — the shared shell for multi-page
* settings surfaces (Settings today; Project settings converges on the same shell). Purely
* presentational: the caller owns which pages exist, which one is active, and what the pane
- * renders; the shell draws the rail (grouped, icon + label, solid-fill active row — the sidebar's
- * convention), the pane heading, and the close control.
+ * renders; the shell draws the rail (a `NavList` of `NavRow`s, grouped, icon + label, solid-fill
+ * active row — the sidebar's convention), the pane heading, and the close control.
*
* Built on Modal, so it inherits the portal, the Escape layer stack (nested dialogs and menus
* close in visual order) and the bottom-sheet posture on narrow screens — where the rail folds
@@ -13,6 +13,7 @@
import type { ReactNode } from "react";
import { CloseButton } from "../../actions/close-button/close-button";
import { ICON_GAP } from "../../../icon-scale";
+import { NavList, NavRow } from "../../navigation/nav-list/nav-list";
import { InfoPopover } from "../info-popover/info-popover";
import { Modal } from "../modal/modal";
@@ -37,14 +38,6 @@ export interface PagedDialogGroup<K extends string> {
items: ReadonlyArray<PagedDialogItem<K>>;
}
-/** Rail entry: a solid fill when active, a lighter fill on hover otherwise (the sidebar's convention). */
-const railItemClass = (active: boolean) =>
- `flex w-full items-center gap-2 whitespace-nowrap rounded-md px-2.5 py-1.5 text-sm transition-colors duration-150 ${
- active
- ? "bg-line-muted font-medium text-fg"
- : "text-fg-muted hover:bg-surface-muted hover:text-fg"
- }`;
-
export function PagedDialog<K extends string>({
open,
onClose,
@@ -75,9 +68,10 @@ export function PagedDialog<K extends string>({
<Modal open={open} onClose={onClose} title={title} headerless bare widthClass="sm:max-w-3xl">
<div className="flex h-[min(40rem,85vh)] flex-col sm:flex-row">
{/* Rail: vertical on desktop, a horizontal scroller above the pane on narrow screens. */}
- <nav
- aria-label={title}
- className="flex shrink-0 gap-1 overflow-x-auto border-b border-line-muted p-2 sm:w-44 sm:flex-col sm:overflow-x-visible sm:overflow-y-auto sm:border-b-0 sm:border-r sm:p-3"
+ <NavList
+ label={title}
+ orientation="responsive"
+ className="shrink-0 border-b border-line-muted p-2 sm:w-44 sm:overflow-y-auto sm:border-b-0 sm:border-r sm:p-3"
>
{groups.map((group) => (
<div key={group.key} className="contents sm:mt-3 sm:block sm:first:mt-0">
@@ -89,28 +83,17 @@ export function PagedDialog<K extends string>({
</p>
)}
{group.items.map((item) => (
- <button
+ <NavRow
key={item.key}
- type="button"
- className={railItemClass(item.key === active)}
- aria-current={item.key === active ? "page" : undefined}
+ label={item.label}
+ glyph={item.icon}
+ active={item.key === active}
onClick={() => onSelect(item.key)}
- >
- {item.icon !== undefined && (
- <span
- aria-hidden
- className="ui-icon-decor shrink-0 text-fg-subtle"
- data-role="nav"
- >
- {item.icon}
- </span>
- )}
- <span className="min-w-0 truncate">{item.label}</span>
- </button>
+ />
))}
</div>
))}
- </nav>
+ </NavList>
<div className="flex min-w-0 flex-1 flex-col">
<div className="flex shrink-0 items-center justify-between gap-2 px-4 pt-4 sm:px-6 sm:pt-5">
diff --git a/packages/ui/src/hooks.ts b/packages/ui/src/hooks.ts
index 80d4149a..9f61e2fa 100644
--- a/packages/ui/src/hooks.ts
+++ b/packages/ui/src/hooks.ts
@@ -20,12 +20,16 @@
* | | above an `h1`–`h4`); hosts: `Text variant="eyebrow"`, | |
* | | the sidebar's and group headers' labels | |
* | `ui-display` | the one display title of a page or hero | only on an `h1` or `[aria-level="1"]` |
- * | `ui-live` | motion for something that is running right now | `data-live="dot" \| "caret" \| "spinner"` |
+ * | | hosts: `Heading level={1} display`, `PageHeader`'s title | |
+ * | `ui-live` | motion for something that is running right now | `data-live="dot" \| "caret" \| "spinner" \| "bar"` |
* | | hosts: the Spinner, a pulsing Dot | |
* | `ui-frame` | a ruled box with a head, a body, a foot and panes | children carry `data-slot="head" \| "body" \| "foot" \| "pane"` |
+ * | | hosts: the transcript's cards, the code block, `Card`, | |
+ * | | a framed `Table` | |
* | `ui-underline-nav` | the selected-tab marker of a tab bar | items `[role="tab"]`, selected by `aria-selected="true"` |
* | `ui-shell` | the app window: a navigation column beside a main column | children carry `data-slot="nav" \| "main"` (a right column may carry `"dock"`); the selected nav row is `[aria-current="page"]` |
* | `ui-icon-decor` | an icon that says nothing its label does not already say | on the icon itself (or the element holding only it); optional `data-role="nav" \| "group" \| "menu" \| "empty"` |
+ * | | hosts: the icon renderers' call sites, `NavRow`'s glyph | |
* | `ui-tree` | a container whose rows nest | rows carry `data-depth="0"…"8"`, the last row of a level `data-last="true"`; a row's children may follow it in a `data-branch` element carrying the children's `data-depth` |
* | `ui-field` | a labelled control row | children carry `data-slot="label" \| "control"` and optionally `"hint"` |
* | `ui-activity` | a step of the agent's work in the transcript: a thinking | `data-kind="thinking" \| "tool"`, `data-state="running" \| "done" \| "error"`; descendants may carry `data-slot="label" \| "detail" \| "progress"` (the progress slot exists only while running, hidden by the host — a recipe that draws it sets `display` itself) |
diff --git a/packages/ui/src/index.ts b/packages/ui/src/index.ts
index 727fb72f..f4008f0f 100644
--- a/packages/ui/src/index.ts
+++ b/packages/ui/src/index.ts
@@ -107,3 +107,35 @@ export * from "./components/content/code-block/code-block";
export * from "./components/content/code-block/code-languages";
export * from "./components/content/typography/typography";
export * from "./components/content/diff-viewer/diff-viewer";
+
+// W4-A — navigation, notices and readings: the tab bar, the grouped list's header, folder, more
+// row and pager, the create pair, the notice with its variants and the page to-do built on it,
+// the progress bar, the duration slot and its live clock, the beta tag, the disclosure row, and
+// the stat tile and chip.
+export * from "./components/navigation/tabs/tabs";
+export * from "./components/navigation/group-header/group-header";
+export * from "./components/navigation/group-header/pager";
+export * from "./components/actions/create-buttons/create-buttons";
+export * from "./components/feedback/notice/notice";
+export * from "./components/feedback/todo-notice/todo-notice";
+export * from "./components/feedback/progress-bar/progress-bar";
+export * from "./components/feedback/duration-slot/duration-slot";
+export * from "./components/feedback/beta-badge/beta-badge";
+export * from "./components/layout/disclosure-row/disclosure-row";
+export * from "./components/data/stat-tile/stat-tile";
+export * from "./components/data/stat-chip/stat-chip";
+
+// W4-B — layout and data: the card, the page frame and header, the ruled and the collapsible
+// section, the entity header, list rows, label/value pairs, the log well and the table family.
+export * from "./components/layout/card/card";
+export * from "./components/layout/page/page";
+export * from "./components/layout/ruled-section/ruled-section";
+export * from "./components/layout/collapsible-section/collapsible-section";
+export * from "./components/layout/entity-header/entity-header";
+export * from "./components/data/list-row/list-row";
+export * from "./components/data/key-value/key-value";
+export * from "./components/data/log-view/log-view";
+export * from "./components/data/table/table";
+
+// W4-C — navigation: the nav list and its rows, the rail of a paged dialog or a settings page.
+export * from "./components/navigation/nav-list/nav-list";
diff --git a/packages/ui/src/strings.ts b/packages/ui/src/strings.ts
index 3a969cf1..5c041082 100644
--- a/packages/ui/src/strings.ts
+++ b/packages/ui/src/strings.ts
@@ -39,6 +39,20 @@ export interface UiStrings {
dismiss: string;
/** The name and tooltip of a code block's copy button (`CodeBlock`). */
copyCode: string;
+ /** A collapsed group header's name: pressing it expands the group (`GroupHeader`). */
+ expand: string;
+ /** An expanded group header's name: pressing it collapses the group (`GroupHeader`). */
+ collapse: string;
+ /** A "more" row's text and name when its caller counts nothing (`MoreRow`, `FolderSection`). */
+ more: string;
+ /** The row that folds a revealed list back to its first page (`FolderSection`). */
+ fewer: string;
+ /** A pager's step back, as its name and tooltip (`Pager`). */
+ previous: string;
+ /** A pager's step forward, as its name and tooltip (`Pager`). */
+ next: string;
+ /** What a pager's "2/5" readout says aloud: the page, then how many there are (`Pager`). */
+ pagePosition: (page: number, pageCount: number) => string;
}
/** The English fallbacks, used wherever no provider is mounted (a test, a stand-alone page). */
@@ -54,6 +68,13 @@ export const DEFAULT_UI_STRINGS: UiStrings = {
notifications: "Notifications",
dismiss: "Dismiss",
copyCode: "Copy code",
+ expand: "Expand",
+ collapse: "Collapse",
+ more: "More",
+ fewer: "Show less",
+ previous: "Previous page",
+ next: "Next page",
+ pagePosition: (page, pageCount) => `Page ${page} of ${pageCount}`,
};
const UiStringsContext = createContext<UiStrings>(DEFAULT_UI_STRINGS);
diff --git a/packages/ui/test/beta-badge.test.ts b/packages/ui/test/beta-badge.test.ts
new file mode 100644
index 00000000..f4ae82e3
--- /dev/null
+++ b/packages/ui/test/beta-badge.test.ts
@@ -0,0 +1,19 @@
+/**
+ * BetaBadge (src/components/feedback/beta-badge/beta-badge.tsx): the caller's words on the
+ * smallest text rung, in the muted ink rather than a tone. How the work-mode switch hangs it is
+ * the web app's `company-beta` test.
+ */
+import { createElement } from "react";
+import { describe, expect, it } from "vitest";
+import { BetaBadge } from "../src/components/feedback/beta-badge/beta-badge";
+import { classTokens, renderStatic } from "../src/testing";
+
+describe("BetaBadge", () => {
+ it("says the caller's label, with the tooltip when there is one", () => {
+ const html = renderStatic(createElement(BetaBadge, { label: "Beta", title: "In beta" }));
+ expect(html).toContain('data-tooltip="In beta"');
+ expect(html).toContain(">Beta</span>");
+ expect(classTokens(html)).toEqual(expect.arrayContaining(["text-xs", "text-fg-muted"]));
+ expect(renderStatic(createElement(BetaBadge, { label: "Beta" }))).not.toContain("data-tooltip");
+ });
+});
diff --git a/packages/ui/test/card.test.ts b/packages/ui/test/card.test.ts
new file mode 100644
index 00000000..657ec880
--- /dev/null
+++ b/packages/ui/test/card.test.ts
@@ -0,0 +1,54 @@
+/**
+ * Card and CardHeader: the box is the `ui-frame` host on token colours, and the header takes its
+ * shape from the card's padding — a title row inside a padded card, the frame's ruled `head` slot
+ * across a flush one.
+ */
+import { createElement } from "react";
+import { describe, expect, it } from "vitest";
+import { Card, CardHeader } from "../src/components/layout/card/card";
+import { classTokens, renderStatic } from "../src/testing";
+
+const header = createElement(CardHeader, {
+ title: "Spend",
+ info: "What the organization spent this month.",
+ actions: createElement("button", { type: "button" }, "Export"),
+});
+
+describe("Card", () => {
+ it("is a frame on the surface, padded by default", () => {
+ const html = renderStatic(createElement(Card, null, "body"));
+ expect(html).toMatch(/^<div class="ui-frame /);
+ expect(classTokens(html)).toEqual(
+ expect.arrayContaining(["border", "border-line", "bg-surface", "rounded-md", "p-3"]),
+ );
+ expect(html).not.toMatch(/gray-|dark:/);
+ });
+
+ it("takes each padding, clipping its rows when flush", () => {
+ expect(classTokens(renderStatic(createElement(Card, { padding: "md" })))).toContain("p-4");
+ const flush = classTokens(renderStatic(createElement(Card, { padding: "none" })));
+ expect(flush).toContain("overflow-hidden");
+ expect(flush.filter((t) => /^p-/.test(t))).toEqual([]);
+ expect(renderStatic(createElement(Card, { as: "section" }))).toMatch(/^<section /);
+ });
+});
+
+describe("CardHeader", () => {
+ it("titles the card with a heading and its trigger, then the actions", () => {
+ const html = renderStatic(createElement(Card, null, header));
+ expect(html).toMatch(/<h3 class="[^"]*text-fg-muted[^"]*">Spend<button/);
+ expect(html).toContain('aria-label="More info: Spend"');
+ expect(html.indexOf("Spend")).toBeLessThan(html.indexOf("Export"));
+ expect(
+ renderStatic(createElement(Card, null, createElement(CardHeader, { title: "T", level: 2 }))),
+ ).toContain("<h2");
+ });
+
+ it("is a title row in a padded card, and the frame's head slot across a flush one", () => {
+ const padded = renderStatic(createElement(Card, null, header));
+ expect(padded).toMatch(/<div class="[^"]*\bmb-2\b/);
+ expect(padded).not.toContain("data-slot");
+ const flush = renderStatic(createElement(Card, { padding: "none" }, header));
+ expect(flush).toMatch(/data-slot="head" class="[^"]*\bborder-b border-line-muted px-3 py-2\b/);
+ });
+});
diff --git a/packages/ui/test/collapsible-section.test.ts b/packages/ui/test/collapsible-section.test.ts
new file mode 100644
index 00000000..cc514fc7
--- /dev/null
+++ b/packages/ui/test/collapsible-section.test.ts
@@ -0,0 +1,52 @@
+/**
+ * CollapsibleSection: the head is one toggle button naming the body it controls, the section's
+ * actions stay outside it, and the fold is the grid-row tween the theme moves through
+ * `data-layout-motion` — the component spells no transition of a size itself.
+ */
+import { createElement } from "react";
+import { describe, expect, it } from "vitest";
+import { CollapsibleSection } from "../src/components/layout/collapsible-section/collapsible-section";
+import type { CollapsibleSectionProps } from "../src/components/layout/collapsible-section/collapsible-section";
+import { classTokens, renderStatic } from "../src/testing";
+
+const render = (props: Partial<CollapsibleSectionProps>) =>
+ renderStatic(
+ createElement(
+ CollapsibleSection,
+ { title: "OpenAI", ...props },
+ createElement("p", null, "rows"),
+ ),
+ );
+
+describe("CollapsibleSection", () => {
+ it("is a flush card: a head slot with the toggle, a body slot with the rows", () => {
+ const html = render({ actions: createElement("button", { type: "button" }, "Add") });
+ expect(html).toMatch(/^<section class="ui-frame /);
+ expect(html).toContain('data-slot="head"');
+ expect(html).toContain('data-slot="body"');
+ const toggle = /<button type="button" aria-expanded="true" aria-controls="([^"]+)"/.exec(html);
+ expect(toggle).not.toBeNull();
+ expect(html).toContain(`id="${toggle![1]}"`);
+ // The action is a sibling of the toggle, never inside it.
+ expect(html).toMatch(/<\/button><div class="[^"]*"><button type="button">Add<\/button>/);
+ });
+
+ it("folds through the layout-motion grid, and is inert while folded", () => {
+ const open = render({});
+ expect(open).toMatch(
+ /data-slot="body" data-layout-motion="true" class="grid grid-rows-\[1fr\]"/,
+ );
+ expect(open).not.toContain("inert");
+ const folded = render({ defaultOpen: false });
+ expect(folded).toContain('aria-expanded="false"');
+ expect(folded).toMatch(/class="grid grid-rows-\[0fr\]"/);
+ expect(folded).toMatch(/<div id="[^"]+" class="min-h-0 overflow-hidden" inert="">/);
+ for (const html of [open, folded]) {
+ expect(classTokens(html).filter((t) => /^transition-\[/.test(t))).toEqual([]);
+ }
+ });
+
+ it("follows the caller's open over its own default", () => {
+ expect(render({ open: false, defaultOpen: true })).toContain('aria-expanded="false"');
+ });
+});
diff --git a/packages/ui/test/create-buttons.test.ts b/packages/ui/test/create-buttons.test.ts
new file mode 100644
index 00000000..c4efcbe0
--- /dev/null
+++ b/packages/ui/test/create-buttons.test.ts
@@ -0,0 +1,34 @@
+/**
+ * CreateButtons (src/components/actions/create-buttons/create-buttons.tsx): the AI path in the
+ * accent and the manual path beside it, both in the caller's words; the manual one only where the
+ * surface offers it, and greyed alone when its form cannot open.
+ */
+import { createElement } from "react";
+import { describe, expect, it } from "vitest";
+import { CreateButtons } from "../src/components/actions/create-buttons/create-buttons";
+import { renderStatic } from "../src/testing";
+
+const noop = () => {};
+
+describe("CreateButtons", () => {
+ it("draws both paths in the caller's words, the AI one first", () => {
+ const html = renderStatic(
+ createElement(CreateButtons, {
+ onAi: noop,
+ aiLabel: "Create with AI",
+ onManual: noop,
+ manualLabel: "Create manually",
+ manualDisabled: true,
+ }),
+ );
+ expect(html.indexOf("Create with AI")).toBeLessThan(html.indexOf("Create manually"));
+ expect(html.match(/disabled=""/g)).toHaveLength(1);
+ });
+
+ it("offers the AI path alone where the manual one is absent", () => {
+ const html = renderStatic(
+ createElement(CreateButtons, { onAi: noop, aiLabel: "Import with AI" }),
+ );
+ expect(html.match(/<button/g)).toHaveLength(1);
+ });
+});
diff --git a/packages/ui/test/disclosure-row.test.ts b/packages/ui/test/disclosure-row.test.ts
new file mode 100644
index 00000000..1d99d81c
--- /dev/null
+++ b/packages/ui/test/disclosure-row.test.ts
@@ -0,0 +1,44 @@
+/**
+ * DisclosureRow (src/components/layout/disclosure-row/disclosure-row.tsx): a collapsed row that
+ * says so, and that carries the activity hook — kind, state and label slot — only for a work step.
+ * The expanded bodies' classes are the web app's `disclosure-body` test.
+ */
+import { createElement } from "react";
+import { describe, expect, it } from "vitest";
+import {
+ DisclosureRow,
+ activityState,
+} from "../src/components/layout/disclosure-row/disclosure-row";
+import { renderStatic } from "../src/testing";
+
+const row = (activity?: { kind: "thinking"; state: "running" }) =>
+ renderStatic(
+ createElement(DisclosureRow, {
+ icon: null,
+ label: "Thinking",
+ ...(activity ? { activity } : {}),
+ children: "body",
+ }),
+ );
+
+describe("DisclosureRow", () => {
+ it("starts collapsed, with its body unmounted", () => {
+ const html = row();
+ expect(html).toContain('aria-expanded="false"');
+ expect(html).not.toContain("body");
+ expect(html).not.toContain("ui-activity");
+ });
+
+ it("carries the activity hook for a work step, with its label slot and progress slot", () => {
+ const html = row({ kind: "thinking", state: "running" });
+ expect(html).toMatch(/class="ui-activity [^"]*" data-kind="thinking" data-state="running"/);
+ expect(html).toContain('data-slot="label"');
+ expect(html).toContain('data-slot="progress"');
+ });
+
+ it("folds the run states onto the hook's three", () => {
+ expect(activityState("waiting")).toBe("running");
+ expect(activityState("failed")).toBe("error");
+ expect(activityState("stopped")).toBe("done");
+ });
+});
diff --git a/packages/ui/test/duration-slot.test.ts b/packages/ui/test/duration-slot.test.ts
new file mode 100644
index 00000000..b1e10175
--- /dev/null
+++ b/packages/ui/test/duration-slot.test.ts
@@ -0,0 +1,49 @@
+/**
+ * The duration slot (src/components/feedback/duration-slot/): the two duration forms the app and
+ * the CLI print, and the slot that shows the live clock while running and the settled duration
+ * after.
+ */
+import { createElement } from "react";
+import { describe, expect, it } from "vitest";
+import {
+ DurationSlot,
+ LiveDuration,
+ formatDuration,
+ formatDurationLive,
+} from "../src/components/feedback/duration-slot/duration-slot";
+import { classTokens, renderStatic } from "../src/testing";
+
+describe("formatDuration", () => {
+ it("keeps a tenth below a minute, and whole seconds past it", () => {
+ expect(formatDuration(820)).toBe("820ms");
+ expect(formatDuration(2300)).toBe("2.3s");
+ expect(formatDuration(63_000)).toBe("1m3s");
+ expect(formatDuration(119_700)).toBe("2m0s");
+ expect(formatDuration(12_700, { compact: true })).toBe("13s");
+ expect(formatDuration(1700, { compact: true })).toBe("1.7s");
+ });
+});
+
+describe("formatDurationLive", () => {
+ it("counts whole seconds up, never early, and reads a negative span as zero", () => {
+ expect(formatDurationLive(7999)).toBe("7s");
+ expect(formatDurationLive(63_000)).toBe("1m3s");
+ expect(formatDurationLive(-500)).toBe("0s");
+ });
+});
+
+describe("DurationSlot", () => {
+ it("shows the settled duration in tabular figures, and nothing before one is known", () => {
+ const html = renderStatic(createElement(DurationSlot, { running: false, durationMs: 2300 }));
+ expect(html).toContain(">2.3s</span>");
+ expect(classTokens(html)).toEqual(expect.arrayContaining(["font-mono", "tabular-nums"]));
+ expect(renderStatic(createElement(DurationSlot, { running: false }))).toBe("");
+ });
+
+ it("holds a still ellipsis while running with no start known", () => {
+ expect(renderStatic(createElement(LiveDuration, {}))).toBe("…");
+ const html = renderStatic(createElement(DurationSlot, { running: true }));
+ expect(html).toContain(">…</span>");
+ expect(html).not.toContain("animate-");
+ });
+});
diff --git a/packages/ui/test/entity-header.test.ts b/packages/ui/test/entity-header.test.ts
new file mode 100644
index 00000000..ac458f5c
--- /dev/null
+++ b/packages/ui/test/entity-header.test.ts
@@ -0,0 +1,45 @@
+/**
+ * EntityHeader: the name is a heading on its level's rung (never the data face), with the mark
+ * before it, the facts on its line, the description under it and the actions at the end.
+ */
+import { createElement } from "react";
+import { describe, expect, it } from "vitest";
+import { EntityHeader } from "../src/components/layout/entity-header/entity-header";
+import { classTokens, renderStatic } from "../src/testing";
+
+describe("EntityHeader", () => {
+ const html = renderStatic(
+ createElement(
+ EntityHeader,
+ {
+ media: createElement("img", { alt: "", src: "/logo.svg" }),
+ name: "@penguinharness/goal",
+ meta: "v0.2.9",
+ description: "Keeps the agent on its goal.",
+ actions: createElement("button", { type: "button" }, "Install"),
+ },
+ createElement("span", null, "stop"),
+ ),
+ );
+
+ it("names the thing with a level-1 heading on its rung, not in mono", () => {
+ expect(html).toMatch(/<h1 class="[^"]*--ui-h1-size[^"]*">@penguinharness\/goal<\/h1>/);
+ expect(html).not.toContain("ui-display");
+ expect(/<h1 class="([^"]*)"/.exec(html)![1]).not.toContain("font-mono");
+ });
+
+ it("lays out mark, name and meta, description, extra rows, then actions", () => {
+ const order = ["<img", "<h1", "v0.2.9", "Keeps the agent", "stop", "Install"].map((part) =>
+ html.indexOf(part),
+ );
+ expect(order.every((i) => i >= 0)).toBe(true);
+ expect(order).toEqual([...order].sort((a, b) => a - b));
+ expect(classTokens(html)).toEqual(expect.arrayContaining(["text-fg-muted", "text-fg-subtle"]));
+ });
+
+ it("takes a lower level inside a dialog", () => {
+ expect(renderStatic(createElement(EntityHeader, { name: "Reviewer", level: 2 }))).toMatch(
+ /<h2 class="[^"]*--ui-h2-size/,
+ );
+ });
+});
diff --git a/packages/ui/test/group-header.test.ts b/packages/ui/test/group-header.test.ts
new file mode 100644
index 00000000..5372be2e
--- /dev/null
+++ b/packages/ui/test/group-header.test.ts
@@ -0,0 +1,115 @@
+/**
+ * The grouped list's rows (src/components/navigation/group-header/): the header's toggle, the
+ * lazy folder with its "more" and "show less" rows, and the pager. The words a row says on its
+ * own are the interface's (`UiStrings`); the app's sidebar keeps its own grouping logic.
+ */
+import { createElement } from "react";
+import type { ReactElement } from "react";
+import { describe, expect, it } from "vitest";
+import {
+ FolderSection,
+ GroupHeader,
+ MoreRow,
+} from "../src/components/navigation/group-header/group-header";
+import { Pager } from "../src/components/navigation/group-header/pager";
+import { DEFAULT_UI_STRINGS, UiStringsProvider } from "../src/strings";
+import { classTokens, renderStatic } from "../src/testing";
+
+const zh = {
+ ...DEFAULT_UI_STRINGS,
+ expand: "展开",
+ collapse: "折叠",
+ more: "更多",
+ fewer: "收起",
+ loading: "加载中…",
+ previous: "上一页",
+ next: "下一页",
+ pagePosition: (page: number, count: number) => `第 ${page} 页,共 ${count} 页`,
+};
+const inZh = (element: ReactElement) =>
+ renderStatic(createElement(UiStringsProvider, { strings: zh }, element));
+
+describe("GroupHeader", () => {
+ const header = (open: boolean, uppercase: boolean) =>
+ inZh(
+ createElement(GroupHeader, {
+ open,
+ onToggle: () => {},
+ icon: null,
+ label: "Coder",
+ uppercase,
+ count: 3,
+ }),
+ );
+
+ it("names its toggle by what pressing it does, in the interface's words", () => {
+ expect(header(true, false)).toContain('aria-expanded="true" aria-label="折叠"');
+ expect(header(false, false)).toContain('aria-expanded="false" aria-label="展开"');
+ });
+
+ it("sets a group label on the eyebrow rung, and a name whose casing matters on the small one", () => {
+ expect(classTokens(header(true, true))).toContain("ui-eyebrow");
+ expect(classTokens(header(true, true))).not.toContain("uppercase");
+ expect(classTokens(header(true, false))).not.toContain("ui-eyebrow");
+ });
+});
+
+describe("FolderSection and MoreRow", () => {
+ it("say the interface's More and Show less where the caller counts nothing", () => {
+ const html = inZh(
+ createElement(
+ FolderSection,
+ { label: "Archived", open: true, onToggle: () => {}, more: true, less: true },
+ "rows",
+ ),
+ );
+ expect(html).toContain('aria-label="更多"');
+ expect(html).toContain(">收起</button>");
+ expect(html).toContain("rows");
+ });
+
+ it("disables a pending row and shows the loading label in place of its text", () => {
+ const html = inZh(
+ createElement(MoreRow, { label: "Show 7 more", pending: true, onClick: () => {} }),
+ );
+ expect(html).toContain('disabled=""');
+ expect(html).toContain("加载中…");
+ expect(html).not.toContain("Show 7 more");
+ });
+});
+
+describe("Pager", () => {
+ const pager = (page: number, variant?: "labelled") =>
+ inZh(
+ createElement(Pager, {
+ page,
+ pageCount: 5,
+ onChange: () => {},
+ ...(variant !== undefined
+ ? { variant, previousLabel: "Newer", nextLabel: "Older", readout: "Page 1 / 5" }
+ : {}),
+ }),
+ );
+
+ it("reads its position aloud and names its glyph steps in the interface's words", () => {
+ const html = pager(1);
+ expect(html).toContain('aria-live="polite" aria-label="第 2 页,共 5 页"');
+ expect(html).toContain(">2/5</span>");
+ expect(html).toContain('aria-label="上一页"');
+ expect(html).toContain('aria-label="下一页"');
+ });
+
+ it("disables the step that would go nowhere", () => {
+ expect(pager(0).match(/disabled=""/g)).toHaveLength(1);
+ expect(pager(4).match(/disabled=""/g)).toHaveLength(1);
+ expect(pager(2)).not.toMatch(/disabled=""/);
+ });
+
+ it("labels its steps with the caller's words in the labelled look", () => {
+ const html = pager(0, "labelled");
+ expect(html).toContain(">Newer</button>");
+ expect(html).toContain(">Older</button>");
+ expect(html).toContain(">Page 1 / 5</span>");
+ expect(html).not.toContain("data-tooltip");
+ });
+});
diff --git a/packages/ui/test/hooks.test.ts b/packages/ui/test/hooks.test.ts
index 465e8262..9e191527 100644
--- a/packages/ui/test/hooks.test.ts
+++ b/packages/ui/test/hooks.test.ts
@@ -73,10 +73,11 @@ const APPENDIX_A = [
* Glass is for the layers that float over the page (the composer card, dialogs, menus, popovers,
* tooltips); the eyebrow and display rungs for the sidebar's list label and the page titles; live
* marks for the spinner, a pulsing state dot and the machines page's working marks; frames for
- * the transcript's cards; the shell for the app layout; a decorative icon for the rows and headers
- * whose label already says what the icon says (sidebar rows and group headers, the settings rail,
- * a menu row's glyph, a tab, an empty state) — a session row is not a host, its avatar and marks
- * carry information; a tree for a file tree and a work group's steps; a field for a settings row;
+ * the transcript's cards, the code block, the page's cards and a table that is its own box; the
+ * shell for the app layout; a decorative icon for the rows and headers whose label already says
+ * what the icon says (sidebar rows and group headers, a nav row's glyph in a rail, a menu row's
+ * glyph, a tab, an empty state) — a session row is not a host, its avatar and marks carry
+ * information; a tree for a file tree and a work group's steps; a field for a settings row;
* activity for the transcript's work in progress (the work group's header, a tool call, the
* thinking row).
*/
@@ -94,25 +95,19 @@ const HOSTS: Readonly<Record<string, readonly string[]>> = {
],
// `Text` carries it for its eyebrow role (W5), the one door a group label takes in new code.
"ui-eyebrow": ["Sidebar", "GroupHeader", "PagedDialog", "Text"],
- "ui-display": [
- "Heading",
- "EmptyState",
- "AgentsPage",
- "ModelsPage",
- "PluginsPage",
- "UsagePage",
- "BenchmarkPage",
- "MachinesPage",
- "DraftView",
- ],
- "ui-live": ["Spinner", "Dot", "Stepper", "MachineCard"],
- "ui-frame": ["ToolCallCard", "WorkGroup", "CodeBlock"],
+ // The page titles are `PageHeader`'s; the usage page and the draft view's hero still write
+ // their own until their waves (W8, W6).
+ "ui-display": ["Heading", "PageHeader", "EmptyState", "UsagePage", "DraftView"],
+ "ui-live": ["Spinner", "Dot", "Stepper", "MachineCard", "ProgressBar"],
+ // The transcript's cards and the code block, and the page-level boxes (W4): the card and a
+ // table that is its own box.
+ "ui-frame": ["ToolCallCard", "WorkGroup", "CodeBlock", "Card", "Table"],
"ui-underline-nav": ["Tabs"],
"ui-shell": ["AppLayout"],
"ui-icon-decor": [
"GlyphIcon",
"Sidebar",
- "PagedDialog",
+ "NavRow",
"SettingsDialog",
"MenuItemGlyph",
"MenuItem",
@@ -145,7 +140,7 @@ const NOT_HOOKS = new Set(["ui-sans-serif", "ui-serif", "ui-monospace", "ui-roun
const FRAME_SLOTS = new Set(["head", "body", "foot", "pane"]);
const SHELL_SLOTS = new Set(["nav", "main", "dock"]);
const FIELD_SLOTS = new Set(["label", "control", "hint"]);
-const LIVE_SIGNALS = new Set(["dot", "caret", "spinner"]);
+const LIVE_SIGNALS = new Set(["dot", "caret", "spinner", "bar"]);
const ICON_ROLES = new Set(["nav", "group", "menu", "empty"]);
const ACTIVITY_KINDS = new Set(["thinking", "tool"]);
const ACTIVITY_STATES = new Set(["running", "done", "error"]);
@@ -281,7 +276,9 @@ describe("style hooks", () => {
const problems: string[] = [];
const live = element.attributes.get("data-live");
if (names.has("ui-live") && live !== null && !LIVE_SIGNALS.has(String(live))) {
- problems.push(`${at} .ui-live needs data-live="dot|caret|spinner", has ${String(live)}`);
+ problems.push(
+ `${at} .ui-live needs data-live="dot|caret|spinner|bar", has ${String(live)}`,
+ );
}
const level = element.attributes.get("aria-level");
if (names.has("ui-display") && element.intrinsic && element.tag !== "h1" && level !== "1") {
diff --git a/packages/ui/test/key-value.test.ts b/packages/ui/test/key-value.test.ts
new file mode 100644
index 00000000..f43271d1
--- /dev/null
+++ b/packages/ui/test/key-value.test.ts
@@ -0,0 +1,37 @@
+/**
+ * KeyValue: a two-column description list whose figures are tabular (rule 15 reads the
+ * component), labels in the muted ink, identifier values in the data face.
+ */
+import { createElement } from "react";
+import { describe, expect, it } from "vitest";
+import { KeyValue, KeyValueRow } from "../src/components/data/key-value/key-value";
+import { classTokens, renderStatic } from "../src/testing";
+
+describe("KeyValue", () => {
+ const html = renderStatic(
+ createElement(
+ KeyValue,
+ null,
+ createElement(KeyValueRow, { label: "Version" }, "0.2.13"),
+ createElement(KeyValueRow, { label: "Root", mono: true }, "~/.penguin/data"),
+ ),
+ );
+
+ it("is a two-column dl with tabular figures", () => {
+ expect(html).toMatch(
+ /^<dl class="grid grid-cols-\[auto_minmax\(0,1fr\)\] gap-x-4 tabular-nums /,
+ );
+ expect(html).toMatch(/<dt class="text-fg-muted">Version<\/dt><dd class="[^"]*">0\.2\.13<\/dd>/);
+ });
+
+ it("sets an identifier in the data face, and breaks any value rather than widen", () => {
+ const values = [...html.matchAll(/<dd class="([^"]*)"/g)].map((m) => m[1]!.split(/\s+/));
+ expect(values[0]).not.toContain("font-mono");
+ expect(values[1]).toContain("font-mono");
+ for (const value of values) expect(value).toContain("[overflow-wrap:anywhere]");
+ });
+
+ it("takes the body rung in a dialog", () => {
+ expect(classTokens(renderStatic(createElement(KeyValue, { size: "sm" })))).toContain("text-sm");
+ });
+});
diff --git a/packages/ui/test/list-row.test.ts b/packages/ui/test/list-row.test.ts
new file mode 100644
index 00000000..e7e69dae
--- /dev/null
+++ b/packages/ui/test/list-row.test.ts
@@ -0,0 +1,41 @@
+/**
+ * ListRow: a ruled row whose mark and text become one button when the row opens what it names,
+ * with its own actions outside that button.
+ */
+import { createElement } from "react";
+import { describe, expect, it } from "vitest";
+import { ListRow } from "../src/components/data/list-row/list-row";
+import { classTokens, renderStatic } from "../src/testing";
+
+const trailing = createElement("button", { type: "button", "aria-label": "Export" }, "E");
+
+describe("ListRow", () => {
+ it("is a ruled row that lightens under the pointer, on tokens", () => {
+ const html = renderStatic(
+ createElement(ListRow, { title: "pdf", description: "Reads PDFs.", meta: "2 KB", trailing }),
+ );
+ expect(html).toMatch(/^<div class="flex items-center gap-3 border-b border-line-muted /);
+ expect(classTokens(html)).toEqual(
+ expect.arrayContaining(["last:border-b-0", "hover:bg-surface-muted", "text-fg-muted"]),
+ );
+ // Not a button when it opens nothing: the only button is the action.
+ expect(html.match(/<button/g)).toHaveLength(1);
+ });
+
+ it("makes the mark and the text one button when it opens something, the actions outside it", () => {
+ const html = renderStatic(
+ createElement(ListRow, {
+ as: "li",
+ leading: createElement("img", { alt: "", src: "/a.svg" }),
+ title: "case-01",
+ onClick: () => {},
+ trailing,
+ }),
+ );
+ // React 19's server renderer prepends a preload hint for an eager image; not our markup.
+ expect(html.replace(/^<link rel="preload"[^>]*\/>/, "")).toMatch(/^<li /);
+ expect(html).toMatch(
+ /<button type="button" class="[^"]*"><span[^>]*><img[^>]*\/><\/span>(?:(?!<\/button>).)*case-01(?:(?!<\/button>).)*<\/button><div[^>]*><button type="button" aria-label="Export">/,
+ );
+ });
+});
diff --git a/packages/ui/test/log-view.test.ts b/packages/ui/test/log-view.test.ts
new file mode 100644
index 00000000..d2684237
--- /dev/null
+++ b/packages/ui/test/log-view.test.ts
@@ -0,0 +1,28 @@
+/**
+ * LogView: a focusable `log` region of monospace lines in the inset well, the latest line of a
+ * running job in the body ink.
+ */
+import { createElement } from "react";
+import { describe, expect, it } from "vitest";
+import { LogView } from "../src/components/data/log-view/log-view";
+import { classTokens, renderStatic } from "../src/testing";
+
+const LINES = ["pulling image", "extracting", "starting server"];
+
+describe("LogView", () => {
+ it("is a named, focusable log region in the inset well", () => {
+ const html = renderStatic(createElement(LogView, { lines: LINES, label: "Update output" }));
+ expect(html).toMatch(/^<pre role="log" aria-label="Update output" tabindex="0" class="/);
+ expect(classTokens(html)).toEqual(
+ expect.arrayContaining(["bg-surface-inset", "font-mono", "overflow-auto", "max-h-64"]),
+ );
+ expect(html).toContain("pulling image\nextracting\nstarting server</pre>");
+ });
+
+ it("brightens the last line only when asked", () => {
+ const html = renderStatic(createElement(LogView, { lines: LINES, highlightLast: true }));
+ expect(html).toContain('extracting\n<span class="text-fg">starting server</span></pre>');
+ const one = renderStatic(createElement(LogView, { lines: ["done"], highlightLast: true }));
+ expect(one).toMatch(/class="[^"]*"><span class="text-fg">done<\/span><\/pre>$/);
+ });
+});
diff --git a/packages/ui/test/nav-list.test.ts b/packages/ui/test/nav-list.test.ts
new file mode 100644
index 00000000..5511135b
--- /dev/null
+++ b/packages/ui/test/nav-list.test.ts
@@ -0,0 +1,68 @@
+/**
+ * NavList and NavRow (src/components/navigation/nav-list/nav-list.tsx): a named navigation whose
+ * current row is the page, whose glyphs are decoration, whose labels are never mono, and whose
+ * rows follow the list's orientation.
+ */
+import { createElement } from "react";
+import { describe, expect, it } from "vitest";
+import { ICONS } from "../src/components/icons/icons";
+import { NavList, NavRow, navRowClass } from "../src/components/navigation/nav-list/nav-list";
+import { classTokens, renderStatic } from "../src/testing";
+
+const list = (orientation: "vertical" | "responsive" = "vertical") =>
+ renderStatic(
+ createElement(
+ NavList,
+ { label: "Project settings", orientation },
+ createElement(NavRow, { label: "General", glyph: ICONS.gear, active: true }),
+ createElement(NavRow, { label: "Members", badge: createElement("span", null, "3") }),
+ createElement(NavRow, { label: "Billing", disabled: true }),
+ ),
+ );
+
+describe("NavList", () => {
+ it("is a navigation named by its label, with exactly one current row", () => {
+ const html = list();
+ expect(html).toMatch(/^<nav aria-label="Project settings" class="flex flex-col gap-1 /);
+ expect(html.match(/aria-current="page"/g)).toHaveLength(1);
+ expect(html).toMatch(/aria-current="page"[^>]*><span aria-hidden="true" class="ui-icon-decor /);
+ });
+
+ it("marks the glyph as a nav decoration and keeps labels in the text face", () => {
+ const html = list();
+ expect(html).toMatch(
+ /<span aria-hidden="true" class="ui-icon-decor shrink-0 text-fg-subtle" data-role="nav"><svg/,
+ );
+ expect(classTokens(html)).not.toContain("font-mono");
+ });
+
+ it("takes a disabled row out of use and leaves the badge at the row's end", () => {
+ const html = list();
+ expect(html).toMatch(/<button type="button" disabled="" class="[^"]*cursor-not-allowed/);
+ expect(html).toMatch(/<span class="ml-auto flex shrink-0 items-center"><span>3<\/span>/);
+ });
+
+ it("scrolls sideways below sm when responsive, with rows at their labels' width", () => {
+ const html = list("responsive");
+ expect(html).toContain("overflow-x-auto sm:flex-col");
+ expect(classTokens(html)).toEqual(expect.arrayContaining(["shrink-0", "sm:w-full"]));
+ expect(classTokens(list())).toContain("w-full");
+ });
+});
+
+describe("NavRow", () => {
+ it("is a link with an address, and a disabled link leaves the tab order", () => {
+ const link = renderStatic(createElement(NavRow, { label: "Agents", href: "/agents" }));
+ expect(link).toMatch(/^<a href="\/agents" class="/);
+ const off = renderStatic(
+ createElement(NavRow, { label: "Agents", href: "/agents", disabled: true }),
+ );
+ expect(off).toMatch(/^<span role="link" aria-disabled="true" class="/);
+ expect(off).not.toContain("href");
+ });
+
+ it("gives a router link the same look through navRowClass", () => {
+ const html = renderStatic(createElement(NavRow, { label: "Agents", active: true }));
+ expect(html).toContain(`class="${navRowClass({ active: true })} "`);
+ });
+});
diff --git a/packages/ui/test/notice.test.ts b/packages/ui/test/notice.test.ts
new file mode 100644
index 00000000..251616f5
--- /dev/null
+++ b/packages/ui/test/notice.test.ts
@@ -0,0 +1,106 @@
+/**
+ * Notice (src/components/feedback/notice/notice.tsx) and the page to-do built on it
+ * (src/components/feedback/todo-notice/todo-notice.tsx): the three variants are layouts of one
+ * NoticeStrip, the parts sit in the hook's slots, and the action slots come in reading order
+ * with the affirmative one last.
+ */
+import { createElement } from "react";
+import { describe, expect, it } from "vitest";
+import { Notice } from "../src/components/feedback/notice/notice";
+import type { NoticeVariant } from "../src/components/feedback/notice/notice";
+import { TodoNotice } from "../src/components/feedback/todo-notice/todo-notice";
+import { DEFAULT_UI_STRINGS, UiStringsProvider } from "../src/strings";
+import { classTokens, renderStatic } from "../src/testing";
+
+const noop = () => {};
+
+describe("Notice", () => {
+ it("draws every variant through the notice strip, in the tone's words for the hook", () => {
+ for (const variant of ["strip", "callout", "inline"] satisfies NoticeVariant[]) {
+ const html = renderStatic(
+ createElement(Notice, { tone: "attention", variant, children: "Heads up" }),
+ );
+ expect(classTokens(html), variant).toEqual(
+ expect.arrayContaining(["ui-notice", "border-line", "bg-tone-attention-bg"]),
+ );
+ expect(html).toContain('data-tone="warning"');
+ }
+ const strip = classTokens(
+ renderStatic(createElement(Notice, { tone: "danger", variant: "strip", children: "x" })),
+ );
+ expect(strip).toContain("border-b");
+ expect(strip.some((t) => t.startsWith("rounded"))).toBe(false);
+ });
+
+ it("puts its parts in the hook's slots", () => {
+ const html = renderStatic(
+ createElement(Notice, {
+ tone: "info",
+ title: "Update",
+ glyph: "M4 4h16",
+ action: { label: "View", onClick: noop },
+ children: "Version 0.3.0 is available.",
+ }),
+ );
+ expect(html).toMatch(/data-slot="icon" aria-hidden="true"[^>]*><svg/);
+ expect(html).toContain('<p data-slot="title" class="font-medium">Update</p>');
+ expect(html).toContain('<div data-slot="body">Version 0.3.0 is available.</div>');
+ expect(html).toMatch(/data-slot="actions"[\s\S]*>View<\/button>/);
+ });
+
+ it("orders the actions dismiss, retry, then the affirmative action", () => {
+ const html = renderStatic(
+ createElement(Notice, {
+ tone: "danger",
+ dismiss: { label: "Ignore", onClick: noop },
+ retry: { label: "Retry", onClick: noop },
+ action: { label: "Fix", onClick: noop },
+ children: "Failed",
+ }),
+ );
+ const at = (text: string) => html.indexOf(`>${text}</button>`);
+ expect(at("Ignore")).toBeLessThan(at("Retry"));
+ expect(at("Retry")).toBeLessThan(at("Fix"));
+ });
+
+ it("shows the close cross, named in the interface's words, for a dismiss with no label", () => {
+ const html = renderStatic(
+ createElement(
+ UiStringsProvider,
+ { strings: { ...DEFAULT_UI_STRINGS, dismiss: "关闭" } },
+ createElement(Notice, {
+ tone: "neutral",
+ dismiss: { onClick: noop },
+ children: "Archived",
+ }),
+ ),
+ );
+ expect(html).toContain('aria-label="关闭"');
+ });
+});
+
+describe("TodoNotice", () => {
+ const todo = (withAction: boolean) =>
+ renderStatic(
+ createElement(TodoNotice, {
+ text: "3 skills can be updated",
+ dismissLabel: "Mark as read",
+ onDismiss: noop,
+ ...(withAction ? { actionLabel: "Update all", onAction: noop } : {}),
+ }),
+ );
+
+ it("is an attention callout whose buttons fold the sentence into their names", () => {
+ const html = todo(true);
+ expect(html).toContain('data-tone="warning"');
+ expect(html).toContain('aria-label="Mark as read · 3 skills can be updated"');
+ expect(html).toContain('aria-label="Update all · 3 skills can be updated"');
+ expect(html.indexOf(">Mark as read<")).toBeLessThan(html.indexOf(">Update all<"));
+ });
+
+ it("offers the dismiss alone where nothing can be updated", () => {
+ const html = todo(false);
+ expect(html).toContain(">Mark as read<");
+ expect(html.match(/<button/g)).toHaveLength(1);
+ });
+});
diff --git a/packages/ui/test/page.test.ts b/packages/ui/test/page.test.ts
new file mode 100644
index 00000000..4d6154d4
--- /dev/null
+++ b/packages/ui/test/page.test.ts
@@ -0,0 +1,68 @@
+/**
+ * PageFrame and PageHeader: the frame scrolls and centres its column at the chosen width; the
+ * header's title is the page's one display h1 at the app's page-title size (not the theme's h1
+ * rung), with no eyebrow, its "?" named through UiStrings, the way back above it and the actions
+ * after it.
+ */
+import { createElement } from "react";
+import { describe, expect, it } from "vitest";
+import { PageFrame, PageHeader } from "../src/components/layout/page/page";
+import { DEFAULT_UI_STRINGS, UiStringsProvider } from "../src/strings";
+import { classTokens, renderStatic } from "../src/testing";
+
+describe("PageFrame", () => {
+ it("scrolls on its own and centres its column at the chosen width", () => {
+ const html = renderStatic(createElement(PageFrame, null, "content"));
+ expect(html).toMatch(
+ /^<div class="h-full overflow-y-auto p-4 md:p-6 *"><div class="mx-auto max-w-5xl/,
+ );
+ expect(renderStatic(createElement(PageFrame, { width: "xl" }))).toContain("max-w-6xl");
+ const full = classTokens(renderStatic(createElement(PageFrame, { width: "full" })));
+ expect(full).toContain("min-w-0");
+ expect(full.filter((t) => t.startsWith("max-w-"))).toEqual([]);
+ });
+});
+
+describe("PageHeader", () => {
+ it("titles the page with the display h1 at the page-title size, and no eyebrow", () => {
+ const html = renderStatic(createElement(PageHeader, { title: "Agents" }));
+ expect(html).toMatch(/<h1 class="ui-display [^"]*">Agents<\/h1>/);
+ const title = /<h1 class="([^"]*)"/.exec(html)![1]!.split(/\s+/);
+ expect(title).toEqual(expect.arrayContaining(["text-xl", "font-semibold"]));
+ expect(title.filter((t) => t.includes("--ui-h1-"))).toEqual([]);
+ expect(html).not.toContain("ui-eyebrow");
+ });
+
+ it("names its trigger through UiStrings and keeps the explanation behind it", () => {
+ const html = renderStatic(
+ createElement(
+ UiStringsProvider,
+ { strings: { ...DEFAULT_UI_STRINGS, moreInfoAbout: (s: string) => `About ${s}` } },
+ createElement(PageHeader, { title: "Models", info: "Where models come from." }),
+ ),
+ );
+ expect(html).toContain('aria-label="About Models"');
+ expect(html).not.toContain("Where models come from.");
+ });
+
+ it("draws the way back above the title, the description under it and the actions after it", () => {
+ const html = renderStatic(
+ createElement(
+ PageHeader,
+ {
+ title: "Reviewer",
+ description: "agent-reviewer",
+ back: { label: "All agents", onClick: () => {} },
+ actions: createElement("button", { type: "button" }, "Run"),
+ },
+ createElement("p", null, "A notice"),
+ ),
+ );
+ const order = ["All agents", "<h1", "agent-reviewer", "Run", "A notice"].map((part) =>
+ html.indexOf(part),
+ );
+ expect(order.every((i) => i >= 0)).toBe(true);
+ expect(order).toEqual([...order].sort((a, b) => a - b));
+ expect(html).toMatch(/<button type="button"[^>]*>(?:(?!<\/button>).)*<svg/);
+ });
+});
diff --git a/packages/ui/test/progress-bar.test.ts b/packages/ui/test/progress-bar.test.ts
new file mode 100644
index 00000000..af0d3259
--- /dev/null
+++ b/packages/ui/test/progress-bar.test.ts
@@ -0,0 +1,44 @@
+/**
+ * ProgressBar (src/components/feedback/progress-bar/progress-bar.tsx): a named progress bar whose
+ * determinate fill moves on the theme's layout motion, and whose indeterminate segment pulses as a
+ * live signal and reports no value.
+ */
+import { createElement } from "react";
+import { describe, expect, it } from "vitest";
+import { ProgressBar } from "../src/components/feedback/progress-bar/progress-bar";
+import { classTokens, renderStatic } from "../src/testing";
+
+describe("ProgressBar", () => {
+ it("names itself and reports a clamped value, the fill on the layout motion", () => {
+ const html = renderStatic(
+ createElement(ProgressBar, { value: 140, label: "Download progress", tone: "danger" }),
+ );
+ expect(html).toContain('role="progressbar"');
+ expect(html).toContain('aria-label="Download progress"');
+ expect(html).toContain('aria-valuemin="0" aria-valuemax="100" aria-valuenow="100"');
+ expect(html).toContain('data-layout-motion=""');
+ expect(html).toContain("width:100%");
+ expect(classTokens(html)).toEqual(
+ expect.arrayContaining(["bg-line-muted", "bg-tone-danger-emphasis"]),
+ );
+ });
+
+ it("reports no value while indeterminate, and pulses through the live hook", () => {
+ const html = renderStatic(
+ createElement(ProgressBar, { indeterminate: true, label: "Download progress" }),
+ );
+ expect(html).not.toContain("aria-valuenow");
+ expect(html).not.toContain("data-layout-motion");
+ expect(html).toContain('data-live="bar"');
+ expect(classTokens(html)).toEqual(
+ expect.arrayContaining(["bg-accent", "w-1/3", "ui-live", "animate-pulse"]),
+ );
+ });
+
+ it("passes the caller's tooltip through to the bar", () => {
+ // Not an object literal at the call, so the data attribute is not an excess property.
+ const props = { value: 40, label: "Spend", "data-tooltip": "$4 of $10" };
+ const html = renderStatic(createElement(ProgressBar, props));
+ expect(html).toContain('data-tooltip="$4 of $10"');
+ });
+});
diff --git a/packages/ui/test/ruled-section.test.ts b/packages/ui/test/ruled-section.test.ts
new file mode 100644
index 00000000..a7cce016
--- /dev/null
+++ b/packages/ui/test/ruled-section.test.ts
@@ -0,0 +1,43 @@
+/**
+ * RuledSection: the title is a group label (the eyebrow role) inside the section's heading, the
+ * count is the package's tabular Count, and the rule under the title is a token line.
+ */
+import { createElement } from "react";
+import { describe, expect, it } from "vitest";
+import { RuledSection } from "../src/components/layout/ruled-section/ruled-section";
+import { classTokens, renderStatic } from "../src/testing";
+
+describe("RuledSection", () => {
+ const html = renderStatic(
+ createElement(
+ RuledSection,
+ {
+ title: "Inbox",
+ count: 3,
+ info: "Tickets waiting on you.",
+ actions: createElement("button", { type: "button" }, "Filter"),
+ },
+ createElement("p", null, "rows"),
+ ),
+ );
+
+ it("is a section headed by an eyebrow inside an h2, over a token rule", () => {
+ expect(html).toMatch(/^<section class="min-w-0 *">/);
+ expect(html).toMatch(/<h2 class="[^"]*"><span class="ui-eyebrow [^"]*">Inbox<\/span>/);
+ expect(html).toMatch(/class="[^"]*\bborder-b border-line pb-2\b/);
+ expect(html).not.toMatch(/gray-|dark:|uppercase|tracking-/);
+ });
+
+ it("shows the count as a tabular Count, the trigger and the actions, then the body", () => {
+ expect(html).toMatch(/<span class="[^"]*tabular-nums[^"]*">3<\/span>/);
+ expect(html).toContain('aria-label="More info: Inbox"');
+ expect(html.indexOf("Filter")).toBeLessThan(html.indexOf("rows"));
+ });
+
+ it("drops what it is not given, and takes a level-3 heading inside a dialog", () => {
+ const bare = renderStatic(createElement(RuledSection, { title: "Goal", level: 3 }, "text"));
+ expect(bare).toContain("<h3");
+ expect(bare).not.toContain("<button");
+ expect(classTokens(bare)).not.toContain("tabular-nums");
+ });
+});
diff --git a/packages/ui/test/stat-chip.test.ts b/packages/ui/test/stat-chip.test.ts
new file mode 100644
index 00000000..25998798
--- /dev/null
+++ b/packages/ui/test/stat-chip.test.ts
@@ -0,0 +1,34 @@
+/**
+ * StatChip (src/components/data/stat-chip/stat-chip.tsx): a glyph with a value in tabular figures,
+ * named by its label, with a compact value and a wide-only form for a row that must fit a phone.
+ */
+import { createElement } from "react";
+import { describe, expect, it } from "vitest";
+import { StatChip } from "../src/components/data/stat-chip/stat-chip";
+import { classTokens, renderStatic } from "../src/testing";
+
+describe("StatChip", () => {
+ it("is named by its label, as its tooltip and accessible name, in tabular figures", () => {
+ const html = renderStatic(
+ createElement(StatChip, { glyph: "M4 4h16", value: "1.2k", label: "Input" }),
+ );
+ expect(html).toContain('data-tooltip="Input" aria-label="Input"');
+ expect(classTokens(html)).toEqual(expect.arrayContaining(["flex", "tabular-nums"]));
+ expect(html).toContain("1.2k");
+ });
+
+ it("swaps in the compact value below sm, and drops a wide-only chip there", () => {
+ const html = renderStatic(
+ createElement(StatChip, {
+ glyph: "M4 4h16",
+ value: "$0.0123",
+ compactValue: "$0.01",
+ label: "Cost",
+ wideOnly: true,
+ }),
+ );
+ expect(html).toContain('<span class="sm:hidden">$0.01</span>');
+ expect(html).toContain('<span class="hidden sm:inline">$0.0123</span>');
+ expect(classTokens(html)).toEqual(expect.arrayContaining(["hidden", "sm:flex"]));
+ });
+});
diff --git a/packages/ui/test/stat-tile.test.ts b/packages/ui/test/stat-tile.test.ts
new file mode 100644
index 00000000..cb7f0e8d
--- /dev/null
+++ b/packages/ui/test/stat-tile.test.ts
@@ -0,0 +1,32 @@
+/**
+ * StatTile (src/components/data/stat-tile/stat-tile.tsx): one KPI as a bordered tile, its value in
+ * tabular figures, a tone inking the glyph and the value together.
+ */
+import { createElement } from "react";
+import { describe, expect, it } from "vitest";
+import { StatTile } from "../src/components/data/stat-tile/stat-tile";
+import { classTokens, renderStatic } from "../src/testing";
+
+describe("StatTile", () => {
+ it("is a plain bordered tile: label, value in tabular figures, then the detail", () => {
+ const html = renderStatic(
+ createElement(StatTile, { icon: "M4 4h16", label: "Spend", value: "$12", detail: "of $40" }),
+ );
+ expect(html).not.toContain("<button");
+ expect(classTokens(html)).toEqual(
+ expect.arrayContaining(["border-line", "bg-surface", "tabular-nums"]),
+ );
+ expect(html.indexOf("Spend")).toBeLessThan(html.indexOf("$12"));
+ expect(html.indexOf("$12")).toBeLessThan(html.indexOf("of $40"));
+ });
+
+ it("inks the glyph and the value in the tone, and nothing without one", () => {
+ const toned = renderStatic(
+ createElement(StatTile, { icon: "M4 4h16", label: "Alerts", value: 2, tone: "danger" }),
+ );
+ expect(toned.match(/text-tone-danger-fg/g)).toHaveLength(2);
+ const plain = renderStatic(createElement(StatTile, { label: "Employees", value: 7 }));
+ expect(plain).not.toContain("text-tone-");
+ expect(plain).not.toContain("<svg");
+ });
+});
diff --git a/packages/ui/test/strings.test.ts b/packages/ui/test/strings.test.ts
index c24112fe..82dc7f6f 100644
--- a/packages/ui/test/strings.test.ts
+++ b/packages/ui/test/strings.test.ts
@@ -25,14 +25,21 @@ describe("UiStrings", () => {
expect(Object.keys(DEFAULT_UI_STRINGS).sort()).toEqual([
"clearSearch",
"close",
+ "collapse",
"copied",
"copyCode",
"dismiss",
+ "expand",
+ "fewer",
"hidePassword",
"loading",
+ "more",
"moreInfo",
"moreInfoAbout",
+ "next",
"notifications",
+ "pagePosition",
+ "previous",
"showPassword",
]);
expect(DEFAULT_UI_STRINGS).toMatchObject({
@@ -47,8 +54,10 @@ describe("UiStrings", () => {
notifications: "Notifications",
dismiss: "Dismiss",
});
- // The one formatter: the subject folds into the name, keeping "More info" its prefix.
+ // The formatters: the subject folds into the name, keeping "More info" its prefix; a
+ // pager's position counts from 1.
expect(DEFAULT_UI_STRINGS.moreInfoAbout("Vault")).toBe("More info: Vault");
+ expect(DEFAULT_UI_STRINGS.pagePosition(2, 5)).toBe("Page 2 of 5");
});
it("falls back to the defaults when no provider is mounted", () => {
diff --git a/packages/ui/test/table.test.ts b/packages/ui/test/table.test.ts
new file mode 100644
index 00000000..f856d26c
--- /dev/null
+++ b/packages/ui/test/table.test.ts
@@ -0,0 +1,79 @@
+/**
+ * The Table family: one header style (the small rung, medium weight, muted ink, a token rule; the
+ * muted strip only on a framed table, which is a `ui-frame` host), column headers scoped to their
+ * columns, and cells that share the header's padding per density.
+ */
+import { createElement } from "react";
+import { describe, expect, it } from "vitest";
+import {
+ Table,
+ TableBody,
+ TableCell,
+ TableHead,
+ TableHeaderCell,
+ TableRow,
+} from "../src/components/data/table/table";
+import type { TableProps } from "../src/components/data/table/table";
+import { classTokens, renderStatic } from "../src/testing";
+
+const table = (props: Partial<TableProps>): string =>
+ renderStatic(
+ createElement(
+ Table,
+ props,
+ createElement(
+ TableHead,
+ null,
+ createElement(TableHeaderCell, null, "Name"),
+ createElement(TableHeaderCell, { align: "right" }, "Cost"),
+ ),
+ createElement(
+ TableBody,
+ null,
+ createElement(
+ TableRow,
+ null,
+ createElement(TableCell, null, "alpha"),
+ createElement(TableCell, { numeric: true }, "$0.12"),
+ ),
+ ),
+ ),
+ );
+
+describe("Table", () => {
+ it("is its own framed box by default, scrolling sideways, on tokens", () => {
+ const html = table({ caption: "Schedules", tableClassName: "min-w-[720px]" });
+ expect(html).toMatch(/^<div class="ui-frame overflow-x-auto overflow-y-clip /);
+ expect(html).toMatch(/<table class="w-full text-left text-sm min-w-\[720px\]">/);
+ expect(html).toContain('<caption class="sr-only">Schedules</caption>');
+ expect(html).not.toMatch(/gray-|dark:/);
+ });
+
+ it("heads its columns in one style, with the strip only when framed", () => {
+ const framed = table({});
+ expect(framed).toMatch(
+ /<thead><tr class="border-b border-line text-xs text-fg-muted bg-surface-muted">/,
+ );
+ expect(framed).toMatch(/<th scope="col" class="[^"]*font-medium text-left/);
+ expect(framed).toMatch(/<th scope="col" class="[^"]*text-right[^"]*">Cost<\/th>/);
+ const bare = table({ framed: false });
+ expect(bare).toMatch(/^<div class="overflow-x-auto /);
+ expect(bare).not.toContain("ui-frame");
+ expect(bare).toContain('<tr class="border-b border-line text-xs text-fg-muted ">');
+ });
+
+ it("rules and lightens its rows, and sets figures right and tabular", () => {
+ const html = table({});
+ expect(classTokens(html)).toEqual(
+ expect.arrayContaining(["border-line-muted", "last:border-b-0", "hover:bg-surface-muted"]),
+ );
+ expect(html).toMatch(/<td class="px-3 py-2 text-right tabular-nums *">\$0\.12<\/td>/);
+ });
+
+ it("tightens header and cells together in the small density", () => {
+ const html = table({ size: "sm" });
+ expect(html).toMatch(/<table class="w-full text-left text-xs/);
+ expect(html).toMatch(/<th scope="col" class="px-2 py-1\.5 /);
+ expect(html).toMatch(/<td class="px-2 py-1\.5 /);
+ });
+});
diff --git a/packages/ui/test/tabs.test.ts b/packages/ui/test/tabs.test.ts
new file mode 100644
index 00000000..5f35c78b
--- /dev/null
+++ b/packages/ui/test/tabs.test.ts
@@ -0,0 +1,37 @@
+/**
+ * Tabs (src/components/navigation/tabs/tabs.tsx): a tab list whose selected tab the theme marks
+ * through the underline hook, and whose update badge reaches the tab's name and tooltip.
+ */
+import { createElement } from "react";
+import { describe, expect, it } from "vitest";
+import { Tabs } from "../src/components/navigation/tabs/tabs";
+import { classTokens, renderStatic } from "../src/testing";
+
+const render = (badge: string | null = null) =>
+ renderStatic(
+ createElement(Tabs<"a" | "b">, {
+ items: [
+ { key: "a", label: "Overview" },
+ { key: "b", label: "Skills", badge },
+ ],
+ active: "a",
+ onChange: () => {},
+ }),
+ );
+
+describe("Tabs", () => {
+ it("is a tab list with exactly one selected tab, on the underline hook", () => {
+ const html = render();
+ expect(html).toMatch(/^<div role="tablist" class="ui-underline-nav /);
+ expect(html.match(/role="tab"/g)).toHaveLength(2);
+ expect(html.match(/aria-selected="true"/g)).toHaveLength(1);
+ expect(classTokens(html)).toEqual(expect.arrayContaining(["border-line", "border-fg"]));
+ });
+
+ it("folds a badge's sentence into its tab's name and tooltip, and says nothing without one", () => {
+ const html = render("3 skills can be updated");
+ expect(html).toContain('aria-label="Skills · 3 skills can be updated"');
+ expect(html).toContain('data-tooltip="3 skills can be updated"');
+ expect(render()).not.toContain("aria-label");
+ });
+});
diff --git a/packages/web/src/components/account/update-modal.tsx b/packages/web/src/components/account/update-modal.tsx
index fa910290..60d232a9 100644
--- a/packages/web/src/components/account/update-modal.tsx
+++ b/packages/web/src/components/account/update-modal.tsx
@@ -14,7 +14,7 @@
* The flow and the actions live in `use-update-flow.ts`; this file only renders.
*/
import type { ReactNode } from "react";
-import { Button, Link, Modal, Spinner } from "@prismshadow/penguin-ui";
+import { Button, Link, Modal, ProgressBar, Spinner } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
import { stripAnsi } from "../../lib/strip-ansi";
import { toneInk } from "../../lib/tone";
@@ -87,7 +87,11 @@ function Body({ mode, flow }: { mode: UpdateMode; flow: UpdateFlow }): ReactNode
return (
<>
<p className="text-sm font-medium">{S.update.downloading(flow.version)}</p>
- <ProgressBar percent={flow.percent} />
+ <ProgressBar
+ size="md"
+ label={S.update.downloadProgress}
+ {...(flow.percent !== null ? { value: flow.percent } : { indeterminate: true })}
+ />
<p className="text-xs text-gray-500 dark:text-gray-400">
{flow.percent !== null
? `${flow.percent}%`
@@ -250,32 +254,6 @@ function ReleasesLink({ href, children }: { href: string; children: ReactNode })
);
}
-/**
- * The download bar: determinate with a percentage (the shell's updater, the installer's
- * curl bar), indeterminate — a pulsing segment — while the backend reports a phase without
- * one (resolving the release, verifying and installing). Width transitions only, so the
- * global reduced-motion rule leaves a correct resting state.
- */
-function ProgressBar({ percent }: { percent: number | null }) {
- return (
- <div
- role="progressbar"
- aria-label={S.update.downloadProgress}
- aria-valuemin={0}
- aria-valuemax={100}
- {...(percent !== null ? { "aria-valuenow": percent } : {})}
- className="h-2 w-full overflow-hidden rounded-full bg-gray-200 dark:bg-gray-800"
- >
- <div
- className={`h-full rounded-full bg-accent ${
- percent === null ? "w-1/3 animate-pulse" : "transition-[width] duration-300"
- }`}
- style={percent === null ? undefined : { width: `${percent}%` }}
- />
- </div>
- );
-}
-
/** The update command's output tail (may carry ANSI colour when the server env forces it). */
function OutputTail({ text }: { text: string }) {
return (
diff --git a/packages/web/src/components/layout/project-dialogs.tsx b/packages/web/src/components/layout/project-dialogs.tsx
index 6f8b9932..7e3cccd0 100644
--- a/packages/web/src/components/layout/project-dialogs.tsx
+++ b/packages/web/src/components/layout/project-dialogs.tsx
@@ -23,6 +23,8 @@ import {
InfoPopover,
Input,
Modal,
+ NavList,
+ NavRow,
Select,
SettingRow,
Switch,
@@ -178,25 +180,6 @@ const TAB_ICON_PATHS = {
type SettingsTab = keyof typeof TAB_ICON_PATHS;
-function TabIcon({ d }: { d: string }) {
- return (
- <svg
- width="15"
- height="15"
- viewBox="0 0 24 24"
- fill="none"
- stroke="currentColor"
- strokeWidth="1.7"
- strokeLinecap="round"
- strokeLinejoin="round"
- aria-hidden
- className="shrink-0"
- >
- <path d={d} />
- </svg>
- );
-}
-
/**
* Project settings dialog: a left tab rail (General / Members / Defaults / Security
* policy) with a row-styled content pane per tab; on narrow screens the rail degrades to a
@@ -235,27 +218,21 @@ export function ProjectSettingsDialog({ open, onClose }: { open: boolean; onClos
return (
<Modal open={open} title={S.project.settingsTitle} onClose={onClose} widthClass="sm:max-w-3xl">
<div className="flex flex-col gap-3 sm:min-h-[26rem] sm:flex-row sm:gap-0">
- <nav
- aria-label={S.project.settingsTitle}
- className="flex shrink-0 gap-1 overflow-x-auto sm:w-44 sm:flex-col sm:overflow-x-visible sm:border-r sm:border-gray-100 sm:pr-3 dark:sm:border-gray-800"
+ <NavList
+ label={S.project.settingsTitle}
+ orientation="responsive"
+ className="shrink-0 sm:w-44 sm:border-r sm:border-line-muted sm:pr-3"
>
{tabs.map((t) => (
- <button
+ <NavRow
key={t.key}
- type="button"
- aria-current={active.key === t.key ? "page" : undefined}
+ label={t.label}
+ glyph={TAB_ICON_PATHS[t.key]}
+ active={active.key === t.key}
onClick={() => setTab(t.key)}
- className={`flex shrink-0 items-center gap-2 rounded-md px-2.5 py-1.5 text-left text-sm transition-colors duration-150 ${
- active.key === t.key
- ? "bg-gray-100 font-medium text-gray-900 dark:bg-gray-800 dark:text-gray-100"
- : "text-gray-600 hover:bg-gray-50 dark:text-gray-300 dark:hover:bg-gray-800/60"
- }`}
- >
- <TabIcon d={TAB_ICON_PATHS[t.key]} />
- <span className="truncate">{t.label}</span>
- </button>
+ />
))}
- </nav>
+ </NavList>
<section className="min-w-0 flex-1 sm:pl-5">
<h3 className="flex items-center gap-1.5 text-base font-semibold">
{active.label}
diff --git a/packages/web/src/components/layout/sidebar.tsx b/packages/web/src/components/layout/sidebar.tsx
index 8089e2f4..5e356185 100644
--- a/packages/web/src/components/layout/sidebar.tsx
+++ b/packages/web/src/components/layout/sidebar.tsx
@@ -53,6 +53,8 @@ import {
ChevronDown,
ConfirmModal,
Dropdown,
+ FolderSection,
+ GroupHeader,
ICONS,
ICON_SIZE,
Input,
@@ -62,6 +64,7 @@ import {
MenuRadioItem,
MenuSeparator,
Modal,
+ MoreRow,
ScheduleMark,
SearchInput,
Segmented,
@@ -166,11 +169,8 @@ import { NAV_ICONS } from "../../lib/nav-icons";
import {
GROUP_MODE_ICONS,
SORT_MODE_ICONS,
- FolderSection,
- GroupHeader,
GroupPager,
Icon,
- MoreRow,
initialGroupMode,
newEntityForGroupMode,
storeGroupMode,
@@ -196,7 +196,7 @@ import { pendingScheduleSessions } from "../../features/schedules/schedule-panel
import { useProjectSchedules } from "../../features/schedules/schedule-store";
import { useCompany } from "../../state/company";
import { NoOrganizationsSidebar, OrgSwitcher } from "../../features/company/org-switcher";
-import { BetaBadge } from "../../features/company/beta-badge";
+import { CompanyBetaBadge } from "../../features/company/company-beta";
import { ChannelSidebar } from "../../features/company/channel-sidebar";
import { OrgSessionGroups } from "../../features/company/org-session-groups";
import { COMPANY_NAV_ICONS } from "../../features/company/company-nav-icons";
@@ -1806,7 +1806,7 @@ export function Sidebar({
{
value: "company" as const,
label: S.company.modeCompany,
- badge: { node: <BetaBadge />, name: S.company.beta },
+ badge: { node: <CompanyBetaBadge />, name: S.company.beta },
},
]}
value={company.workMode}
diff --git a/packages/web/src/components/ui/group-list.tsx b/packages/web/src/components/ui/group-list.tsx
index eac98bdd..fa3f1981 100644
--- a/packages/web/src/components/ui/group-list.tsx
+++ b/packages/web/src/components/ui/group-list.tsx
@@ -1,13 +1,10 @@
/**
- * Building blocks of the chat sidebar's grouped Session list — group header, collapsed
- * lazy folders, the reveal/collapse rows, the group pager. Extracted from sidebar.tsx's
- * inner closures, which is why the markup and classes here ARE the sidebar's and callers
- * pass the state those closures used to capture. The Trace page's directory tree used to
- * render the same structure from here; that page is gone, so this is now one surface's
- * vocabulary kept in one file rather than a contract between two.
+ * The app's side of the grouped Session list: the grouping modes and their glyphs, the stored
+ * grouping preference, what the header's "new" button creates in each mode, the list's line
+ * icon, and the group pager in the sidebar's words. The rows themselves — the group header, the
+ * lazy folder, the "more" row and the pager — are the shared UI package's.
*/
-import type { DragEvent as ReactDragEvent, ReactNode } from "react";
-import { Chevron, GlyphIcon, ICONS, ICON_SIZE } from "@prismshadow/penguin-ui";
+import { GlyphIcon, ICONS, ICON_SIZE, Pager } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
import type { SessionSortMode } from "../../lib/session-order";
@@ -73,57 +70,10 @@ export function storeGroupMode(mode: GroupMode): void {
localStorage.setItem(GROUP_MODE_KEY, mode);
}
-/** Row class of folder toggles and "More" rows (the sidebar's folderClass). */
-export const FOLDER_ROW_CLASS =
- "flex w-full items-center gap-1 rounded px-1.5 py-1 text-left text-[11px] font-medium text-gray-400 transition-colors duration-150 hover:bg-gray-200/50 dark:text-gray-500 dark:hover:bg-gray-800/50";
-
/**
- * "More"-style row (a group's load-next-page, a folder's paging, the reveal-more-groups
- * cap): folder-row styling with the chevron column left blank. While `pending` the row
- * disables and reads the shared loading label.
- */
-export function MoreRow({
- label,
- ariaLabel,
- pending = false,
- onClick,
- className,
-}: {
- label: string;
- /**
- * Accessible name, when the row's own wording is not the shared "More" — a name that
- * contradicted the visible text would announce a different row than the one on screen.
- * Defaults to the shared label, which is what the count-carrying rows announce.
- */
- ariaLabel?: string;
- /** A fetch is in flight: disable and show the loading label. */
- pending?: boolean;
- onClick: () => void;
- /** Extra spacing classes (the active list's row adds mt-0.5, the groups row mt-1). */
- className?: string;
-}) {
- return (
- <button
- type="button"
- aria-label={ariaLabel ?? S.chat.loadMore}
- disabled={pending}
- onClick={onClick}
- className={`${FOLDER_ROW_CLASS}${className ? ` ${className}` : ""} disabled:opacity-60`}
- >
- <span className="w-3" aria-hidden />
- {pending ? S.common.loading : label}
- </button>
- );
-}
-
-/**
- * Page stepper of a grouped list whose groups are paginated (the sidebar renders at most
- * SIDEBAR_GROUP_PAGE_SIZE groups per page): two flat chevron buttons around the "2/5"
- * position readout, no wider than the rows it sits under — this list is a drawer at phone
- * width. `page` is 0-based; the readout and the accessible names count from 1.
- *
- * Rendered only by callers that already know there is more than one page; the buttons
- * still disable at the ends so the control never offers a step that goes nowhere.
+ * The pager under the sidebar's grouped list (it renders at most SIDEBAR_GROUP_PAGE_SIZE groups
+ * per page): the package's compact `Pager`, in words that say it steps through groups rather than
+ * pages of rows. Rendered only by callers that already know there is more than one page.
*/
export function GroupPager({
page,
@@ -133,218 +83,16 @@ export function GroupPager({
page: number;
pageCount: number;
onChange: (page: number) => void;
-}) {
- const step = (delta: number) => {
- const next = page + delta;
- if (next >= 0 && next < pageCount) onChange(next);
- };
- const buttonClass =
- "flex h-6 w-6 shrink-0 items-center justify-center rounded text-gray-400 transition-colors duration-150 hover:bg-gray-200/50 hover:text-gray-700 disabled:pointer-events-none disabled:opacity-40 dark:text-gray-500 dark:hover:bg-gray-800/50 dark:hover:text-gray-300";
- return (
- <div className="mt-1 flex items-center justify-center gap-1.5 px-1.5 py-0.5">
- <button
- type="button"
- data-tooltip={S.chat.prevGroupPage}
- aria-label={S.chat.prevGroupPage}
- disabled={page <= 0}
- onClick={() => step(-1)}
- className={buttonClass}
- >
- <Icon d={ICONS.chevronLeft} size={12} />
- </button>
- {/* The position doubles as the control's status: announced on change so a step is
- audible without counting the rows that swapped underneath it. */}
- <span
- aria-live="polite"
- aria-label={S.chat.groupPagePosition(page + 1, pageCount)}
- className="min-w-[2.5rem] text-center text-[11px] font-medium tabular-nums text-gray-400 dark:text-gray-500"
- >
- {page + 1}/{pageCount}
- </span>
- <button
- type="button"
- data-tooltip={S.chat.nextGroupPage}
- aria-label={S.chat.nextGroupPage}
- disabled={page >= pageCount - 1}
- onClick={() => step(1)}
- className={buttonClass}
- >
- <Icon d={ICONS.chevronRight} size={12} />
- </button>
- </div>
- );
-}
-
-/**
- * Collapsed-by-default lazy folder (subagent / scheduled / archived): the toggle row
- * shows the label (typically with the group's exact server share), the body renders only
- * while open, and an optional "More" row reveals and pages the folder independently. The
- * "show less" row below it folds the folder back to its first page; the two can stand at
- * once, since a folder revealed part-way still has rows to show AND rows to fold away.
- */
-export function FolderSection({
- label,
- open,
- onToggle,
- action,
- more = false,
- moreLabel,
- pending = false,
- onMore,
- less = false,
- onLess,
- children,
-}: {
- label: string;
- open: boolean;
- onToggle: () => void;
- /**
- * A flat action at the right end of the folder's row, outside its toggle, so a click on it
- * never folds the folder (the company sidebar's Temporary "Close all").
- */
- action?: ReactNode;
- /** Show the folder's own "More" row (its share isn't fully loaded and somewhere is left to fetch from). */
- more?: boolean;
- /**
- * Wording of that row, when the caller can count what is still hidden in THIS folder
- * ("Show 7 more chats"). Defaults to the bare shared "More" — the honest label where
- * the caller has no per-folder remainder to name.
- */
- moreLabel?: string;
- /** The folder's "More" fetch in flight. */
- pending?: boolean;
- onMore?: () => void;
- /** Show the folder's "show less" row (it is revealed past its first page and has rows to fold away). */
- less?: boolean;
- onLess?: () => void;
- children?: ReactNode;
-}) {
- const toggle = (
- <button
- type="button"
- onClick={onToggle}
- className={action === undefined ? FOLDER_ROW_CLASS : `${FOLDER_ROW_CLASS} min-w-0 flex-1`}
- >
- <Chevron open={open} size={12} />
- {label}
- </button>
- );
- return (
- <div className="mt-1">
- {action === undefined ? (
- toggle
- ) : (
- <div className="flex items-center gap-1">
- {toggle}
- {action}
- </div>
- )}
- {open && children}
- {open && more && (
- <MoreRow
- label={moreLabel ?? S.chat.loadMore}
- {...(moreLabel !== undefined ? { ariaLabel: moreLabel } : {})}
- pending={pending}
- onClick={() => onMore?.()}
- />
- )}
- {open && less && (
- <MoreRow label={S.chat.showLess} ariaLabel={S.chat.showLess} onClick={() => onLess?.()} />
- )}
- </div>
- );
-}
-
-/**
- * Group header row: the collapse toggle (leading icon + label + optional count +
- * chevron) stretching across, with optional action buttons trailing outside it. The
- * toggle's hover pill spans the full row height set by any h-7 actions (self-stretch —
- * see the sidebar's header comments for where this first bit).
- *
- * The header doubles as the drag handle when the caller makes it draggable (the
- * sidebar's manual group order). The handle is the header rather than the whole group
- * block so that the Session rows inside keep their own row-level drag, and it is the
- * element itself rather than an added grip button so the row costs no extra width —
- * this list is a drawer at phone width and already carries up to three actions.
- */
-export function GroupHeader({
- open,
- onToggle,
- icon,
- label,
- uppercase = false,
- muted = false,
- count,
- title,
- actions,
- draggable = false,
- onDragStart,
- onDragEnd,
- onDragOver,
- onDragLeave,
- onDrop,
-}: {
- open: boolean;
- onToggle: () => void;
- /** Leading visual (Agent avatar / folder icon), sized by the caller. */
- icon: ReactNode;
- label: string;
- /** Agent names render uppercase-tracked (sidebar convention); a directory basename's casing is meaningful, so workspace groups don't. */
- uppercase?: boolean;
- /** Dim the label one step (folder-only groups: nothing active of their own); the count keeps its own class. */
- muted?: boolean;
- /** Optional trailing count (workspace groups: the group's active total). */
- count?: number;
- /** Optional tooltip (workspace groups: the full path). */
- title?: string;
- /** Trailing header actions (pin / new chat / settings / import). */
- actions?: ReactNode;
- /** Manual group order: the header acts as the drag handle (the caller wires the handlers below). */
- draggable?: boolean;
- onDragStart?: (e: ReactDragEvent) => void;
- onDragEnd?: () => void;
- onDragOver?: (e: ReactDragEvent) => void;
- onDragLeave?: (e: ReactDragEvent) => void;
- onDrop?: (e: ReactDragEvent) => void;
}) {
return (
- <div
- // cursor-grab while the header is a handle — the SessionRow treatment one axis up.
- // Groups have no sort toggle by design, so the cursor is the only thing on screen
- // that says this row can be dragged at all.
- // min-w-0: the row never asks for more than its column; the title button is the part
- // that gives way (it truncates), the actions after it keep their size.
- className={`group/header flex min-w-0 items-center gap-0.5 px-1 pb-0.5${
- draggable ? " cursor-grab" : ""
- }`}
- {...(draggable
- ? { draggable: true, onDragStart, onDragEnd, onDragOver, onDragLeave, onDrop }
- : {})}
- >
- <button
- type="button"
- onClick={onToggle}
- aria-expanded={open}
- aria-label={open ? S.nav.collapseGroup : S.nav.expandGroup}
- {...(title !== undefined ? { "data-tooltip": title } : {})}
- className="flex min-w-0 flex-1 items-center gap-1 self-stretch rounded px-1 py-0.5 text-left transition-colors duration-150 hover:bg-gray-200/50 dark:hover:bg-gray-800/50"
- >
- {icon}
- <span
- className={`min-w-0 truncate text-xs font-semibold ${
- uppercase ? "uppercase tracking-wide " : ""
- }${muted ? "text-gray-400 dark:text-gray-500" : "text-gray-500 dark:text-gray-400"}`}
- >
- {label}
- </span>
- {count !== undefined && (
- <span className="shrink-0 text-[11px] text-gray-400 dark:text-gray-500">{count}</span>
- )}
- {/* Expand/collapse indicator sits right after the label */}
- <Chevron open={open} size={12} className="text-gray-400" />
- <span className="min-w-0 flex-1" />
- </button>
- {actions}
- </div>
+ <Pager
+ page={page}
+ pageCount={pageCount}
+ onChange={onChange}
+ previousLabel={S.chat.prevGroupPage}
+ nextLabel={S.chat.nextGroupPage}
+ readoutLabel={S.chat.groupPagePosition(page + 1, pageCount)}
+ className="mt-1"
+ />
);
}
diff --git a/packages/web/src/components/ui/todo-notice.tsx b/packages/web/src/components/ui/todo-notice.tsx
deleted file mode 100644
index 6796d6f5..00000000
--- a/packages/web/src/components/ui/todo-notice.tsx
+++ /dev/null
@@ -1,107 +0,0 @@
-/**
- * The last stop on each of the four DISMISSIBLE trails: one notice directly under the page
- * title saying what is waiting, the control that acts on all of it at once, and the control
- * that puts the dot down.
- *
- * It exists because those trails, unlike the software one, can end in a decision NOT to act — a
- * model table kept off the catalog, an Agent left on the generation it was tuned against, an
- * error read and understood — and a dot with no way down is a dot that stops meaning anything.
- * What the trail was already saying in every tooltip above is repeated here, so arriving
- * confirms rather than re-explains.
- *
- * **One shape on all four pages**, owner-specified: same block, same place, directly below the
- * `<h1>`. The Skills library, the model library and the cost center were three different shapes
- * before, and a reader who had learned one had learned nothing about the next.
- *
- * `attention` is the tone by its own definition — "unfinished: waiting on time, a queue, or the
- * user" is exactly what all four trails are — and `NoticeStrip` is the shape by its own, the
- * bordered notice that owns a row. Its pale amber ground is the block's requested pale yellow,
- * arrived at through the token rather than around it. Not
- * `danger`, which means failed, destructive or over a limit: a Skill with a newer copy in the
- * library is none of those, and repainting a failure strip this colour to match would lose the
- * one distinction the tones exist to carry.
- *
- * The 6px red dot stays INSIDE the block, in the same fill it carried down the trail
- * (`update-dot.tsx`), so the notice reads as "this is that dot": red is the trail's identity
- * and amber is the notice's shape. It is decorative — the sentence beside it is the carrier,
- * and each button folds that sentence into its own accessible name, keeping its visible label
- * as the prefix.
- *
- * **The bulk action is optional, and its absence is meaningful.** Three pages can act on
- * everything the notice counts, and pass `actionLabel`; the cost center cannot — there is no
- * "update" for an error that has already happened — so it passes none and the block renders the
- * single button it always had. A page that offers the action must confirm before it runs
- * (`onAction` is expected to open a dialog, not to write): the point of the button is that it
- * overwrites many objects in one press, and every one of these pages already warns before
- * overwriting a single one.
- *
- * The top margin is built in rather than left to the caller: four pages place this and all four
- * want the same gap under their title. A page whose container spaces its children (the cost
- * center's `space-y-4`) overrides it, which is the right answer there too.
- */
-import { Button, ICON_GAP, NoticeStrip, UPDATE_DOT_INLINE } from "@prismshadow/penguin-ui";
-
-export function TodoNotice({
- text,
- actionLabel,
- onAction,
- busy = false,
- dismissLabel,
- onDismiss,
-}: {
- /** What is waiting — the trail's own sentence, unchanged from the dot's tooltip. */
- text: string;
- /**
- * The bulk action's wording, on the pages that have one. Omitted on the cost center, where
- * nothing is being updated; the block then shows the dismiss control alone.
- */
- actionLabel?: string;
- /**
- * Opens the page's confirmation for updating everything the notice counts. Not the write
- * itself: a bulk overwrite is consented to before it runs, never after.
- */
- onAction?: () => void;
- /** Disables both controls while the confirmed batch is in flight. */
- busy?: boolean;
- /** The clearing action's wording; "mark as read" where nothing is being updated. */
- dismissLabel: string;
- onDismiss: () => void;
-}) {
- const offersAction = actionLabel !== undefined && onAction !== undefined;
- return (
- <NoticeStrip
- tone="attention"
- className="mt-3 flex items-center justify-between gap-4 rounded-lg border px-4 py-3"
- >
- <p className={`flex min-w-0 items-center text-xs ${ICON_GAP.menu}`}>
- <span aria-hidden data-slot="icon" className={`shrink-0 ${UPDATE_DOT_INLINE}`} />
- <span className="min-w-0">{text}</span>
- </p>
- {/* The update sits to the RIGHT of the dismiss, which is where every ConfirmModal in the
- app puts its confirm and where the dialog this button opens will put it a moment later.
- Ordering the pair the other way would place the affirmative action in the slot the
- whole app uses for Cancel. */}
- <div className="flex shrink-0 items-center gap-2">
- <Button
- size="sm"
- disabled={busy}
- aria-label={`${dismissLabel} · ${text}`}
- onClick={onDismiss}
- >
- {dismissLabel}
- </Button>
- {offersAction && (
- <Button
- size="sm"
- variant="primary"
- disabled={busy}
- aria-label={`${actionLabel} · ${text}`}
- onClick={onAction}
- >
- {actionLabel}
- </Button>
- )}
- </div>
- </NoticeStrip>
- );
-}
diff --git a/packages/web/src/features/agents/agent-settings-page.tsx b/packages/web/src/features/agents/agent-settings-page.tsx
index 18ce8d4b..d5f7f12b 100644
--- a/packages/web/src/features/agents/agent-settings-page.tsx
+++ b/packages/web/src/features/agents/agent-settings-page.tsx
@@ -24,17 +24,26 @@ import type {
import type { ToolDefinitionConfig, ToolPermission } from "@prismshadow/penguin-core/interfaces";
import {
Button,
+ Card,
ConfirmModal,
CopyButton,
GlyphIcon,
HiddenFileInput,
ICONS,
- ICON_SIZE,
InfoPopover,
Input,
OptionMenu,
+ PageFrame,
+ PageHeader,
Skeleton,
Switch,
+ Table,
+ TableBody,
+ TableCell,
+ TableHead,
+ TableHeaderCell,
+ TableRow,
+ Tabs,
Textarea,
UpdateDot,
toastError,
@@ -48,7 +57,6 @@ import { S } from "../../lib/strings";
import { apiErrorText } from "../../lib/api-error";
import { useDocumentTitle } from "../../lib/use-document-title";
import { useProject } from "../../state/project";
-import { Tabs } from "../../components/ui/tabs";
import { useSaveConfirm } from "./save-confirm";
import { SkillsTab } from "./skills-tab";
import { HooksTab } from "./hooks-tab";
@@ -261,61 +269,53 @@ export function AgentSettingsPage() {
return (
/* relative: a scroller is its own containing block (see the invariant in styles.css) —
this page's snapshot-import control used to grow the document from below the fold. */
- <div className="no-scrollbar relative h-full overflow-y-auto p-4 md:p-6">
- <div className="mx-auto max-w-3xl">
- <Button
- variant="ghost"
- size="sm"
- onClick={() => navigate("/agents")}
- className="-ml-2 mb-3 text-gray-500 dark:text-gray-400"
- >
- <GlyphIcon d={ICONS.arrowLeft} size={ICON_SIZE.rowLead} />
- {S.agent.backToList}
- </Button>
- <h1 className="mb-1 text-xl font-semibold">{data.config.name ?? agentId}</h1>
- <p className="mb-4 font-mono text-xs text-gray-400">{agentId}</p>
- {/* The kernel update action lives in the Overview tab's Kernel section, so the trail
- from the Agents list has to cross the tab strip to reach it. */}
- <Tabs
- items={TABS.map((t) =>
- t.key === "overview" && data.config.kernelOutdated
- ? { ...t, badge: S.agent.kernelOutdatedHint }
- : t,
- )}
- active={tab}
- onChange={switchTab}
- />
- <div className="py-4">
- {tab === "overview" && (
- <OverviewTab
- data={data}
- agentId={agentId}
- onSave={save}
- onImported={onImported}
- onConfigReset={onConfigReset}
- onKernelUpdated={onKernelUpdated}
- />
- )}
- {tab === "prompt" && <PromptTab data={data} onSave={save} />}
- {tab === "memory" && <MemoryTab agentId={agentId} onConfigChanged={refreshConfig} />}
- {tab === "runtime" && <RuntimeTab data={data} onSave={save} />}
- {tab === "tools" && (
- <div className="space-y-8">
- <ToolsTab data={data} onSave={save} />
- {/* MCP Servers persist vault-style (immediately, own modals) — separate from the
- builtin table's Save button, so it lives beside ToolsTab, not inside it. */}
- <McpServersSection agentId={agentId} initial={data.config.mcpServers} />
- </div>
- )}
- {tab === "skills" && <SkillsTab agentId={agentId} onConfigChanged={refreshConfig} />}
- {tab === "hooks" && <HooksTab agentId={agentId} onConfigChanged={refreshConfig} />}
- {tab === "vault" && <VaultTab agentId={agentId} onConfigChanged={refreshConfig} />}
- {tab === "schedules" && (
- <SchedulesTab agentId={agentId} onConfigChanged={refreshConfig} />
- )}
- </div>
+ <PageFrame width="sm" className="no-scrollbar relative">
+ <PageHeader
+ title={data.config.name ?? agentId}
+ back={{ label: S.agent.backToList, onClick: () => navigate("/agents") }}
+ // The id is data: mono on the small rung. A block keeps its line box at its own
+ // 16px rather than the description line's body height.
+ description={<span className="block font-mono text-xs text-gray-400">{agentId}</span>}
+ />
+ {/* The kernel update action lives in the Overview tab's Kernel section, so the trail
+ from the Agents list has to cross the tab strip to reach it. */}
+ <Tabs
+ items={TABS.map((t) =>
+ t.key === "overview" && data.config.kernelOutdated
+ ? { ...t, badge: S.agent.kernelOutdatedHint }
+ : t,
+ )}
+ active={tab}
+ onChange={switchTab}
+ />
+ <div className="py-4">
+ {tab === "overview" && (
+ <OverviewTab
+ data={data}
+ agentId={agentId}
+ onSave={save}
+ onImported={onImported}
+ onConfigReset={onConfigReset}
+ onKernelUpdated={onKernelUpdated}
+ />
+ )}
+ {tab === "prompt" && <PromptTab data={data} onSave={save} />}
+ {tab === "memory" && <MemoryTab agentId={agentId} onConfigChanged={refreshConfig} />}
+ {tab === "runtime" && <RuntimeTab data={data} onSave={save} />}
+ {tab === "tools" && (
+ <div className="space-y-6">
+ <ToolsTab data={data} onSave={save} />
+ {/* MCP Servers persist vault-style (immediately, own modals) — separate from the
+ builtin table's Save button, so it lives beside ToolsTab, not inside it. */}
+ <McpServersSection agentId={agentId} initial={data.config.mcpServers} />
+ </div>
+ )}
+ {tab === "skills" && <SkillsTab agentId={agentId} onConfigChanged={refreshConfig} />}
+ {tab === "hooks" && <HooksTab agentId={agentId} onConfigChanged={refreshConfig} />}
+ {tab === "vault" && <VaultTab agentId={agentId} onConfigChanged={refreshConfig} />}
+ {tab === "schedules" && <SchedulesTab agentId={agentId} onConfigChanged={refreshConfig} />}
</div>
- </div>
+ </PageFrame>
);
}
@@ -486,7 +486,7 @@ function OverviewTab({
)}
</div>
</div>
- <div className="mt-3 space-y-2.5">
+ <div className="mt-3 space-y-3">
<div>
<p className="text-xs font-medium text-gray-500 dark:text-gray-400">
{S.agent.stateVersion}
@@ -564,7 +564,7 @@ function OverviewTab({
</Button>
</div>
</div>
- <p className="mt-2.5 flex flex-wrap items-baseline gap-x-1.5 gap-y-0.5 text-sm">
+ <p className="mt-2.5 flex flex-wrap items-baseline gap-x-1.5 gap-y-1 text-sm">
{data.config.kernelOutdated ? (
<>
<span className="text-xs text-gray-500 dark:text-gray-400">
@@ -825,7 +825,7 @@ function RuntimeTab({ data, onSave }: { data: AgentConfigResponse; onSave: SaveF
return (
<div className="space-y-4">
- <div className="overflow-hidden rounded-md border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-900">
+ <Card padding="none">
<div className="p-3">
<div className="grid grid-cols-1 gap-3 md:grid-cols-2">
<Input
@@ -924,7 +924,7 @@ function RuntimeTab({ data, onSave }: { data: AgentConfigResponse; onSave: SaveF
onChange={(e) => setPrompt(e.target.value)}
/>
</div>
- </div>
+ </Card>
<Button size="sm" variant="primary" onClick={submit}>
{S.common.save}
@@ -1046,77 +1046,73 @@ function ToolsTab({ data, onSave }: { data: AgentConfigResponse; onSave: SaveFn
return (
<div className="space-y-4">
- <div className="overflow-x-auto overflow-y-clip rounded-md border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-900">
- <table className="w-full min-w-[640px] text-left text-sm">
- <thead>
- <tr className="border-b border-gray-200 bg-gray-50/80 text-xs text-gray-500 dark:border-gray-800 dark:bg-gray-900">
- <th className="px-3 py-2">{S.common.name}</th>
- <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">
- <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>
- {rows.map((row, i) => (
- <tr key={row.base.name} className="border-b border-gray-100 dark:border-gray-800/60">
- <td className="px-3 py-2 align-top font-mono text-xs">{row.base.name}</td>
- <td className="px-3 py-2 align-top">
- <OptionMenu
- mono
- size="sm"
- aria-label={S.agent.toolPermission}
- placeholder={S.agent.defaultValue}
- options={permissionOptions}
- value={row.base.permission}
- onChange={(v) => update(i, { base: { ...row.base, permission: v } })}
- />
- </td>
- <td className="px-3 py-2 align-top">
- <Input
- size="sm"
- value={row.timeoutMs}
- error={fieldErrors[`${i}-timeoutMs`]}
- inputMode="numeric"
- className="font-mono"
- onChange={(e) => update(i, { timeoutMs: e.target.value })}
- />
- </td>
- <td className="px-3 py-2 align-top">
- <Input
- size="sm"
- value={row.maxOutputLength}
- error={fieldErrors[`${i}-maxOutputLength`]}
- inputMode="numeric"
- className="font-mono"
- onChange={(e) => update(i, { maxOutputLength: e.target.value })}
+ <Table tableClassName="min-w-[640px]">
+ <TableHead>
+ <TableHeaderCell>{S.common.name}</TableHeaderCell>
+ <TableHeaderCell>{S.agent.toolPermission}</TableHeaderCell>
+ <TableHeaderCell>{S.agent.toolTimeout}</TableHeaderCell>
+ <TableHeaderCell>{S.agent.toolMaxOutput}</TableHeaderCell>
+ <TableHeaderCell>
+ <span className="flex items-center gap-1.5">
+ {S.agent.toolCallDescription}
+ <InfoPopover label={S.agent.toolCallDescription}>
+ {S.agent.callDescriptionHint}
+ </InfoPopover>
+ </span>
+ </TableHeaderCell>
+ </TableHead>
+ <TableBody>
+ {rows.map((row, i) => (
+ <TableRow key={row.base.name}>
+ <TableCell className="align-top font-mono text-xs">{row.base.name}</TableCell>
+ <TableCell className="align-top">
+ <OptionMenu
+ mono
+ size="sm"
+ aria-label={S.agent.toolPermission}
+ placeholder={S.agent.defaultValue}
+ options={permissionOptions}
+ value={row.base.permission}
+ onChange={(v) => update(i, { base: { ...row.base, permission: v } })}
+ />
+ </TableCell>
+ <TableCell className="align-top">
+ <Input
+ size="sm"
+ value={row.timeoutMs}
+ error={fieldErrors[`${i}-timeoutMs`]}
+ inputMode="numeric"
+ className="font-mono"
+ onChange={(e) => update(i, { timeoutMs: e.target.value })}
+ />
+ </TableCell>
+ <TableCell className="align-top">
+ <Input
+ size="sm"
+ value={row.maxOutputLength}
+ error={fieldErrors[`${i}-maxOutputLength`]}
+ inputMode="numeric"
+ className="font-mono"
+ onChange={(e) => update(i, { maxOutputLength: e.target.value })}
+ />
+ </TableCell>
+ <TableCell className="align-top">
+ {/* Per-tool call_description switch (missing = on): shown only for tools whose
+ config schema actually declares the description argument. */}
+ {hasDescriptionProperty(row.base) ? (
+ <Switch
+ checked={row.base.call_description !== false}
+ onChange={(v) => update(i, { base: { ...row.base, call_description: v } })}
+ aria-label={`${row.base.name} ${S.agent.toolCallDescription}`}
/>
- </td>
- <td className="px-3 py-2 align-top">
- {/* Per-tool call_description switch (missing = on): shown only for tools whose
- config schema actually declares the description argument. */}
- {hasDescriptionProperty(row.base) ? (
- <Switch
- checked={row.base.call_description !== false}
- onChange={(v) => update(i, { base: { ...row.base, call_description: v } })}
- aria-label={`${row.base.name} ${S.agent.toolCallDescription}`}
- />
- ) : (
- <span className="text-xs text-gray-300 dark:text-gray-600">—</span>
- )}
- </td>
- </tr>
- ))}
- </tbody>
- </table>
- </div>
+ ) : (
+ <span className="text-xs text-gray-300 dark:text-gray-600">—</span>
+ )}
+ </TableCell>
+ </TableRow>
+ ))}
+ </TableBody>
+ </Table>
<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 e859f313..c83fd566 100644
--- a/packages/web/src/features/agents/agents-page.tsx
+++ b/packages/web/src/features/agents/agents-page.tsx
@@ -30,6 +30,7 @@ import {
AgentAvatar,
Badge,
Button,
+ Card,
CloseIcon,
ConfirmModal,
EmptyState,
@@ -43,9 +44,12 @@ import {
ICON_SIZE,
Input,
Modal,
+ PageFrame,
+ PageHeader,
Skeleton,
SkeletonCard,
Textarea,
+ TodoNotice,
UpdatePill,
toastError,
toastSuccess,
@@ -62,7 +66,6 @@ import { bulkOutcome, failedList, firstFailure, noticeCounts } from "../../lib/b
import { useAuth } from "../../state/auth";
import { useLocale } from "../../state/locale";
import { agentDisplayName, useProject } from "../../state/project";
-import { TodoNotice } from "../../components/ui/todo-notice";
import { SemanticIdField } from "../semantic-id/semantic-id-field";
import { STAT_ICONS } from "../../lib/stat-icons";
import { DRAFT_SESSION_ID } from "../chat/chat-page";
@@ -78,7 +81,8 @@ import { WorkspaceSelect } from "../chat/workspace-select";
import { SkillPickList } from "../skills/skill-pick-list";
import type { PickableItem } from "../skills/skill-pick-list";
import { addSkillNames, removeSkillNames, toggleSkillName } from "../skills/skill-selection";
-import { AiCreateModal, CreateButtons } from "../ai-create";
+import { AiCreateModal } from "../ai-create";
+import { AiCreateButtons } from "../ai-create/ai-create-buttons";
import { mergeAgents } from "../../lib/benchmark-merge";
import type { AgentSource } from "../../lib/benchmark-merge";
import { useSessions } from "../../state/sessions";
@@ -476,318 +480,310 @@ export function AgentsPage() {
};
return (
- <div className="h-full overflow-y-auto p-4 md:p-6">
- <div className="mx-auto max-w-5xl">
- {/* The title row and the notice under it share one block, so the gap below the block
- (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 flex-wrap items-center justify-between gap-2">
- <h1 className="ui-display text-xl font-semibold">{S.agent.listTitle}</h1>
- {/* Search plus the create pair, 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 — CreateButtons defaults
- to it — so the buttons read at the size of the box beside them. */}
- <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>
- <CreateButtons onAi={() => setAiOpen(true)} onManual={openCreate} />
+ <PageFrame>
+ {/* The title row and the notice under it share one header block, so the gap below it (to
+ the list) is the same whether or not the notice is showing — the models page's header
+ has the same shape. Search plus the create pair sit at the end of the title row: on a
+ narrow screen they wrap onto their own line and the box shrinks with it, fixed width
+ from sm up. Both controls take the form rung — CreateButtons defaults to it — so the
+ buttons read at the size of the box beside them. */}
+ <PageHeader
+ title={S.agent.listTitle}
+ actions={
+ <>
+ <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>
- </div>
+ <AiCreateButtons onAi={() => setAiOpen(true)} onManual={openCreate} />
+ </>
+ }
+ >
+ {/* Last stop on the kernel trail, in the one shape all four dismissible trails use.
+ An Agent's kernel is never NEW — the Agent already exists and its config is simply
+ behind the defaults generation — so the line states the upgradable count alone
+ rather than padding it with a zero the page has no meaning for. The per-card capsule
+ below and the per-Agent update in settings are untouched. */}
+ {kernelTodo && (
+ <TodoNotice
+ text={S.todo.changesUpgradable(noticeCounts(kernelTodo).updated)}
+ actionLabel={S.todo.updateNow}
+ busy={kernelRunning}
+ onAction={() => setKernelConfirmOpen(true)}
+ dismissLabel={S.todo.dismiss}
+ onDismiss={() => dismissTodo(projectId ?? null, "agents", kernelTodo.signature)}
+ />
+ )}
+ </PageHeader>
- {/* Last stop on the kernel trail, in the one shape all four dismissible trails use.
- An Agent's kernel is never NEW — the Agent already exists and its config is simply
- behind the defaults generation — so the line states the upgradable count alone
- rather than padding it with a zero the page has no meaning for. The per-card capsule
- below and the per-Agent update in settings are untouched. */}
- {kernelTodo && (
- <TodoNotice
- text={S.todo.changesUpgradable(noticeCounts(kernelTodo).updated)}
- actionLabel={S.todo.updateNow}
- busy={kernelRunning}
- onAction={() => setKernelConfirmOpen(true)}
- dismissLabel={S.todo.dismiss}
- onDismiss={() => dismissTodo(projectId ?? null, "agents", kernelTodo.signature)}
- />
- )}
+ {agentsLoading ? (
+ /* Same single-column row styling as the real list (space-y-3 + the card's p-4), with a
+ three-line info column plus sparkline/button-group placeholders, so no layout shift
+ occurs once the skeleton disappears */
+ <div className="space-y-3">
+ {Array.from({ length: 4 }, (_, i) => (
+ <SkeletonCard key={i} className="flex flex-wrap items-center gap-x-6 gap-y-2 p-4">
+ <div className="min-w-[14rem] flex-1">
+ <Skeleton className="h-[18px] w-40" />
+ <Skeleton className="mt-1.5 h-4 w-2/3" />
+ <Skeleton className="mt-1.5 h-4 w-48" />
+ </div>
+ <Skeleton className="hidden h-9 w-40 md:block" />
+ <Skeleton className="h-8 w-52" />
+ </SkeletonCard>
+ ))}
</div>
-
- {agentsLoading ? (
- /* Same single-column row styling as the real list (space-y-3 + px-5 py-4), with a
- three-line info column plus sparkline/button-group placeholders, so no layout shift
- occurs once the skeleton disappears */
- <div className="space-y-3">
- {Array.from({ length: 4 }, (_, i) => (
- <SkeletonCard
- key={i}
- className="flex flex-wrap items-center gap-x-6 gap-y-2 px-5 py-4"
+ ) : 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">
+ {shownAgents.map(({ agent: a, machineIds: on }) => {
+ const builtin = BUILTIN_AGENT_IDS.has(a.agentId);
+ // An Agent this server does not have: everything below reads and writes its state
+ // directory, which is on the machine. Its name says where it is, its New chat opens
+ // there, and the rest is inert rather than answering 404 from here.
+ const machineName = on.includes(null) ? null : machineNameOf(on[0] ?? null);
+ const elsewhere = machineName !== null;
+ const elsewhereTitle = machineName === null ? "" : S.agent.livesOnMachine(machineName);
+ return (
+ <Card
+ key={a.agentId}
+ padding="md"
+ className="flex flex-wrap items-center gap-x-6 gap-y-2"
>
+ {/* Info column: once it can't fit within 14rem, everything after it
+ (sparkline/buttons) wraps as a whole. The avatar counts as the first line
+ (same line as the name); description/stats share the same left edge as the
+ avatar (the column's left edge) */}
<div className="min-w-[14rem] flex-1">
- <Skeleton className="h-[18px] w-40" />
- <Skeleton className="mt-1.5 h-4 w-2/3" />
- <Skeleton className="mt-1.5 h-4 w-48" />
- </div>
- <Skeleton className="hidden h-9 w-40 md:block" />
- <Skeleton className="h-8 w-52" />
- </SkeletonCard>
- ))}
- </div>
- ) : 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">
- {shownAgents.map(({ agent: a, machineIds: on }) => {
- const builtin = BUILTIN_AGENT_IDS.has(a.agentId);
- // An Agent this server does not have: everything below reads and writes its state
- // directory, which is on the machine. Its name says where it is, its New chat opens
- // there, and the rest is inert rather than answering 404 from here.
- const machineName = on.includes(null) ? null : machineNameOf(on[0] ?? null);
- const elsewhere = machineName !== null;
- const elsewhereTitle =
- machineName === null ? "" : S.agent.livesOnMachine(machineName);
- return (
- <div
- key={a.agentId}
- className="flex flex-wrap items-center gap-x-6 gap-y-2 rounded-md border border-gray-200 bg-white px-5 py-4 dark:border-gray-800 dark:bg-gray-900"
- >
- {/* Info column: once it can't fit within 14rem, everything after it
- (sparkline/buttons) wraps as a whole. The avatar counts as the first line
- (same line as the name); description/stats share the same left edge as the
- avatar (the column's left edge) */}
- <div className="min-w-[14rem] flex-1">
- {/* Title line: small avatar + name + agentId + version badge */}
- <div className="flex items-center gap-2">
- <AgentAvatar
- id={a.agentId}
- name={agentDisplayName(a)}
- size={18}
- className="shrink-0 rounded"
- />
- {/* min-w-0: flex children don't shrink below their content by default; needed here to truncate overly long names */}
- <span className="min-w-0 truncate text-base font-bold">
- {agentDisplayName(a)}
- </span>
- {machineName !== null && (
- <span
- className="shrink-0 font-mono text-xs normal-case text-gray-400 dark:text-gray-500"
- data-tooltip={elsewhereTitle}
- >
- {S.chat.machineTag(machineName)}
- </span>
- )}
- <span className="hidden shrink-0 font-mono text-xs text-gray-400 md:inline dark:text-gray-500">
- {a.agentId}
- </span>
- <Badge>v{a.version}</Badge>
- {/* Kernel-outdated pill: the card the sidebar's Agents dot leads to, so it
- names the state in words rather than as another bare dot — a capsule in
- the version badge's own geometry, tinted the same pale red the dots on
- this trail carry, opening the settings overview where the update action
- lives. */}
- {a.kernelOutdated && (
- <UpdatePill onClick={() => openSettingsTab(a.agentId, "overview")}>
- {S.agent.kernelUpdateNeeded}
- </UpdatePill>
- )}
- </div>
- {/* Description truncated to one line (an empty description still takes up a line, keeping card heights equal) */}
- <p className="mt-1.5 min-h-4 truncate text-xs text-gray-500 dark:text-gray-400">
- {a.description ?? ""}
- </p>
- {/* Stats on their own line: same color/font size as the description; each
- item hugs its content, with spacing left to the container's uniform
- gap-x-4; meaning folded into the hover title. Tool/skill/hook/memory/
- vault/schedule counts are buttons deep-linking to the matching settings tab,
- listed in the settings tabs' order (also for built-in Agents — their
- Settings entry point has no gating either); session count and
- last-modified stay plain text.
- flex-wrap is load-bearing: every item is shrink-0 (a count must not be
- cut in half) and the row has no scroll box, so with nowrap the seven
- items simply spill past the card's padding once the info column is
- narrower than they are — a phone. Wrapping spends a second line instead,
- and never triggers where the row already fits. */}
- <div className="mt-1.5 flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-gray-500 dark:text-gray-400">
+ {/* Title line: small avatar + name + agentId + version badge */}
+ <div className="flex items-center gap-2">
+ <AgentAvatar
+ id={a.agentId}
+ name={agentDisplayName(a)}
+ size={18}
+ className="shrink-0 rounded"
+ />
+ {/* min-w-0: flex children don't shrink below their content by default; needed here to truncate overly long names */}
+ <span className="min-w-0 truncate text-base font-bold">
+ {agentDisplayName(a)}
+ </span>
+ {machineName !== null && (
<span
- className="inline-flex shrink-0 items-center gap-1 tabular-nums"
- data-tooltip={S.agent.sessionCount(a.sessionCount)}
+ className="shrink-0 font-mono text-xs normal-case text-gray-400 dark:text-gray-500"
+ data-tooltip={elsewhereTitle}
>
- <GlyphIcon d={CARD_ICONS.sessions} size={ICON_SIZE.inlineGlyph} />
- {a.sessionCount}
+ {S.chat.machineTag(machineName)}
</span>
- <button
- type="button"
- className={STAT_LINK_CLASS}
- disabled={elsewhere}
- data-tooltip={S.agent.toolCount(a.toolCount)}
- aria-label={S.agent.toolCount(a.toolCount)}
- onClick={() => openSettingsTab(a.agentId, "tools")}
- >
- <GlyphIcon d={STAT_ICONS.toolCalls} size={ICON_SIZE.inlineGlyph} />
- {a.toolCount}
- </button>
- <button
- type="button"
- className={STAT_LINK_CLASS}
- disabled={elsewhere}
- data-tooltip={S.skills.skillCount(a.skillCount)}
- aria-label={S.skills.skillCount(a.skillCount)}
- onClick={() => openSettingsTab(a.agentId, "skills")}
- >
- <GlyphIcon d={CARD_ICONS.skills} size={ICON_SIZE.inlineGlyph} />
- {a.skillCount}
- </button>
- <button
- type="button"
- className={STAT_LINK_CLASS}
- disabled={elsewhere}
- data-tooltip={S.hooks.hookCount(a.hookCount)}
- aria-label={S.hooks.hookCount(a.hookCount)}
- onClick={() => openSettingsTab(a.agentId, "hooks")}
- >
- <GlyphIcon d={ICONS.fishHook} size={ICON_SIZE.inlineGlyph} />
- {a.hookCount}
- </button>
- <button
- type="button"
- className={STAT_LINK_CLASS}
- disabled={elsewhere}
- data-tooltip={S.agent.memoryCount(a.memoryCount)}
- aria-label={S.agent.memoryCount(a.memoryCount)}
- onClick={() => openSettingsTab(a.agentId, "memory")}
- >
- <GlyphIcon d={CARD_ICONS.memory} size={ICON_SIZE.inlineGlyph} />
- {a.memoryCount}
- </button>
- <button
- type="button"
- className={STAT_LINK_CLASS}
- disabled={elsewhere}
- data-tooltip={S.agent.vaultKeyCount(a.vaultKeyCount)}
- aria-label={S.agent.vaultKeyCount(a.vaultKeyCount)}
- onClick={() => openSettingsTab(a.agentId, "vault")}
- >
- <GlyphIcon d={CARD_ICONS.vaultKeys} size={ICON_SIZE.inlineGlyph} />
- {a.vaultKeyCount}
- </button>
- <button
- type="button"
- className={STAT_LINK_CLASS}
- disabled={elsewhere}
- data-tooltip={S.agent.scheduleCount(a.scheduleCount)}
- aria-label={S.agent.scheduleCount(a.scheduleCount)}
- onClick={() => openSettingsTab(a.agentId, "schedules")}
- >
- <GlyphIcon d={CARD_ICONS.schedules} size={ICON_SIZE.inlineGlyph} />
- {a.scheduleCount}
- </button>
- <span
- className="inline-flex shrink-0 items-center gap-1"
- data-tooltip={`${S.agent.updatedAt} ${a.updatedAt ? formatDateTime(a.updatedAt) : "—"}`}
- >
- <GlyphIcon d={STAT_ICONS.elapsed} size={ICON_SIZE.inlineGlyph} />
- {a.updatedAt ? formatRelativeDays(a.updatedAt, locale) : "—"}
- </span>
- </div>
+ )}
+ <span className="hidden shrink-0 font-mono text-xs text-gray-400 md:inline dark:text-gray-500">
+ {a.agentId}
+ </span>
+ <Badge>v{a.version}</Badge>
+ {/* Kernel-outdated pill: the card the sidebar's Agents dot leads to, so it
+ names the state in words rather than as another bare dot — a capsule in
+ the version badge's own geometry, tinted the same pale red the dots on
+ this trail carry, opening the settings overview where the update action
+ lives. */}
+ {a.kernelOutdated && (
+ <UpdatePill onClick={() => openSettingsTab(a.agentId, "overview")}>
+ {S.agent.kernelUpdateNeeded}
+ </UpdatePill>
+ )}
</div>
-
- {/* Session activity sparkline (hidden on narrow screens first, giving the horizontal space back to content and buttons) */}
- <ActivitySparkline
- data={a.sessionActivity}
- label={S.agent.activity(a.sessionActivity.length || 30)}
- className="hidden shrink-0 md:block"
- />
-
- {/* Button group to the right of the sparkline: "New Chat" shows text, the rest are square icon buttons (tooltip shows the full name) */}
- <div className="flex shrink-0 items-center gap-2">
- <Button
- size="sm"
- variant="primary"
- onClick={() => newChat(a.agentId, on.includes(null) ? null : (on[0] ?? null))}
+ {/* Description truncated to one line (an empty description still takes up a line, keeping card heights equal) */}
+ <p className="mt-1.5 min-h-4 truncate text-xs text-gray-500 dark:text-gray-400">
+ {a.description ?? ""}
+ </p>
+ {/* Stats on their own line: same color/font size as the description; each
+ item hugs its content, with spacing left to the container's uniform
+ gap-x-4; meaning folded into the hover title. Tool/skill/hook/memory/
+ vault/schedule counts are buttons deep-linking to the matching settings tab,
+ listed in the settings tabs' order (also for built-in Agents — their
+ Settings entry point has no gating either); session count and
+ last-modified stay plain text.
+ flex-wrap is load-bearing: every item is shrink-0 (a count must not be
+ cut in half) and the row has no scroll box, so with nowrap the seven
+ items simply spill past the card's padding once the info column is
+ narrower than they are — a phone. Wrapping spends a second line instead,
+ and never triggers where the row already fits. */}
+ <div className="mt-1.5 flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-gray-500 dark:text-gray-400">
+ <span
+ className="inline-flex shrink-0 items-center gap-1 tabular-nums"
+ data-tooltip={S.agent.sessionCount(a.sessionCount)}
>
- <GlyphIcon d={CARD_ICONS.newChat} />
- {S.chat.newSessionMenu}
- </Button>
- <Button
- size="sm"
+ <GlyphIcon d={CARD_ICONS.sessions} size={ICON_SIZE.inlineGlyph} />
+ {a.sessionCount}
+ </span>
+ <button
+ type="button"
+ className={STAT_LINK_CLASS}
disabled={elsewhere}
- {...(elsewhere ? { title: elsewhereTitle } : {})}
- onClick={() => {
- setCurrentAgentId(a.agentId);
- navigate(`/agents/${a.agentId}`);
- }}
+ data-tooltip={S.agent.toolCount(a.toolCount)}
+ aria-label={S.agent.toolCount(a.toolCount)}
+ onClick={() => openSettingsTab(a.agentId, "tools")}
>
- <GlyphIcon d={ICONS.gear} />
- {S.common.settings}
- </Button>
+ <GlyphIcon d={STAT_ICONS.toolCalls} size={ICON_SIZE.inlineGlyph} />
+ {a.toolCount}
+ </button>
+ <button
+ type="button"
+ className={STAT_LINK_CLASS}
+ disabled={elsewhere}
+ data-tooltip={S.skills.skillCount(a.skillCount)}
+ aria-label={S.skills.skillCount(a.skillCount)}
+ onClick={() => openSettingsTab(a.agentId, "skills")}
+ >
+ <GlyphIcon d={CARD_ICONS.skills} size={ICON_SIZE.inlineGlyph} />
+ {a.skillCount}
+ </button>
+ <button
+ type="button"
+ className={STAT_LINK_CLASS}
+ disabled={elsewhere}
+ data-tooltip={S.hooks.hookCount(a.hookCount)}
+ aria-label={S.hooks.hookCount(a.hookCount)}
+ onClick={() => openSettingsTab(a.agentId, "hooks")}
+ >
+ <GlyphIcon d={ICONS.fishHook} size={ICON_SIZE.inlineGlyph} />
+ {a.hookCount}
+ </button>
+ <button
+ type="button"
+ className={STAT_LINK_CLASS}
+ disabled={elsewhere}
+ data-tooltip={S.agent.memoryCount(a.memoryCount)}
+ aria-label={S.agent.memoryCount(a.memoryCount)}
+ onClick={() => openSettingsTab(a.agentId, "memory")}
+ >
+ <GlyphIcon d={CARD_ICONS.memory} size={ICON_SIZE.inlineGlyph} />
+ {a.memoryCount}
+ </button>
+ <button
+ type="button"
+ className={STAT_LINK_CLASS}
+ disabled={elsewhere}
+ data-tooltip={S.agent.vaultKeyCount(a.vaultKeyCount)}
+ aria-label={S.agent.vaultKeyCount(a.vaultKeyCount)}
+ onClick={() => openSettingsTab(a.agentId, "vault")}
+ >
+ <GlyphIcon d={CARD_ICONS.vaultKeys} size={ICON_SIZE.inlineGlyph} />
+ {a.vaultKeyCount}
+ </button>
+ <button
+ type="button"
+ className={STAT_LINK_CLASS}
+ disabled={elsewhere}
+ data-tooltip={S.agent.scheduleCount(a.scheduleCount)}
+ aria-label={S.agent.scheduleCount(a.scheduleCount)}
+ onClick={() => openSettingsTab(a.agentId, "schedules")}
+ >
+ <GlyphIcon d={CARD_ICONS.schedules} size={ICON_SIZE.inlineGlyph} />
+ {a.scheduleCount}
+ </button>
+ <span
+ className="inline-flex shrink-0 items-center gap-1"
+ data-tooltip={`${S.agent.updatedAt} ${a.updatedAt ? formatDateTime(a.updatedAt) : "—"}`}
+ >
+ <GlyphIcon d={STAT_ICONS.elapsed} size={ICON_SIZE.inlineGlyph} />
+ {a.updatedAt ? formatRelativeDays(a.updatedAt, locale) : "—"}
+ </span>
+ </div>
+ </div>
+
+ {/* Session activity sparkline (hidden on narrow screens first, giving the horizontal space back to content and buttons) */}
+ <ActivitySparkline
+ data={a.sessionActivity}
+ label={S.agent.activity(a.sessionActivity.length || 30)}
+ className="hidden shrink-0 md:block"
+ />
+
+ {/* Button group to the right of the sparkline: "New Chat" shows text, the rest are square icon buttons (tooltip shows the full name) */}
+ <div className="flex shrink-0 items-center gap-2">
+ <Button
+ size="sm"
+ variant="primary"
+ onClick={() => newChat(a.agentId, on.includes(null) ? null : (on[0] ?? null))}
+ >
+ <GlyphIcon d={CARD_ICONS.newChat} />
+ {S.chat.newSessionMenu}
+ </Button>
+ <Button
+ size="sm"
+ disabled={elsewhere}
+ {...(elsewhere ? { title: elsewhereTitle } : {})}
+ onClick={() => {
+ setCurrentAgentId(a.agentId);
+ navigate(`/agents/${a.agentId}`);
+ }}
+ >
+ <GlyphIcon d={ICONS.gear} />
+ {S.common.settings}
+ </Button>
+ <Button
+ size="icon"
+ title={elsewhere ? elsewhereTitle : S.nav.usage}
+ aria-label={S.nav.usage}
+ disabled={elsewhere}
+ onClick={() => navigate(`/usage?agentId=${encodeURIComponent(a.agentId)}`)}
+ >
+ <GlyphIcon
+ d={CARD_ICONS.usage}
+ size={15}
+ className="text-gray-600 dark:text-gray-300"
+ />
+ </Button>
+ {/* Built-in Agents can't be deleted: shown as a non-button light gray
+ placeholder (no border/background, no hover response, disabled cursor,
+ explained via tooltip); the transparent border keeps the same box size as
+ an icon button so column widths stay consistent across cards */}
+ {builtin ? (
+ <span
+ role="img"
+ data-tooltip={S.agent.builtinUndeletable}
+ aria-label={S.agent.builtinUndeletable}
+ className="inline-flex cursor-not-allowed items-center justify-center rounded-md border border-transparent p-1.5 text-gray-300 dark:text-gray-600"
+ >
+ <GlyphIcon d={CARD_ICONS.trash} size={15} />
+ </span>
+ ) : (
<Button
size="icon"
- title={elsewhere ? elsewhereTitle : S.nav.usage}
- aria-label={S.nav.usage}
+ variant="danger"
+ title={elsewhere ? elsewhereTitle : S.agent.deleteAgent}
+ aria-label={S.agent.deleteAgent}
disabled={elsewhere}
- onClick={() => navigate(`/usage?agentId=${encodeURIComponent(a.agentId)}`)}
+ onClick={() => setDeleting({ agentId: a.agentId, name: agentDisplayName(a) })}
>
- <GlyphIcon
- d={CARD_ICONS.usage}
- size={15}
- className="text-gray-600 dark:text-gray-300"
- />
+ <GlyphIcon d={CARD_ICONS.trash} size={15} />
</Button>
- {/* Built-in Agents can't be deleted: shown as a non-button light gray
- placeholder (no border/background, no hover response, disabled cursor,
- explained via tooltip); the transparent border keeps the same box size as
- an icon button so column widths stay consistent across cards */}
- {builtin ? (
- <span
- role="img"
- data-tooltip={S.agent.builtinUndeletable}
- aria-label={S.agent.builtinUndeletable}
- className="inline-flex cursor-not-allowed items-center justify-center rounded-md border border-transparent p-1.5 text-gray-300 dark:text-gray-600"
- >
- <GlyphIcon d={CARD_ICONS.trash} size={15} />
- </span>
- ) : (
- <Button
- size="icon"
- variant="danger"
- title={elsewhere ? elsewhereTitle : S.agent.deleteAgent}
- aria-label={S.agent.deleteAgent}
- disabled={elsewhere}
- onClick={() =>
- setDeleting({ agentId: a.agentId, name: agentDisplayName(a) })
- }
- >
- <GlyphIcon d={CARD_ICONS.trash} size={15} />
- </Button>
- )}
- </div>
+ )}
</div>
- );
- })}
- {/* Until the Project has an agent of its own, the list ends in the AI path's call to
- action: the built-in default is not one the user set up. Hidden while searching
- (the list itself is being filtered). */}
- {query.trim() === "" && agents.every((a) => BUILTIN_AGENT_IDS.has(a.agentId)) && (
- <EmptyState
- title={S.agent.firstAgentTitle}
- description={S.agent.firstAgentDesc}
- action={
- <CreateButtons size="sm" onAi={() => setAiOpen(true)} onManual={openCreate} />
- }
- />
- )}
- </div>
- )}
- </div>
+ </Card>
+ );
+ })}
+ {/* Until the Project has an agent of its own, the list ends in the AI path's call to
+ action: the built-in default is not one the user set up. Hidden while searching
+ (the list itself is being filtered). */}
+ {query.trim() === "" && agents.every((a) => BUILTIN_AGENT_IDS.has(a.agentId)) && (
+ <EmptyState
+ title={S.agent.firstAgentTitle}
+ description={S.agent.firstAgentDesc}
+ action={
+ <AiCreateButtons size="sm" onAi={() => setAiOpen(true)} onManual={openCreate} />
+ }
+ />
+ )}
+ </div>
+ )}
<Modal
open={createOpen}
@@ -1053,6 +1049,6 @@ export function AgentsPage() {
<p className="mt-2 text-xs text-red-600 dark:text-red-400">{deleteError}</p>
)}
</ConfirmModal>
- </div>
+ </PageFrame>
);
}
diff --git a/packages/web/src/features/agents/hooks-tab.tsx b/packages/web/src/features/agents/hooks-tab.tsx
index 3c3cb5e7..be87d620 100644
--- a/packages/web/src/features/agents/hooks-tab.tsx
+++ b/packages/web/src/features/agents/hooks-tab.tsx
@@ -25,6 +25,7 @@ import type { HookItem } from "@prismshadow/penguin-server/api";
import {
Badge,
Button,
+ Card,
ConfirmModal,
CopiedStatus,
CopyCheckGlyph,
@@ -254,7 +255,7 @@ export function HooksTab({
) : hooks.length === 0 ? (
<SettingsEmpty>{S.hooks.agentTabEmpty}</SettingsEmpty>
) : (
- <div className="overflow-hidden rounded-md border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-900">
+ <Card padding="none">
{hooks.map((hook) => {
const description = localizedText(locale, hook.description, hook.descriptionZh);
return (
@@ -274,7 +275,7 @@ export function HooksTab({
point names, wrapping onto a second line rather than truncating. */}
<div className="flex flex-wrap items-center gap-x-1.5 gap-y-1">
<span
- className="max-w-full truncate font-mono text-[13px] font-semibold"
+ className="max-w-full truncate font-mono text-[length:var(--ui-text-code-size)] font-semibold"
data-tooltip={hook.name}
data-tooltip-content="code"
>
@@ -295,7 +296,7 @@ export function HooksTab({
</div>
{hook.version !== "" && (
<span
- className="hidden shrink-0 text-[11px] text-gray-400 sm:block dark:text-gray-500"
+ className="hidden shrink-0 text-xs text-gray-400 sm:block dark:text-gray-500"
data-tooltip={hook.version}
>
{hook.version}
@@ -325,7 +326,7 @@ export function HooksTab({
</div>
);
})}
- </div>
+ </Card>
)}
{/* Import modal: recommended chat import on top, zip upload below (the Skills tab's shape). */}
@@ -341,7 +342,7 @@ export function HooksTab({
<p className="mt-0.5 text-xs text-gray-500 dark:text-gray-400">
{S.hooks.importChatWhy}
</p>
- <div className="mt-2.5 space-y-2.5">
+ <div className="mt-2.5 space-y-3">
{/* A source may be a whole pasted hooks config block, so the field is multi-line. */}
<Textarea
label={S.hooks.importSourceLabel}
diff --git a/packages/web/src/features/agents/mcp-servers-section.tsx b/packages/web/src/features/agents/mcp-servers-section.tsx
index 2aefd92e..87b01f5c 100644
--- a/packages/web/src/features/agents/mcp-servers-section.tsx
+++ b/packages/web/src/features/agents/mcp-servers-section.tsx
@@ -27,6 +27,12 @@ import {
OptionMenu,
Segmented,
SettingsEmpty,
+ Table,
+ TableBody,
+ TableCell,
+ TableHead,
+ TableHeaderCell,
+ TableRow,
Textarea,
toastError,
toastSuccess,
@@ -87,12 +93,12 @@ function TestBadge({ result }: { result: RowTestResult | undefined }) {
if (result === undefined) return null;
if (result === "pending") {
return (
- <span className="text-[11px] whitespace-nowrap text-gray-400">{S.agent.mcpTestPending}</span>
+ <span className="text-xs whitespace-nowrap text-gray-400">{S.agent.mcpTestPending}</span>
);
}
if (result.ok) {
return (
- <span className={`text-[11px] font-medium whitespace-nowrap ${toneInk.success}`}>
+ <span className={`text-xs font-medium whitespace-nowrap ${toneInk.success}`}>
{S.agent.mcpTestBadge(result.tools?.length ?? 0, result.latencyMs)}
</span>
);
@@ -100,7 +106,7 @@ function TestBadge({ result }: { result: RowTestResult | undefined }) {
return (
<span
data-tooltip={result.error}
- className={`text-[11px] font-medium whitespace-nowrap ${toneInk.danger}`}
+ className={`text-xs font-medium whitespace-nowrap ${toneInk.danger}`}
>
{S.agent.mcpTestBadgeFail}
</span>
@@ -308,73 +314,62 @@ export function McpServersSection({
{servers.length === 0 ? (
<SettingsEmpty>{S.agent.mcpEmpty}</SettingsEmpty>
) : (
- <div className="overflow-x-auto overflow-y-clip rounded-md border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-900">
- <table className="w-full min-w-[520px] text-left text-sm">
- <thead>
- <tr className="border-b border-gray-200 bg-gray-50/80 text-xs text-gray-500 dark:border-gray-800 dark:bg-gray-900">
- <th className="px-3 py-2.5">{S.agent.mcpName}</th>
- <th className="px-3 py-2.5">{S.agent.mcpTransport}</th>
- <th className="px-3 py-2.5">{S.agent.mcpPermission}</th>
- <th className="px-3 py-2.5">{S.agent.mcpTarget}</th>
- {/* Bulk-test badge column appears only once results exist (no headline). */}
- {showBadges && <th className="px-3 py-2.5" />}
- {/* Bulk test lives in the table's own header bar, over the actions column. */}
- <th className="px-3 py-1 text-right font-normal whitespace-nowrap">
+ <Table tableClassName="min-w-[520px]">
+ <TableHead>
+ <TableHeaderCell>{S.agent.mcpName}</TableHeaderCell>
+ <TableHeaderCell>{S.agent.mcpTransport}</TableHeaderCell>
+ <TableHeaderCell>{S.agent.mcpPermission}</TableHeaderCell>
+ <TableHeaderCell>{S.agent.mcpTarget}</TableHeaderCell>
+ {/* Bulk-test badge column appears only once results exist (no headline). */}
+ {showBadges && <TableHeaderCell />}
+ {/* Bulk test lives in the table's own header bar, over the actions column: a
+ tighter cell than a column name's, so the button does not heighten the bar. */}
+ <th scope="col" className="px-3 py-1 text-right font-normal whitespace-nowrap">
+ <Button
+ size="sm"
+ variant="ghost"
+ disabled={busy || testAllRunning}
+ onClick={() => setTestAllOpen(true)}
+ >
+ {testAllRunning ? S.agent.mcpTestPending : S.agent.mcpTest}
+ </Button>
+ </th>
+ </TableHead>
+ <TableBody>
+ {servers.map((entry, index) => (
+ <TableRow key={entry.name}>
+ <TableCell className="font-mono text-xs">{entry.name}</TableCell>
+ <TableCell className="font-mono text-xs text-gray-500 dark:text-gray-400">
+ {transportOf(entry)}
+ </TableCell>
+ <TableCell className="font-mono text-xs text-gray-500 dark:text-gray-400">
+ {permissionOf(entry)}
+ </TableCell>
+ <TableCell className="max-w-[360px] truncate font-mono text-xs text-gray-500 dark:text-gray-400">
+ {targetOf(entry)}
+ </TableCell>
+ {showBadges && (
+ <TableCell align="right">
+ <TestBadge result={rowResults.get(entry.name)} />
+ </TableCell>
+ )}
+ <TableCell align="right" nowrap>
+ <Button size="sm" variant="ghost" disabled={busy} onClick={() => openEdit(index)}>
+ {S.common.edit}
+ </Button>
<Button
size="sm"
variant="ghost"
- disabled={busy || testAllRunning}
- onClick={() => setTestAllOpen(true)}
+ disabled={busy}
+ onClick={() => setDeleting(index)}
>
- {testAllRunning ? S.agent.mcpTestPending : S.agent.mcpTest}
+ {S.agent.mcpRemove}
</Button>
- </th>
- </tr>
- </thead>
- <tbody>
- {servers.map((entry, index) => (
- <tr
- key={entry.name}
- className="border-b border-gray-100 transition-colors duration-150 last:border-b-0 hover:bg-gray-50 dark:border-gray-800/60 dark:hover:bg-gray-800/40"
- >
- <td className="px-3 py-2 font-mono text-xs">{entry.name}</td>
- <td className="px-3 py-2 font-mono text-xs text-gray-500 dark:text-gray-400">
- {transportOf(entry)}
- </td>
- <td className="px-3 py-2 font-mono text-xs text-gray-500 dark:text-gray-400">
- {permissionOf(entry)}
- </td>
- <td className="max-w-[360px] truncate px-3 py-2 font-mono text-xs text-gray-500 dark:text-gray-400">
- {targetOf(entry)}
- </td>
- {showBadges && (
- <td className="px-3 py-2 text-right">
- <TestBadge result={rowResults.get(entry.name)} />
- </td>
- )}
- <td className="px-3 py-2 text-right whitespace-nowrap">
- <Button
- size="sm"
- variant="ghost"
- disabled={busy}
- onClick={() => openEdit(index)}
- >
- {S.common.edit}
- </Button>
- <Button
- size="sm"
- variant="ghost"
- disabled={busy}
- onClick={() => setDeleting(index)}
- >
- {S.agent.mcpRemove}
- </Button>
- </td>
- </tr>
- ))}
- </tbody>
- </table>
- </div>
+ </TableCell>
+ </TableRow>
+ ))}
+ </TableBody>
+ </Table>
)}
<Button size="sm" variant="primary" disabled={busy} onClick={openAdd}>
diff --git a/packages/web/src/features/agents/memory-tab.tsx b/packages/web/src/features/agents/memory-tab.tsx
index 3d1fdb14..37e1549b 100644
--- a/packages/web/src/features/agents/memory-tab.tsx
+++ b/packages/web/src/features/agents/memory-tab.tsx
@@ -31,7 +31,8 @@ import type {
} from "@prismshadow/penguin-server/api";
import {
Button,
- Chevron,
+ Card,
+ CollapsibleSection,
ConfirmModal,
CopiedStatus,
CopyCheckGlyph,
@@ -43,9 +44,10 @@ import {
ICONS,
IconButton,
InfoPopover,
+ ListRow,
Md,
Modal,
- NoticeStrip,
+ Notice,
RadioGroup,
Sheet,
SkeletonList,
@@ -511,21 +513,20 @@ export function MemoryTab({
</div>
);
+ // A memory's title is its file's identifier, so it keeps the data face on the code rung.
const fileRow = (scope: MemoryScopeInfo, file: MemoryFileInfo) => (
- <li key={file.name} className="flex items-center gap-3 px-3.5 py-2.5">
- <div className="min-w-0 flex-1">
- <p className="truncate font-mono text-[13px] font-medium text-gray-800 dark:text-gray-200">
- {file.title}
- </p>
- {file.description && (
- <p className="truncate text-xs text-gray-500 dark:text-gray-400">{file.description}</p>
- )}
- </div>
- <span className="shrink-0 text-xs tabular-nums text-gray-400 dark:text-gray-500">
- {file.updatedAt ?? formatRelativeDate(file.modifiedAt, locale)}
- </span>
- {rowActions(scope, file)}
- </li>
+ <ListRow
+ key={file.name}
+ as="li"
+ title={<span className="font-mono text-[length:var(--ui-text-code-size)]">{file.title}</span>}
+ description={file.description ? file.description : undefined}
+ meta={
+ <span className="tabular-nums">
+ {file.updatedAt ?? formatRelativeDate(file.modifiedAt, locale)}
+ </span>
+ }
+ trailing={rowActions(scope, file)}
+ />
);
/** Metadata + rendered body of the memory in view, shared by the Drawer and the Sheet. */
@@ -555,7 +556,7 @@ export function MemoryTab({
);
return (
- <div className="space-y-5">
+ <div className="space-y-4">
{/* 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>
@@ -568,68 +569,56 @@ export function MemoryTab({
/>
{!templateHasMemory && (
- <NoticeStrip
+ <Notice
tone="attention"
- className="flex items-center justify-between gap-4 rounded-lg border px-4 py-3"
+ variant="callout"
+ action={{ label: S.memory.insertPlaceholder, onClick: () => void insertPlaceholder() }}
>
- <p className="text-xs">{S.memory.templateMissing}</p>
- <Button size="sm" onClick={() => void insertPlaceholder()}>
- {S.memory.insertPlaceholder}
- </Button>
- </NoticeStrip>
+ {S.memory.templateMissing}
+ </Notice>
)}
{groups === null ? (
<SkeletonList rows={4} />
) : (
- <div className={enabled ? "space-y-5" : "space-y-5 opacity-60"}>
+ <div className={enabled ? "space-y-4" : "space-y-4 opacity-60"}>
{groups.map(({ scope, files }) => {
const open = !collapsed.has(scope.scopeKey);
return (
- <section
+ /* One collapsible section per scope: the head strip folds the group; the group's
+ own actions sit after the toggle, outside it, since a button cannot hold
+ another. The section is a size container, not a viewport breakpoint: the
+ settings panel narrows independently of the window. Below @md the three action
+ labels drop and only their icons remain — 28rem is where the English labels
+ plus the count stop fitting beside the title, and rem tracks the user's font
+ tier (state/theme.tsx), so the threshold scales with the labels it measures. No
+ action is hidden at any width; each keeps its icon, an aria-label and a
+ tooltip. */
+ <CollapsibleSection
key={scope.scopeKey}
- className="overflow-hidden rounded-lg border border-gray-200 dark:border-gray-800"
- >
- {/* Group header (the models page's group convention): the collapse button fills
- the row, the group's own actions sit between it and the chevron — a real
- <button> cannot nest another, so the actions are siblings, with the hover
- highlight on the whole header so it reads as a single unit.
- The row is a size container, not a viewport breakpoint: the settings panel
- narrows independently of the window. Below @md the three action labels drop
- and only their icons remain — 28rem is where the English labels plus the count
- stop fitting beside the title, and rem tracks the user's font tier
- (state/theme.tsx), so the threshold scales with the labels it measures. No
- action is hidden at any width; each keeps its icon, an aria-label and a
- title. */}
- <div className="@container flex items-center gap-2 bg-gray-50 pr-2 transition-colors duration-150 hover:bg-gray-100 dark:bg-gray-900/60 dark:hover:bg-gray-800/60">
- <button
- type="button"
- aria-expanded={open}
- onClick={() => toggleCollapsed(scope.scopeKey)}
- className="flex min-w-0 flex-1 items-center gap-2.5 px-3.5 py-2.5 text-left"
- >
- {/* Scope title can truncate (min-w-0): the actions to its right must not
- shrink, so a shrink-0 title is pushed out of the button box instead — and
- a button does not clip, so it would paint on top of the first action. */}
- <span className="min-w-0 truncate text-sm font-semibold text-gray-800 dark:text-gray-200">
+ className="@container"
+ title={
+ scope.kind === "workspace" && scope.workspacePath !== undefined ? (
+ <>
{scopeTitle(scope)}
- </span>
- {scope.kind === "workspace" && scope.workspacePath !== undefined && (
- <span className="min-w-0 truncate font-mono text-[11px] text-gray-400 dark:text-gray-500">
+ <span className="ml-2 font-mono text-xs font-normal text-gray-400 dark:text-gray-500">
{scope.workspacePath}
</span>
- )}
- <span className="min-w-0 flex-1" />
- <span className="shrink-0 whitespace-nowrap text-xs text-gray-400 dark:text-gray-500">
- {S.memory.itemCount(files.length)}
- </span>
- </button>
- {/* Whole-group transfer, icon + label (the labels are what say which way a
- transfer goes, wherever the row is wide enough to keep them): export for any
- member, import for the owner. The tooltip carries what the label cannot —
- that the whole group travels — and on a narrow row, where the label is gone,
- it carries the direction too, alongside the aria-label. */}
- <span className="shrink-0">
+ </>
+ ) : (
+ scopeTitle(scope)
+ )
+ }
+ meta={S.memory.itemCount(files.length)}
+ open={open}
+ onOpenChange={() => toggleCollapsed(scope.scopeKey)}
+ actions={
+ /* Whole-group transfer, icon + label (the labels are what say which way a
+ transfer goes, wherever the row is wide enough to keep them): export for any
+ member, import for the owner. The tooltip carries what the label cannot —
+ that the whole group travels — and on a narrow row, where the label is gone,
+ it carries the direction too, alongside the aria-label. */
+ <>
<Button
size="sm"
variant="ghost"
@@ -640,22 +629,20 @@ export function MemoryTab({
<DownloadIcon size={13} />
<span className="hidden @md:inline">{S.memory.exportScope}</span>
</Button>
- </span>
- {isOwner && (
- <label
- className={`${GHOST_LABEL_CLASS} shrink-0`}
- data-tooltip={S.memory.importScopeHint}
- aria-label={S.memory.importScopeLabel(scopeTitle(scope))}
- >
- <HiddenFileInput
- accept=".json,application/json"
- onChange={(e) => void pickImport(scope, e)}
- />
- <UploadIcon size={13} />
- <span className="hidden @md:inline">{S.memory.importScope}</span>
- </label>
- )}
- <span className="shrink-0">
+ {isOwner && (
+ <label
+ className={`${GHOST_LABEL_CLASS} shrink-0`}
+ data-tooltip={S.memory.importScopeHint}
+ aria-label={S.memory.importScopeLabel(scopeTitle(scope))}
+ >
+ <HiddenFileInput
+ accept=".json,application/json"
+ onChange={(e) => void pickImport(scope, e)}
+ />
+ <UploadIcon size={13} />
+ <span className="hidden @md:inline">{S.memory.importScope}</span>
+ </label>
+ )}
<Button
size="sm"
variant="ghost"
@@ -666,41 +653,23 @@ export function MemoryTab({
<GlyphIcon d={ICONS.plus} size={13} />
<span className="hidden @md:inline">{S.memory.add}</span>
</Button>
- </span>
- {/* Collapse arrow sits at the far right of the header (after the add entry); it too can be clicked to collapse. */}
- <button
- type="button"
- aria-expanded={open}
- aria-label={scopeTitle(scope)}
- onClick={() => toggleCollapsed(scope.scopeKey)}
- className="shrink-0 p-1.5"
- >
- <Chevron open={open} className="text-gray-400" />
- </button>
- </div>
- <div
- className={`grid transition-[grid-template-rows] duration-200 ease-out ${open ? "grid-rows-[1fr]" : "grid-rows-[0fr]"}`}
- >
- {/* inert while collapsed: rows at zero height shouldn't still be Tab-focusable or clickable. */}
- <div className="overflow-hidden" inert={!open}>
- {files.length === 0 ? (
- <p className="px-4 py-4 text-center text-xs text-gray-400 dark:text-gray-500">
- {scope.kind === "user" ? S.memory.emptyUserScope : S.memory.emptyScope}
- </p>
- ) : (
- <ul className="divide-y divide-gray-100 border-t border-gray-200 dark:divide-gray-800 dark:border-gray-800">
- {files.map((file) => fileRow(scope, file))}
- </ul>
- )}
- </div>
- </div>
- </section>
+ </>
+ }
+ >
+ {files.length === 0 ? (
+ <p className="px-4 py-4 text-center text-xs text-gray-400 dark:text-gray-500">
+ {scope.kind === "user" ? S.memory.emptyUserScope : S.memory.emptyScope}
+ </p>
+ ) : (
+ <ul>{files.map((file) => fileRow(scope, file))}</ul>
+ )}
+ </CollapsibleSection>
);
})}
</div>
)}
- <section className="space-y-2.5 rounded-lg border border-gray-200 p-3.5 dark:border-gray-800">
+ <Card as="section" padding="md" className="space-y-3">
<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>
@@ -725,8 +694,9 @@ export function MemoryTab({
onFocus={() => setLastPromptField("workspace")}
onChange={(e) => setWorkspacePrompt(e.target.value)}
/>
- {/* Placeholder reference, the Prompt tab's convention — a chip inserts into whichever field was focused last. */}
- <div className="rounded-md border border-gray-200 bg-gray-50 p-3 dark:border-gray-800 dark:bg-gray-900">
+ {/* Placeholder reference, the Prompt tab's convention — a chip inserts into whichever field was focused last.
+ Inside the card it takes the step below the card's radius. */}
+ <div className="rounded-sm border border-gray-200 bg-gray-50 p-3 dark:border-gray-800 dark:bg-gray-900">
<p className="mb-2 text-xs font-semibold text-gray-500">{S.agent.placeholdersTitle}</p>
<ul className="space-y-1">
{S.memory.promptPlaceholders.map(([token, desc]) => (
@@ -758,7 +728,7 @@ export function MemoryTab({
{S.common.save}
</Button>
</div>
- </section>
+ </Card>
{saveConfirm}
@@ -805,9 +775,9 @@ export function MemoryTab({
widthClass="sm:max-w-lg"
>
{editing && (
- <div className="space-y-2.5">
+ <div className="space-y-3">
<p className="text-xs text-gray-500 dark:text-gray-400">{S.memory.editWhy}</p>
- <p className="break-all font-mono text-[11px] text-gray-400 dark:text-gray-500">
+ <p className="break-all font-mono text-xs text-gray-400 dark:text-gray-500">
{memoryFilePath(editing.scope, editing.file)}
</p>
<Textarea
@@ -849,9 +819,9 @@ export function MemoryTab({
widthClass="sm:max-w-lg"
>
{adding && (
- <div className="space-y-2.5">
+ <div className="space-y-3">
<p className="text-xs text-gray-500 dark:text-gray-400">{S.memory.addWhy}</p>
- <p className="break-all font-mono text-[11px] text-gray-400 dark:text-gray-500">
+ <p className="break-all font-mono text-xs text-gray-400 dark:text-gray-500">
{`${memoryDir}/${adding.scopeKey}`}
</p>
<Textarea
@@ -906,7 +876,7 @@ export function MemoryTab({
{importing && (
<div className="space-y-3">
<p className="text-xs text-gray-500 dark:text-gray-400">{S.memory.importWhy}</p>
- <p className="break-all font-mono text-[11px] text-gray-500 dark:text-gray-400">
+ <p className="break-all font-mono text-xs text-gray-500 dark:text-gray-400">
{S.memory.importFile(importing.fileName, importing.doc.files.length)}
</p>
<RadioGroup
diff --git a/packages/web/src/features/agents/prompt-injection-controls.tsx b/packages/web/src/features/agents/prompt-injection-controls.tsx
index 4be7541d..2b2b07c5 100644
--- a/packages/web/src/features/agents/prompt-injection-controls.tsx
+++ b/packages/web/src/features/agents/prompt-injection-controls.tsx
@@ -30,8 +30,9 @@ import type {
} from "@prismshadow/penguin-server/api";
import {
Button,
+ Card,
InfoPopover,
- NoticeStrip,
+ Notice,
Textarea,
ToggleRow,
toastError,
@@ -222,27 +223,28 @@ export function usePromptInjection({
// features that can report legacySectionPresent); everything else gets the plain insert.
const legacy = state?.legacySectionPresent === true;
const alertStrip = promptStrings !== null && state !== null && !state.templateHasPlaceholder && (
- <NoticeStrip
+ <Notice
tone="attention"
- className="flex items-center justify-between gap-4 rounded-lg border px-4 py-3"
+ variant="callout"
+ action={
+ canEdit
+ ? {
+ label: legacy
+ ? (promptStrings.migrate ?? promptStrings.insertPlaceholder)
+ : promptStrings.insertPlaceholder,
+ onClick: () => void insertPlaceholder(),
+ }
+ : undefined
+ }
>
- <p className="text-xs">
- {legacy
- ? (promptStrings.legacyTemplate ?? promptStrings.templateMissing)
- : promptStrings.templateMissing}
- </p>
- {canEdit && (
- <Button size="sm" className="shrink-0" onClick={() => void insertPlaceholder()}>
- {legacy
- ? (promptStrings.migrate ?? promptStrings.insertPlaceholder)
- : promptStrings.insertPlaceholder}
- </Button>
- )}
- </NoticeStrip>
+ {legacy
+ ? (promptStrings.legacyTemplate ?? promptStrings.templateMissing)
+ : promptStrings.templateMissing}
+ </Notice>
);
const promptSection = promptStrings !== null && state !== null && (
- <section className="space-y-2.5 rounded-lg border border-gray-200 p-3.5 dark:border-gray-800">
+ <Card as="section" padding="md" className="space-y-3">
<h3 className="flex items-center gap-1.5 text-sm font-semibold text-gray-800 dark:text-gray-200">
{promptStrings.promptSection}
<InfoPopover label={promptStrings.promptSection}>
@@ -259,8 +261,9 @@ export function usePromptInjection({
value={prompt}
onChange={(e) => setPrompt(e.target.value)}
/>
- {/* Placeholder reference, the Prompt/Memory tab convention — a chip inserts at the cursor. */}
- <div className="rounded-md border border-gray-200 bg-gray-50 p-3 dark:border-gray-800 dark:bg-gray-900">
+ {/* Placeholder reference, the Prompt/Memory tab convention — a chip inserts at the cursor.
+ Inside the card it takes the step below the card's radius. */}
+ <div className="rounded-sm border border-gray-200 bg-gray-50 p-3 dark:border-gray-800 dark:bg-gray-900">
<p className="mb-2 text-xs font-semibold text-gray-500">{S.agent.placeholdersTitle}</p>
<ul className="space-y-1">
{promptStrings.promptPlaceholders.map(([token, desc]) => (
@@ -287,7 +290,7 @@ export function usePromptInjection({
</div>
)}
{saveConfirm}
- </section>
+ </Card>
);
return { applyConfig, toggleCard, alertStrip, promptSection };
diff --git a/packages/web/src/features/agents/schedules-tab.tsx b/packages/web/src/features/agents/schedules-tab.tsx
index 10103bfd..de85466d 100644
--- a/packages/web/src/features/agents/schedules-tab.tsx
+++ b/packages/web/src/features/agents/schedules-tab.tsx
@@ -31,6 +31,12 @@ import {
HelpFold,
SettingsEmpty,
SkeletonList,
+ Table,
+ TableBody,
+ TableCell,
+ TableHead,
+ TableHeaderCell,
+ TableRow,
toastError,
toastSuccess,
} from "@prismshadow/penguin-ui";
@@ -40,7 +46,8 @@ import { S } from "../../lib/strings";
import { apiErrorText } from "../../lib/api-error";
import { formatDateTime } from "../../lib/format";
import { useProject } from "../../state/project";
-import { AiCreateModal, CreateButtons } from "../ai-create";
+import { AiCreateModal } from "../ai-create";
+import { AiCreateButtons } from "../ai-create/ai-create-buttons";
import { ScheduleFormModal } from "../schedules/schedule-form-modal";
import { ScheduleSuggestions, scheduleExamples } from "../schedules/schedule-suggestions";
import { toggleBody } from "../schedules/schedule-upsert";
@@ -166,7 +173,7 @@ export function SchedulesTab({
two buttons offer the AI path and the form side by side; a member, who cannot write
files here, gets the AI button alone — asking the agent is a message, not a write. */}
<div className="flex justify-end">
- <CreateButtons
+ <AiCreateButtons
size="sm"
onAi={() => openAi("")}
{...(isOwner ? { onManual: () => setForm({ editing: null }) } : {})}
@@ -182,111 +189,104 @@ export function SchedulesTab({
<ScheduleSuggestions mode="agent" onPick={openAi} />
</div>
) : (
- <div className="overflow-x-auto overflow-y-clip rounded-md border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-900">
- <table className="w-full min-w-[720px] text-left text-sm">
- <thead>
- <tr className="border-b border-gray-200 bg-gray-50/80 text-xs text-gray-500 dark:border-gray-800 dark:bg-gray-900">
- <th className="whitespace-nowrap px-3 py-2.5">{S.common.name}</th>
- <th className="whitespace-nowrap px-3 py-2.5">{S.schedule.colStatus}</th>
- <th className="whitespace-nowrap px-3 py-2.5">{S.schedule.colPeriod}</th>
- <th className="whitespace-nowrap px-3 py-2.5">{S.schedule.colTarget}</th>
- <th className="whitespace-nowrap px-3 py-2.5">{S.schedule.colFireTimes}</th>
- <th className="whitespace-nowrap px-3 py-2.5">{S.schedule.colQueued}</th>
- {isOwner && <th className="px-3 py-2.5" />}
- </tr>
- </thead>
- <tbody>
- {schedules.map((item) => (
- <tr
- key={item.name}
- className="border-b border-gray-100 transition-colors duration-150 last:border-b-0 hover:bg-gray-50 dark:border-gray-800/60 dark:hover:bg-gray-800/40"
+ <Table tableClassName="min-w-[720px]">
+ <TableHead>
+ <TableHeaderCell>{S.common.name}</TableHeaderCell>
+ <TableHeaderCell>{S.schedule.colStatus}</TableHeaderCell>
+ <TableHeaderCell>{S.schedule.colPeriod}</TableHeaderCell>
+ <TableHeaderCell>{S.schedule.colTarget}</TableHeaderCell>
+ <TableHeaderCell>{S.schedule.colFireTimes}</TableHeaderCell>
+ <TableHeaderCell>{S.schedule.colQueued}</TableHeaderCell>
+ {isOwner && <TableHeaderCell />}
+ </TableHead>
+ <TableBody>
+ {schedules.map((item) => (
+ <TableRow key={item.name}>
+ {/* Long text columns truncate with the full value on hover instead of wrapping. */}
+ <TableCell
+ className="max-w-40 truncate font-mono text-xs"
+ data-tooltip={item.name}
+ data-tooltip-content="code"
>
- {/* Long text columns truncate with the full value on hover instead of wrapping. */}
- <td
- className="max-w-40 truncate px-3 py-2 font-mono text-xs"
- data-tooltip={item.name}
- data-tooltip-content="code"
- >
- {item.name}
- </td>
- <td className="whitespace-nowrap px-3 py-2">
- {/* invalid reason is folded into the hover title. */}
- <span data-tooltip={item.invalidReason}>
- <Badge {...STATUS_BADGE[item.status]}>
- {S.schedule.statusNames[item.status] ?? item.status}
- </Badge>
- </span>
- </td>
- <td className="whitespace-nowrap px-3 py-2 text-xs text-gray-500 dark:text-gray-400">
- {item.period !== undefined ? (
- <span className="font-mono">{item.period}</span>
- ) : (
- S.schedule.once
- )}
- </td>
- <td
- className="max-w-36 truncate px-3 py-2 text-xs text-gray-500 dark:text-gray-400"
- data-tooltip={item.sessionId}
- data-tooltip-content="text"
- >
- {item.sessionId !== undefined ? (
- <span className="font-mono">{item.sessionId}</span>
- ) : (
- S.schedule.newSession
- )}
- </td>
- {/* Deliberate two-line stack — top: next fire time; bottom: last fired time
- (both show — when absent); nowrap keeps each line whole. */}
- <td className="whitespace-nowrap px-3 py-2 text-xs">
- <span className="block text-gray-600 dark:text-gray-300">
- {item.nextFireAt ? formatDateTime(item.nextFireAt) : "—"}
- </span>
- <span className="block text-gray-400 dark:text-gray-500">
- {item.lastFiredAt ? formatDateTime(item.lastFiredAt) : "—"}
- </span>
- </td>
- <td className="whitespace-nowrap px-3 py-2">
- {item.queued && <Badge variant="solid">{S.schedule.queued}</Badge>}
- </td>
- {isOwner && (
- <td className="whitespace-nowrap px-3 py-2 text-right">
- <Button
- size="sm"
- variant="ghost"
- disabled={busy}
- onClick={() => void toggle(item)}
- >
- {item.enabled ? S.schedule.disable : S.schedule.enable}
- </Button>
- <Button
- size="sm"
- variant="ghost"
- disabled={busy}
- onClick={() => setForm({ editing: item })}
- >
- {S.common.edit}
- </Button>
- <Button
- size="sm"
- variant="ghost"
- disabled={busy}
- onClick={() => setDeleting(item.name)}
- >
- {S.common.delete}
- </Button>
- </td>
+ {item.name}
+ </TableCell>
+ <TableCell nowrap>
+ {/* invalid reason is folded into the hover title. */}
+ <span data-tooltip={item.invalidReason}>
+ <Badge {...STATUS_BADGE[item.status]}>
+ {S.schedule.statusNames[item.status] ?? item.status}
+ </Badge>
+ </span>
+ </TableCell>
+ <TableCell nowrap className="text-xs text-gray-500 dark:text-gray-400">
+ {item.period !== undefined ? (
+ <span className="font-mono">{item.period}</span>
+ ) : (
+ S.schedule.once
)}
- </tr>
- ))}
- </tbody>
- </table>
- </div>
+ </TableCell>
+ <TableCell
+ className="max-w-36 truncate text-xs text-gray-500 dark:text-gray-400"
+ data-tooltip={item.sessionId}
+ data-tooltip-content="text"
+ >
+ {item.sessionId !== undefined ? (
+ <span className="font-mono">{item.sessionId}</span>
+ ) : (
+ S.schedule.newSession
+ )}
+ </TableCell>
+ {/* Deliberate two-line stack — top: next fire time; bottom: last fired time
+ (both show — when absent); nowrap keeps each line whole. */}
+ <TableCell nowrap className="text-xs">
+ <span className="block text-gray-600 dark:text-gray-300">
+ {item.nextFireAt ? formatDateTime(item.nextFireAt) : "—"}
+ </span>
+ <span className="block text-gray-400 dark:text-gray-500">
+ {item.lastFiredAt ? formatDateTime(item.lastFiredAt) : "—"}
+ </span>
+ </TableCell>
+ <TableCell nowrap>
+ {item.queued && <Badge variant="solid">{S.schedule.queued}</Badge>}
+ </TableCell>
+ {isOwner && (
+ <TableCell align="right" nowrap>
+ <Button
+ size="sm"
+ variant="ghost"
+ disabled={busy}
+ onClick={() => void toggle(item)}
+ >
+ {item.enabled ? S.schedule.disable : S.schedule.enable}
+ </Button>
+ <Button
+ size="sm"
+ variant="ghost"
+ disabled={busy}
+ onClick={() => setForm({ editing: item })}
+ >
+ {S.common.edit}
+ </Button>
+ <Button
+ size="sm"
+ variant="ghost"
+ disabled={busy}
+ onClick={() => setDeleting(item.name)}
+ >
+ {S.common.delete}
+ </Button>
+ </TableCell>
+ )}
+ </TableRow>
+ ))}
+ </TableBody>
+ </Table>
)}
{invalidFiles.length > 0 && (
<div className="text-xs text-red-600 dark:text-red-400">
<p className="font-medium">{S.schedule.invalidFiles}</p>
- <ul className="mt-0.5 space-y-0.5 font-mono">
+ <ul className="mt-0.5 space-y-1 font-mono">
{invalidFiles.map((f) => (
<li key={f.name}>
{f.name}: {f.error}
diff --git a/packages/web/src/features/agents/skills-tab.tsx b/packages/web/src/features/agents/skills-tab.tsx
index b2a08260..3b731454 100644
--- a/packages/web/src/features/agents/skills-tab.tsx
+++ b/packages/web/src/features/agents/skills-tab.tsx
@@ -22,6 +22,7 @@ import type { ChangeEvent } from "react";
import type { SkillMetadataItem } from "@prismshadow/penguin-server/api";
import {
Button,
+ Card,
ConfirmModal,
CopiedStatus,
CopyCheckGlyph,
@@ -258,7 +259,7 @@ export function SkillsTab({
) : skills.length === 0 ? (
<SettingsEmpty>{S.skills.agentTabEmpty}</SettingsEmpty>
) : (
- <div className="overflow-hidden rounded-md border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-900">
+ <Card padding="none">
{skills.map((skill) => (
<div
key={skill.name}
@@ -267,7 +268,7 @@ export function SkillsTab({
<SkillTile icon={skill.icon} name={skill.name} size={36} glyph={20} />
<div className="min-w-0 flex-1">
<span
- className="block truncate font-mono text-[13px] font-semibold"
+ className="block truncate font-mono text-[length:var(--ui-text-code-size)] font-semibold"
data-tooltip={skill.name}
data-tooltip-content="code"
>
@@ -284,7 +285,7 @@ export function SkillsTab({
</div>
{metaLine(skill) !== "" && (
<span
- className="hidden shrink-0 text-[11px] text-gray-400 sm:block dark:text-gray-500"
+ className="hidden shrink-0 text-xs text-gray-400 sm:block dark:text-gray-500"
data-tooltip={metaLine(skill)}
>
{metaLine(skill)}
@@ -312,7 +313,7 @@ export function SkillsTab({
</IconButton>
</div>
))}
- </div>
+ </Card>
)}
{promptSection}
@@ -330,7 +331,7 @@ export function SkillsTab({
<p className="mt-0.5 text-xs text-gray-500 dark:text-gray-400">
{S.skills.importChatWhy}
</p>
- <div className="mt-2.5 space-y-2.5">
+ <div className="mt-2.5 space-y-3">
<Input
size="sm"
label={S.skills.importSourceLabel}
diff --git a/packages/web/src/features/agents/vault-tab.tsx b/packages/web/src/features/agents/vault-tab.tsx
index c1241047..252fcfab 100644
--- a/packages/web/src/features/agents/vault-tab.tsx
+++ b/packages/web/src/features/agents/vault-tab.tsx
@@ -33,7 +33,8 @@ import { S } from "../../lib/strings";
import { apiErrorText } from "../../lib/api-error";
import { useProject } from "../../state/project";
import { usePromptInjection } from "./prompt-injection-controls";
-import { AiCreateModal, CreateButtons } from "../ai-create";
+import { AiCreateModal } from "../ai-create";
+import { AiCreateButtons } from "../ai-create/ai-create-buttons";
/** Vault key naming rule (consistent with core/server): shell environment variable name. */
const VAULT_KEY_PATTERN = /^[A-Za-z_][A-Za-z0-9_]*$/;
@@ -224,7 +225,7 @@ export function VaultTab({
{/* Add entry points (owner): two separate buttons. The manual one opens the form in a modal
(submitting the same key name overwrites the original value), the AI one the prompt. */}
{isOwner && entries !== null && (
- <CreateButtons
+ <AiCreateButtons
size="sm"
disabled={busy}
onAi={() => setAiAdding(true)}
diff --git a/packages/web/src/features/ai-create/ai-create-buttons.tsx b/packages/web/src/features/ai-create/ai-create-buttons.tsx
new file mode 100644
index 00000000..eccbd1d3
--- /dev/null
+++ b/packages/web/src/features/ai-create/ai-create-buttons.tsx
@@ -0,0 +1,25 @@
+/**
+ * The create pair in the "Create with AI" kit's words: the package's `CreateButtons`, labelled
+ * "Create with AI" / "Create manually" unless the object has a verb of its own ("Import with
+ * AI" / "Import manually").
+ */
+import { CreateButtons } from "@prismshadow/penguin-ui";
+import type { CreateButtonsProps } from "@prismshadow/penguin-ui";
+import { S } from "../../lib/strings";
+
+export type AiCreateButtonsProps = Omit<CreateButtonsProps, "aiLabel" | "manualLabel"> & {
+ /** The AI path's label; `S.aiCreate.withAi` by default. */
+ aiLabel?: string;
+ /** The manual path's label; `S.aiCreate.manual` by default. */
+ manualLabel?: string;
+};
+
+export function AiCreateButtons({ aiLabel, manualLabel, ...rest }: AiCreateButtonsProps) {
+ return (
+ <CreateButtons
+ {...rest}
+ aiLabel={aiLabel ?? S.aiCreate.withAi}
+ manualLabel={manualLabel ?? S.aiCreate.manual}
+ />
+ );
+}
diff --git a/packages/web/src/features/ai-create/ai-create-panel.tsx b/packages/web/src/features/ai-create/ai-create-panel.tsx
index cfd92bbc..19a0af24 100644
--- a/packages/web/src/features/ai-create/ai-create-panel.tsx
+++ b/packages/web/src/features/ai-create/ai-create-panel.tsx
@@ -170,7 +170,7 @@ export function AiCreatePanel({
{ex.label}
</div>
{ex.description !== undefined && (
- <div className="truncate text-[11px] text-gray-500 dark:text-gray-400">
+ <div className="truncate text-xs text-gray-500 dark:text-gray-400">
{ex.description}
</div>
)}
diff --git a/packages/web/src/features/ai-create/index.ts b/packages/web/src/features/ai-create/index.ts
index 81953813..9b762e69 100644
--- a/packages/web/src/features/ai-create/index.ts
+++ b/packages/web/src/features/ai-create/index.ts
@@ -11,5 +11,5 @@ export { AiCreatePanel, PromptFold } from "./ai-create-panel";
export type { AiCreatePanelProps, AiExample } from "./ai-create-panel";
export { AiCreateModal } from "./ai-create-modal";
export type { AiCreateModalProps } from "./ai-create-modal";
-export { CreateButtons } from "./create-buttons";
-export type { CreateButtonsProps } from "./create-buttons";
+export { AiCreateButtons } from "./ai-create-buttons";
+export type { AiCreateButtonsProps } from "./ai-create-buttons";
diff --git a/packages/web/src/features/benchmark/benchmark-case-browser.tsx b/packages/web/src/features/benchmark/benchmark-case-browser.tsx
index de3619fd..fbcf532f 100644
--- a/packages/web/src/features/benchmark/benchmark-case-browser.tsx
+++ b/packages/web/src/features/benchmark/benchmark-case-browser.tsx
@@ -17,6 +17,7 @@ import type {
CaseMaterial,
WorkspaceFileEntry,
} from "@prismshadow/penguin-server/api";
+import { Badge } from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
import { apiErrorText } from "../../lib/api-error";
import { joinWorkspacePath } from "../../lib/file-path";
@@ -334,14 +335,14 @@ export function BenchmarkCaseBrowser({ projectId, benchmarkId, caseSummary, mach
if (row.depth === 0) {
if (row.material !== "rubric") return null;
return (
- <span className="shrink-0 rounded bg-gray-200/70 px-1.5 py-0.5 text-[10px] text-gray-500 dark:bg-gray-800 dark:text-gray-400">
- {S.benchmark.agentHidden}
+ <span className="shrink-0">
+ <Badge size="sm">{S.benchmark.agentHidden}</Badge>
</span>
);
}
if (row.kind !== "file") return null;
return (
- <span className="shrink-0 font-mono text-[11px] text-gray-400 dark:text-gray-500">
+ <span className="shrink-0 font-mono text-xs text-gray-400 dark:text-gray-500">
{formatBytes(row.sizeBytes)}
</span>
);
@@ -349,8 +350,8 @@ export function BenchmarkCaseBrowser({ projectId, benchmarkId, caseSummary, mach
// One fixed width per language, so opening or closing a folder never moves the preview beside
// the tree. It is sized to the rubric folder's row, whose name shares the row with the
- // hidden-from-agent badge: the English pair takes about 320px at the default 18px root and the
- // Chinese pair about 230px. A longer file name is cut, and its row's tooltip holds the path.
+ // hidden-from-agent badge: the English pair takes about 370px at the default 18px root and the
+ // Chinese pair about 260px. A longer file name is cut, and its row's tooltip holds the path.
return (
<FileBrowser
rows={caseTreeRows(materials, listings, expanded)}
@@ -366,7 +367,7 @@ export function BenchmarkCaseBrowser({ projectId, benchmarkId, caseSummary, mach
preview={preview}
emptyPreview={S.benchmark.caseFileUnavailable}
resolveRef={resolveRef}
- treeWidth={locale === "en" ? 330 : 240}
+ treeWidth={locale === "en" ? 380 : 270}
treeMaxHeight={53}
previewHeight={52}
minHeight={58}
diff --git a/packages/web/src/features/benchmark/benchmark-detail.tsx b/packages/web/src/features/benchmark/benchmark-detail.tsx
index acf506d6..dea36e17 100644
--- a/packages/web/src/features/benchmark/benchmark-detail.tsx
+++ b/packages/web/src/features/benchmark/benchmark-detail.tsx
@@ -14,11 +14,18 @@ import type { BenchmarkCaseSummary, BenchmarkEvaluation } from "@prismshadow/pen
import {
AgentAvatar,
Button,
+ Card,
EmptyState,
GlyphIcon,
ICONS,
ICON_SIZE,
Modal,
+ Table,
+ TableBody,
+ TableCell,
+ TableHead,
+ TableHeaderCell,
+ TableRow,
} from "@prismshadow/penguin-ui";
import type { MergedBenchmark, MergedCase } from "../../lib/benchmark-merge";
import { S } from "../../lib/strings";
@@ -156,7 +163,7 @@ function TrendSection({ evaluations }: { evaluations: BenchmarkEvaluation[] }) {
{series.map((s, i) => (
<span
key={s.unlabeled ? "unlabeled" : s.key}
- className="flex items-center gap-1.5 text-[11px] text-gray-500 dark:text-gray-400"
+ className="flex items-center gap-1.5 text-xs text-gray-500 dark:text-gray-400"
>
<ChartSwatch paint={scoreSeriesPaint(s, i)} shape="block" />
<span className="font-mono">{labelOf(s)}</span>
@@ -169,8 +176,6 @@ function TrendSection({ evaluations }: { evaluations: BenchmarkEvaluation[] }) {
);
}
-const CELL = "px-3 py-2";
-
/** One evaluation record: a clickable row; the detail it used to unfold is a dialog of its own. */
function EvaluationRow({
evaluation,
@@ -189,11 +194,8 @@ function EvaluationRow({
currency: Currency;
}) {
return (
- <tr
- onClick={onOpen}
- className="cursor-pointer border-b border-gray-100 transition-colors duration-150 last:border-b-0 hover:bg-gray-50 dark:border-gray-800/60 dark:hover:bg-gray-800/40"
- >
- <td className={CELL}>
+ <TableRow onClick={onOpen} className="cursor-pointer">
+ <TableCell>
{/* The row is what a mouse clicks, and this is the same target for a keyboard: a table
row cannot be a button, so the cell that names the record carries the real one. */}
<button
@@ -207,12 +209,12 @@ function EvaluationRow({
{formatDateTime(evaluation.time)}
</button>
{machineName !== null && (
- <span className="ml-1.5 font-mono text-[11px] text-gray-400 dark:text-gray-500">
+ <span className="ml-1.5 font-mono text-xs text-gray-400 dark:text-gray-500">
{S.chat.machineTag(machineName)}
</span>
)}
- </td>
- <td className={`${CELL} text-xs text-gray-500 dark:text-gray-400`}>
+ </TableCell>
+ <TableCell className="text-xs text-gray-500 dark:text-gray-400">
{evaluation.agentId ? (
<span className="flex items-center gap-1.5">
<AgentAvatar
@@ -225,30 +227,39 @@ function EvaluationRow({
) : (
<span className="text-gray-400">—</span>
)}
- </td>
- <td className={`${CELL} font-mono text-xs text-gray-500 dark:text-gray-400`}>
+ </TableCell>
+ <TableCell className="font-mono text-xs text-gray-500 dark:text-gray-400">
{evaluation.version !== undefined ? `v${evaluation.version}` : "—"}
- </td>
- <td
- className={`${CELL} max-w-40 truncate font-mono text-xs text-gray-500 dark:text-gray-400`}
+ </TableCell>
+ <TableCell
+ className="max-w-40 truncate font-mono text-xs text-gray-500 dark:text-gray-400"
data-tooltip={evaluation.provider}
data-tooltip-content="code"
>
{evaluation.modelId}
- </td>
- <td className={`${CELL} font-mono text-xs text-gray-500 dark:text-gray-400`}>
+ </TableCell>
+ <TableCell className="font-mono text-xs text-gray-500 dark:text-gray-400">
{evaluation.thinkingLevel}
- </td>
- <td className={`${CELL} font-mono text-xs font-semibold tabular-nums`}>
+ </TableCell>
+ {/* Figures, but left-aligned under their headers like every other column here. */}
+ <TableCell align="left" numeric className="font-mono text-xs font-semibold">
{formatScore(evaluation.score)}
- </td>
- <td className={`${CELL} font-mono text-xs tabular-nums text-gray-500 dark:text-gray-400`}>
+ </TableCell>
+ <TableCell
+ align="left"
+ numeric
+ className="font-mono text-xs text-gray-500 dark:text-gray-400"
+ >
{formatMoney(evaluation.cost, currency)}
- </td>
- <td className={`${CELL} font-mono text-xs tabular-nums text-gray-500 dark:text-gray-400`}>
+ </TableCell>
+ <TableCell
+ align="left"
+ numeric
+ className="font-mono text-xs text-gray-500 dark:text-gray-400"
+ >
{evaluation.durationMs !== undefined ? humanizeDuration(evaluation.durationMs) : "—"}
- </td>
- </tr>
+ </TableCell>
+ </TableRow>
);
}
@@ -294,7 +305,7 @@ function CasesSection({
return (
<div>
<p className="mb-1 text-xs font-semibold text-gray-500">{S.benchmark.cases}</p>
- <div className="overflow-hidden rounded-md border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-900">
+ <Card padding="none">
{error && <p className={`px-3 py-2 text-xs ${toneInk.danger}`}>{error}</p>}
{!cases && !error && <p className="px-3 py-2 text-xs text-gray-400">{S.common.loading}</p>}
{cases?.map((item) => {
@@ -320,7 +331,7 @@ function CasesSection({
</button>
);
})}
- </div>
+ </Card>
</div>
);
}
@@ -397,38 +408,34 @@ export function BenchmarkDetail({
<div>
<p className="mb-1 text-xs font-semibold text-gray-500">{S.benchmark.evaluations}</p>
- <div className="overflow-x-auto overflow-y-clip rounded-md border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-900">
- <table className="w-full min-w-[820px] text-left text-sm">
- <thead>
- <tr className="border-b border-gray-200 bg-gray-50/80 text-xs text-gray-500 dark:border-gray-800 dark:bg-gray-900">
- <th className="px-3 py-2.5">{S.common.time}</th>
- <th className="px-3 py-2.5">{S.benchmark.agentColumn}</th>
- <th className="px-3 py-2.5">{S.benchmark.colVersion}</th>
- <th className="px-3 py-2.5">{S.benchmark.colModel}</th>
- <th className="px-3 py-2.5">{S.benchmark.colThinkingLevel}</th>
- <th className="px-3 py-2.5">{S.benchmark.colScore}</th>
- <th className="px-3 py-2.5">{S.common.cost}</th>
- <th className="px-3 py-2.5">{S.benchmark.colDuration}</th>
- </tr>
- </thead>
- <tbody>
- {/* Newest first on screen, while the index stays the scoreboard position the
- dialog is opened by. */}
- {evaluations
- .map((ev, index) => ({ ev, index }))
- .reverse()
- .map(({ ev, index }) => (
- <EvaluationRow
- key={index}
- evaluation={ev}
- machineName={bm.machineIds.length > 1 ? machineNameOf(ev.machineId) : null}
- onOpen={() => setOpenEvaluationIndex(index)}
- currency={currency}
- />
- ))}
- </tbody>
- </table>
- </div>
+ <Table tableClassName="min-w-[820px]">
+ <TableHead>
+ <TableHeaderCell>{S.common.time}</TableHeaderCell>
+ <TableHeaderCell>{S.benchmark.agentColumn}</TableHeaderCell>
+ <TableHeaderCell>{S.benchmark.colVersion}</TableHeaderCell>
+ <TableHeaderCell>{S.benchmark.colModel}</TableHeaderCell>
+ <TableHeaderCell>{S.benchmark.colThinkingLevel}</TableHeaderCell>
+ <TableHeaderCell>{S.benchmark.colScore}</TableHeaderCell>
+ <TableHeaderCell>{S.common.cost}</TableHeaderCell>
+ <TableHeaderCell>{S.benchmark.colDuration}</TableHeaderCell>
+ </TableHead>
+ <TableBody>
+ {/* Newest first on screen, while the index stays the scoreboard position the
+ dialog is opened by. */}
+ {evaluations
+ .map((ev, index) => ({ ev, index }))
+ .reverse()
+ .map(({ ev, index }) => (
+ <EvaluationRow
+ key={index}
+ evaluation={ev}
+ machineName={bm.machineIds.length > 1 ? machineNameOf(ev.machineId) : null}
+ onOpen={() => setOpenEvaluationIndex(index)}
+ currency={currency}
+ />
+ ))}
+ </TableBody>
+ </Table>
</div>
</>
)}
diff --git a/packages/web/src/features/benchmark/benchmark-page.tsx b/packages/web/src/features/benchmark/benchmark-page.tsx
index 6f72531d..ed2d195d 100644
--- a/packages/web/src/features/benchmark/benchmark-page.tsx
+++ b/packages/web/src/features/benchmark/benchmark-page.tsx
@@ -21,6 +21,7 @@ import {
AgentAvatar,
AvatarStack,
Button,
+ Card,
ConfirmModal,
EmptyState,
GlyphIcon,
@@ -28,6 +29,8 @@ import {
ICON_GAP,
ICON_SIZE,
Input,
+ PageFrame,
+ PageHeader,
Select,
Skeleton,
SkeletonCard,
@@ -46,7 +49,8 @@ import { useSessions } from "../../state/sessions";
import type { MergedBenchmark } from "../../lib/benchmark-merge";
import { nameOnMachine } from "../../lib/workspace-machines";
import { useLocale } from "../../state/locale";
-import { AiCreateModal, CreateButtons, pickDefaultAgent } from "../ai-create";
+import { AiCreateModal, pickDefaultAgent } from "../ai-create";
+import { AiCreateButtons } from "../ai-create/ai-create-buttons";
import { latestWithDelta, matchesBenchmarkQuery, sparklineSeries } from "./benchmark-metrics";
import { benchmarkCreateExamples, benchmarkCreateTail } from "./benchmark-prompts";
import { benchmarkRoute } from "./benchmark-route";
@@ -82,7 +86,7 @@ export function BenchmarkCreateButtons({
onAi: () => void;
onManual: () => void;
}) {
- return <CreateButtons size="sm" onAi={onAi} {...(isOwner ? { onManual } : {})} />;
+ return <AiCreateButtons size="sm" onAi={onAi} {...(isOwner ? { onManual } : {})} />;
}
/**
@@ -184,7 +188,7 @@ export function BenchmarkCard({
? S.benchmark.creationFailedHint
: S.benchmark.creationFailedHintMember;
return (
- <div className="relative flex flex-wrap items-center gap-x-6 gap-y-2 rounded-md border border-gray-200 bg-white px-5 py-4 dark:border-gray-800 dark:bg-gray-900">
+ <Card padding="md" className="relative flex flex-wrap items-center gap-x-6 gap-y-2">
<button
type="button"
onClick={onOpen}
@@ -236,7 +240,7 @@ export function BenchmarkCard({
{formatScore(latest.score)}
</span>
<span
- className={`block whitespace-nowrap text-[11px] tabular-nums ${deltaTone(latest.delta)}`}
+ className={`block whitespace-nowrap text-xs tabular-nums ${deltaTone(latest.delta)}`}
>
{latest.delta === null
? S.benchmark.firstEvaluation
@@ -277,7 +281,7 @@ export function BenchmarkCard({
<div
role="note"
data-tooltip={failed ? failedHint : S.benchmark.buildingHint}
- className="absolute inset-0 flex cursor-not-allowed flex-col items-center justify-center gap-1 rounded-md bg-white/75 px-4 text-center backdrop-blur-[1px] dark:bg-gray-900/75"
+ className="absolute inset-0 flex cursor-not-allowed flex-col items-center justify-center gap-1 rounded-[inherit] bg-white/75 px-4 text-center dark:bg-gray-900/75"
>
{/* A failed creation is the one thing here the user has to act on, so its title takes
the danger ink; the line under it stays secondary text either way. */}
@@ -291,7 +295,7 @@ export function BenchmarkCard({
</span>
</div>
)}
- </div>
+ </Card>
);
}
@@ -300,7 +304,7 @@ function CardSkeletons({ rows }: { rows: number }) {
return (
<div className="space-y-3">
{Array.from({ length: rows }, (_, i) => (
- <SkeletonCard key={i} className="flex flex-wrap items-center gap-x-6 gap-y-2 px-5 py-4">
+ <SkeletonCard key={i} className="flex flex-wrap items-center gap-x-6 gap-y-2 p-4">
<div className="min-w-[14rem] flex-1">
<Skeleton className="h-[18px] w-40" />
<Skeleton className="mt-1.5 h-4 w-2/3" />
@@ -478,17 +482,17 @@ export function BenchmarkPage() {
}
return (
- <div className="h-full overflow-y-auto p-4 md:p-6">
- <div className="mx-auto max-w-5xl">
- {/* The title row, the intro block and the step cards share one block, so the gap below
- stays one gap — the Agents and Models headers have the same shape. */}
- <div className="mb-4">
- <div className="flex flex-wrap items-center justify-between gap-2">
- <h1 className="ui-display text-xl font-semibold">{S.benchmark.title}</h1>
- {/* Search plus the two create entry points. Below sm the search box takes a line of
- its own and the pair of buttons wraps under it: three controls sharing a phone's
- width would leave the box too narrow to read what was typed into it. */}
- <div className="flex min-w-0 max-w-full grow flex-wrap items-center gap-2 sm:grow-0">
+ <>
+ <PageFrame width="lg">
+ {/* The title row and the step cards are one header, so the gap below it stays one gap —
+ the Agents and Models headers have the same shape. Search plus the two create entry
+ points: below sm the search box takes a line of its own and the pair of buttons
+ wraps under it, since three controls sharing a phone's width would leave the box too
+ narrow to read what was typed into it. */}
+ <PageHeader
+ title={S.benchmark.title}
+ actions={
+ <>
<div className="w-full min-w-0 sm:w-56 sm:flex-none">
<Input
size="sm"
@@ -503,10 +507,11 @@ export function BenchmarkPage() {
onAi={openAi}
onManual={() => setManualOpen(true)}
/>
- </div>
- </div>
+ </>
+ }
+ >
<GuideSteps isOwner={isOwner} />
- </div>
+ </PageHeader>
{/* What the address is filtering by, and the way out of it: the list is narrowed by a
query parameter, which nothing else on the page would otherwise account for. */}
@@ -532,7 +537,7 @@ export function BenchmarkPage() {
)}
{body}
- </div>
+ </PageFrame>
<AiCreateModal
open={aiOpen}
@@ -593,6 +598,6 @@ export function BenchmarkPage() {
{S.benchmark.deleteConfirm(deletingBenchmark?.title ?? deleting ?? "")}
</p>
</ConfirmModal>
- </div>
+ </>
);
}
diff --git a/packages/web/src/features/chat/agent-topology-view.tsx b/packages/web/src/features/chat/agent-topology-view.tsx
index f98a52dd..75371617 100644
--- a/packages/web/src/features/chat/agent-topology-view.tsx
+++ b/packages/web/src/features/chat/agent-topology-view.tsx
@@ -7,10 +7,9 @@
* Each child node shows its wall-clock elapsed time (ticking while it runs, frozen at its last
* activity when done — never a sum of its items); the root carries no stamps and shows none.
*/
-import { AgentAvatar, StatusIcon } from "@prismshadow/penguin-ui";
+import { AgentAvatar, LiveDuration, StatusIcon } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
import { humanizeDuration } from "../../lib/format";
-import { LiveDuration } from "./live-duration";
import { layoutTopology, NODE_H, NODE_W } from "./agent-topology";
import type { TopologyNode } from "./agent-topology";
diff --git a/packages/web/src/features/chat/background-done-banner.tsx b/packages/web/src/features/chat/background-done-banner.tsx
index 07711803..4a716bb2 100644
--- a/packages/web/src/features/chat/background-done-banner.tsx
+++ b/packages/web/src/features/chat/background-done-banner.tsx
@@ -7,14 +7,14 @@
* tail) renders in the tool cards' output styling. The Trace page shows the raw marker text
* as-is.
*/
-import { StatusIcon } from "@prismshadow/penguin-ui";
-import { S } from "../../lib/strings";
-import type { BackgroundTaskDone } from "./agent-handoff";
import {
DISCLOSURE_CARD_CLASS,
DISCLOSURE_OUTPUT_PRE_CLASS,
DisclosureRow,
-} from "./disclosure-row";
+ StatusIcon,
+} from "@prismshadow/penguin-ui";
+import { S } from "../../lib/strings";
+import type { BackgroundTaskDone } from "./agent-handoff";
export function BackgroundDoneBanner({ done, body }: { done: BackgroundTaskDone; body: string }) {
const state =
diff --git a/packages/web/src/features/chat/chat-page.tsx b/packages/web/src/features/chat/chat-page.tsx
index 81e67b7e..e2d54464 100644
--- a/packages/web/src/features/chat/chat-page.tsx
+++ b/packages/web/src/features/chat/chat-page.tsx
@@ -46,6 +46,7 @@ import {
ICON_SIZE,
Modal,
Skeleton,
+ StatChip,
toastError,
toastInfo,
toastSuccess,
@@ -168,19 +169,6 @@ import { exitedProcessIds, reportableProcessFailure } from "./process-list";
/** 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;
-/** Iconized stat item: a symbol + a value, with the title giving the full meaning. */
-function StatChip({ icon, value, label }: { icon: string; value: ReactNode; label: string }) {
- return (
- <span
- data-tooltip={label}
- className={`flex shrink-0 items-center ${ICON_GAP.tight} font-mono text-xs text-gray-500 dark:text-gray-400`}
- >
- <GlyphIcon d={icon} />
- {value}
- </span>
- );
-}
-
/**
* Session id row in the details card: the id is selectable mono text (styled like the other
* sections' values) with the shared CopyButton beside it. The copy feedback is the button's
@@ -2140,10 +2128,11 @@ export function ChatPage() {
infoOpen ? "bg-gray-100 dark:bg-gray-800" : ""
}`}
>
- {/* Wide: the chip row (icon + title per chip carries the full meaning). */}
- <span className="hidden items-center gap-3 px-2 sm:flex">
+ {/* Wide: the chip row (icon + tooltip per chip carries the full meaning). The
+ row sets the chips' face and ink, and keeps each on one line. */}
+ <span className="hidden items-center gap-3 whitespace-nowrap px-2 font-mono text-xs text-gray-500 sm:flex dark:text-gray-400">
<StatChip
- icon={STAT_ICONS.tokens}
+ glyph={STAT_ICONS.tokens}
value={hs.tokensText}
label={`${S.chat.statTokens}(Token)`}
/>
@@ -2153,13 +2142,13 @@ export function ChatPage() {
something's broken. */}
{hs.costText != null && (
<StatChip
- icon={STAT_ICONS.cost}
+ glyph={STAT_ICONS.cost}
value={`${hs.costText}${hs.costUncosted ? " *" : ""}`}
label={`${S.common.cost}(${currency})${hs.costUncosted ? ` · ${S.usage.uncostedNote}` : ""}`}
/>
)}
<StatChip
- icon={STAT_ICONS.elapsed}
+ glyph={STAT_ICONS.elapsed}
value={hs.elapsedNode}
label={`${S.chat.statElapsed}${hs.elapsedSplit ?? ""}`}
/>
diff --git a/packages/web/src/features/chat/compaction-banner.tsx b/packages/web/src/features/chat/compaction-banner.tsx
index 85ca573e..6bc0e230 100644
--- a/packages/web/src/features/chat/compaction-banner.tsx
+++ b/packages/web/src/features/chat/compaction-banner.tsx
@@ -44,13 +44,17 @@
* turn ends** and manual compaction both go into the Session total (the Trace page lists
* compaction turns separately); see the task-stats module comments.
*/
-import { Md, StatusIcon } from "@prismshadow/penguin-ui";
+import {
+ DISCLOSURE_BODY_MD_CLASS,
+ DisclosureRow,
+ LiveDuration,
+ Md,
+ StatusIcon,
+} from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
import { humanizeDuration } from "../../lib/format";
import type { CompactionItem } from "../../lib/omni/stream-model";
import { compactionResultVisible, compactionSummaryText } from "../../lib/omni/compaction-summary";
-import { DISCLOSURE_BODY_MD_CLASS, DisclosureRow } from "./disclosure-row";
-import { LiveDuration } from "./live-duration";
import { StepBanner } from "./step-banner";
/**
diff --git a/packages/web/src/features/chat/disclosure-row.tsx b/packages/web/src/features/chat/disclosure-row.tsx
deleted file mode 100644
index b38a494f..00000000
--- a/packages/web/src/features/chat/disclosure-row.tsx
+++ /dev/null
@@ -1,182 +0,0 @@
-/**
- * The shared "collapsible one-liner" shell: a full-width row — status icon, label, optional
- * trailing detail, chevron — that expands to a caller-styled body. Extracted verbatim from
- * the thinking block so every disclosure row in the transcript (thinking, the background
- * completion notice) shares one source of truth for width, padding, both color states and
- * the chevron interaction, and cannot drift apart. The tool cards keep their own richer row
- * structure but reference the same class constants below.
- */
-import { useRef, useState } from "react";
-import type { ReactNode } from "react";
-import { Chevron } from "@prismshadow/penguin-ui";
-import type { RunState } from "@prismshadow/penguin-ui";
-
-/**
- * The row itself (collapsed and expanded state share it; the hover tone is the "open or
- * close me" affordance). Byte-identical to the class the thinking block and tool-card rows
- * carried before the extraction.
- */
-export const DISCLOSURE_ROW_CLASS =
- "flex w-full items-center gap-2 bg-white px-3 py-1.5 text-left transition-colors duration-150 hover:bg-gray-50 dark:bg-gray-900 dark:hover:bg-gray-800";
-
-/**
- * Stacked-sticky positioning for rows living inside the work group: while a row's expanded
- * body scrolls, the row pins right below the stuck group header (top-4 = the header's -top-4
- * offset + its 2rem height). Standalone rows (a single-row card) omit it.
- */
-export const DISCLOSURE_ROW_STICKY_CLASS = "sticky top-4 z-[4]";
-
-/** The row's text label (the thinking block's exact label styling). */
-export const DISCLOSURE_LABEL_CLASS = "shrink-0 text-xs text-gray-500 dark:text-gray-400";
-
-/**
- * The header-family row — the work group's "Running / Done" summary bar (its exact chrome:
- * gray ground, taller padding, stronger hover). A standalone disclosure that should read
- * like a settled work group (the background completion notice) uses this variant.
- */
-export const DISCLOSURE_HEADER_ROW_CLASS =
- "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";
-
-/** Header-level sticky positioning (the work-group header's own: pins against the message list's scrollport, one z level above the nested rows). */
-export const DISCLOSURE_HEADER_STICKY_CLASS = "sticky -top-4 z-[5]";
-
-/** The header-family title (the work-group header's title styling, minus the state-dependent color the caller appends). */
-export const DISCLOSURE_HEADER_TITLE_CLASS =
- "shrink-0 text-[11px] font-semibold uppercase tracking-wide";
-
-/**
- * Expanded plain-text body, the tool cards' output styling (an exec_command's expanded
- * output): a bordered mono <pre> block. Referenced by tool-call-card and every disclosure
- * body that shows raw output.
- */
-export const DISCLOSURE_OUTPUT_PRE_CLASS =
- "max-h-72 overflow-auto whitespace-pre-wrap border-t border-gray-100 px-3 py-2 text-xs leading-5 text-gray-600 dark:border-gray-800 dark:text-gray-300";
-
-/**
- * Expanded Markdown body — the thinking and compaction sections. The block
- * DISCLOSURE_OUTPUT_PRE_CLASS wears, minus the parts that only fit command output:
- * full-bleed under its row, separated by the same divider and inset by the same padding,
- * so the body reads as another kind of output rather than as a quotation inset inside the
- * card.
- *
- * It keeps prose type rather than the output block's, because the two are not the same
- * size on screen: the output block is monospace, and the app's sans at that size reads
- * visibly smaller beside it. `leading-relaxed` is within a hair of the 1.7 `.md-body p`
- * applies, so paragraphs, list items and headings all land on one rhythm instead of two.
- * `md-body-flush` drops the outermost block's margin at each end, so the body's own `py-2`
- * is the whole gap — the same one the output block leaves. It is a rule in styles.css and
- * not a `[&>*:first-child]:mt-0` utility here: the `.md-body` margins it has to beat are
- * unlayered, and an unlayered declaration wins over `@layer utilities` at any specificity.
- *
- * Markdown keeps rendering (these bodies are prose, not command output), hence no
- * `whitespace-pre-wrap`, and there is no height cap either: both bodies stream, and a
- * nested scrollbox would strand the live tail the transcript's own follow scrolls to.
- */
-export const DISCLOSURE_BODY_MD_CLASS =
- "md-body md-body-flush border-t border-gray-100 px-3 py-2 text-sm leading-relaxed text-gray-600 dark:border-gray-800 dark:text-gray-300";
-
-/**
- * The card container a row (or group of rows) sits in — the work group's exact chrome.
- * A standalone disclosure row wraps itself in one so its width and framing match the
- * neighboring groups.
- */
-export const DISCLOSURE_CARD_CLASS =
- "anim-msg my-2 overflow-clip rounded-md border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-900";
-
-/**
- * What a work step is and where it stands, for the `ui-activity` hook: the transcript's thinking
- * and tool rows and the work group's header carry it, so a theme can render work in progress
- * its own way (a glow while running, a transcript line with a block progress bar).
- */
-export interface ActivityMark {
- kind: "thinking" | "tool";
- state: "running" | "done" | "error";
-}
-
-/**
- * The run states the status icon shows, folded onto the three the activity hook knows. Waiting
- * on an approval is unfinished work, so it reads as running; a stopped step is settled.
- */
-export function activityState(state: RunState): ActivityMark["state"] {
- if (state === "failed") return "error";
- return state === "running" || state === "waiting" ? "running" : "done";
-}
-
-/**
- * The activity hook's progress slot, rendered only while the step is actually executing (not
- * while it waits on an approval), empty and `hidden`: the default theme draws no bar, and a
- * hidden node leaves no gap in the row's flex spacing, so a theme that draws one sets its own
- * `display`.
- */
-export function ActivityProgress({ running }: { running: boolean }) {
- return running ? <span data-slot="progress" aria-hidden className="hidden" /> : null;
-}
-
-export function DisclosureRow({
- icon,
- label,
- trailing,
- variant = "row",
- sticky = false,
- defaultOpen = false,
- activity,
- children,
-}: {
- /** Leading status icon slot (a StatusIcon, matching the thinking/tool rows). */
- icon: ReactNode;
- /** The row's one-line label (DISCLOSURE_LABEL_CLASS, or the header title styling for the header variant). */
- label: string;
- /** Optional detail between the label and the spacer (duration, a failure tag). */
- trailing?: ReactNode;
- /**
- * "row" = a line inside the work group (the thinking block's form); "header" = the work
- * group's own summary-bar form (the background notice's standalone card).
- */
- variant?: "row" | "header";
- /** Pins the row while its body scrolls: nested rows under the stuck group header, a header against the scrollport (per variant). */
- sticky?: boolean;
- defaultOpen?: boolean;
- /** A work step (the thinking row): the row carries the `ui-activity` hook with this mark. */
- activity?: ActivityMark;
- /** Expanded body; the caller styles it (md body, output <pre>, …). */
- children: ReactNode;
-}) {
- const [open, setOpen] = useState(defaultOpen);
- const rootRef = useRef<HTMLDivElement>(null);
- const header = variant === "header";
- const rowClass = header ? DISCLOSURE_HEADER_ROW_CLASS : DISCLOSURE_ROW_CLASS;
- const stickyClass = header ? DISCLOSURE_HEADER_STICKY_CLASS : DISCLOSURE_ROW_STICKY_CLASS;
- const labelClass = header
- ? `${DISCLOSURE_HEADER_TITLE_CLASS} text-gray-500 dark:text-gray-400`
- : DISCLOSURE_LABEL_CLASS;
- return (
- <div ref={rootRef}>
- <button
- type="button"
- onClick={() => {
- // Collapsing while the row is stuck: its real top sits above the fold — land the
- // view back on the row (nearest = no movement for expanding / in-view collapse).
- const willClose = open;
- setOpen((v) => !v);
- if (willClose) {
- requestAnimationFrame(() => rootRef.current?.scrollIntoView({ block: "nearest" }));
- }
- }}
- aria-expanded={open}
- className={`${activity ? "ui-activity " : ""}${sticky ? `${stickyClass} ` : ""}${rowClass}`}
- data-kind={activity?.kind}
- data-state={activity?.state}
- >
- {icon}
- <span className={labelClass} {...(activity ? { "data-slot": "label" } : {})}>
- {label}
- </span>
- {trailing}
- {activity && <ActivityProgress running={activity.state === "running"} />}
- <span className="min-w-0 flex-1" />
- <Chevron open={open} className="text-gray-400" />
- </button>
- {open && children}
- </div>
- );
-}
diff --git a/packages/web/src/features/chat/harness-banner.tsx b/packages/web/src/features/chat/harness-banner.tsx
index fb0cade9..a1ad250a 100644
--- a/packages/web/src/features/chat/harness-banner.tsx
+++ b/packages/web/src/features/chat/harness-banner.tsx
@@ -5,13 +5,14 @@
* machine-composed protocol, worth a glance, not a read. Expanded, the full text shows in
* the tool cards' output styling; the Trace page shows the raw message as-is.
*/
-import { GlyphIcon, ICONS } from "@prismshadow/penguin-ui";
-import { S } from "../../lib/strings";
import {
DISCLOSURE_CARD_CLASS,
DISCLOSURE_OUTPUT_PRE_CLASS,
DisclosureRow,
-} from "./disclosure-row";
+ GlyphIcon,
+ ICONS,
+} from "@prismshadow/penguin-ui";
+import { S } from "../../lib/strings";
export function HarnessInjectedBanner({ text }: { text: string }) {
return (
diff --git a/packages/web/src/features/chat/live-duration.tsx b/packages/web/src/features/chat/live-duration.tsx
deleted file mode 100644
index 33c188d1..00000000
--- a/packages/web/src/features/chat/live-duration.tsx
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- * Two readings of a running item's elapsed time, and only one of them is a clock.
- * `LiveDuration` is the inline display on running thinking/tool cards: it ticks every second,
- * showing whole seconds only — decimals appear only on the settled value once the item
- * finishes. sinceMs comes from the server-side message timestamp and may drift from the local
- * clock; negative values are shown as 0; a pulsing ellipsis is shown when missing. `offsetMs`
- * is the already-settled duration of a prior segment (e.g. a tool call's argument generation
- * phase), added on top of the live segment as it ticks.
- * `useElapsedPast` answers a single threshold question instead, and re-renders once, at the
- * crossing — a caller that only shows or hides something has nothing to do with a tick.
- */
-import { useEffect, useState } from "react";
-import { humanizeDurationLive } from "../../lib/format";
-
-/**
- * Whether `sinceMs` has been running for `thresholdMs`: false until that moment, then true.
- * One re-render at the crossing rather than a ticking clock — the answer changes once, so
- * anything finer would only cost renders. Undefined `sinceMs` (nothing running, or no start
- * time known) reads as false for as long as it stays undefined.
- */
-export function useElapsedPast(sinceMs: number | undefined, thresholdMs: number): boolean {
- const [reached, setReached] = useState(
- () => sinceMs !== undefined && Date.now() - sinceMs >= thresholdMs,
- );
- useEffect(() => {
- if (sinceMs === undefined) {
- setReached(false);
- return;
- }
- const remaining = thresholdMs - (Date.now() - sinceMs);
- if (remaining <= 0) {
- setReached(true);
- return;
- }
- setReached(false);
- const id = setTimeout(() => setReached(true), remaining);
- return () => clearTimeout(id);
- }, [sinceMs, thresholdMs]);
- // The `sinceMs` term is load-bearing: on the render where it goes undefined the effect that
- // clears `reached` has not run yet, so the state still holds the previous subject's answer.
- return reached && sinceMs !== undefined;
-}
-
-export function LiveDuration({ sinceMs, offsetMs = 0 }: { sinceMs?: number; offsetMs?: number }) {
- const [now, setNow] = useState(() => Date.now());
- useEffect(() => {
- const id = setInterval(() => setNow(Date.now()), 1000);
- return () => clearInterval(id);
- }, []);
- if (sinceMs === undefined) return <span className="animate-pulse">…</span>;
- return <>{humanizeDurationLive(Math.max(0, offsetMs) + Math.max(0, now - sinceMs))}</>;
-}
diff --git a/packages/web/src/features/chat/step-banner.tsx b/packages/web/src/features/chat/step-banner.tsx
index 51756034..218a281e 100644
--- a/packages/web/src/features/chat/step-banner.tsx
+++ b/packages/web/src/features/chat/step-banner.tsx
@@ -17,10 +17,9 @@
*/
import { useEffect, useRef, useState } from "react";
import type { ReactNode } from "react";
-import { Chevron, StatusIcon } from "@prismshadow/penguin-ui";
+import { Chevron, LiveDuration, StatusIcon } from "@prismshadow/penguin-ui";
import type { RunState } from "@prismshadow/penguin-ui";
import { humanizeDuration } from "../../lib/format";
-import { LiveDuration } from "./live-duration";
import { toneInk } from "../../lib/tone";
export function StepBanner({
diff --git a/packages/web/src/features/chat/task-stats-line.tsx b/packages/web/src/features/chat/task-stats-line.tsx
index 3c574187..ad601a57 100644
--- a/packages/web/src/features/chat/task-stats-line.tsx
+++ b/packages/web/src/features/chat/task-stats-line.tsx
@@ -28,7 +28,7 @@
*/
import { useState } from "react";
import type { TracePosition } from "@prismshadow/penguin-server/api";
-import { ConfirmModal, CopyButton, GlyphIcon, Spinner } from "@prismshadow/penguin-ui";
+import { ConfirmModal, CopyButton, Spinner, StatChip } from "@prismshadow/penguin-ui";
import { formatTaskStats } from "../../lib/omni/task-stats";
import type { TaskStats } from "../../lib/omni/task-stats";
import {
@@ -49,40 +49,6 @@ export interface ForkTarget {
position?: TracePosition;
}
-/**
- * Icon + value; hover explains what this item is (the icon alone doesn't convey the exact
- * meaning). `display` swaps the default `flex` for a responsive variant (the TPS chip is
- * `hidden sm:flex`); `compactValue`, when it differs, replaces the value below sm — fewer
- * decimals so the one-line stats row fits a phone without needing its scroll fallback.
- */
-function StatChip({
- icon,
- value,
- compactValue,
- label,
- display = "flex",
-}: {
- icon: string;
- value: string;
- compactValue?: string;
- label: string;
- display?: string;
-}) {
- return (
- <span data-tooltip={label} aria-label={label} className={`${display} items-center gap-1`}>
- <GlyphIcon d={icon} />
- {compactValue !== undefined && compactValue !== value ? (
- <>
- <span className="sm:hidden">{compactValue}</span>
- <span className="hidden sm:inline">{value}</span>
- </>
- ) : (
- value
- )}
- </span>
- );
-}
-
export function TaskStatsLine({
stats,
assistantText,
@@ -151,31 +117,31 @@ export function TaskStatsLine({
{stats && b && (
<>
<StatChip
- icon={STAT_ICONS.input}
+ glyph={STAT_ICONS.input}
value={humanizeTokens(input)}
label={S.chat.statInput}
/>
<StatChip
- icon={STAT_ICONS.output}
+ glyph={STAT_ICONS.output}
value={humanizeTokens(b.output)}
label={S.chat.statOutput}
/>
<StatChip
- icon={STAT_ICONS.tps}
+ glyph={STAT_ICONS.tps}
value={formatTps(stats.outputTps)}
label={S.chat.statTps}
- display="hidden sm:flex"
+ wideOnly
/>
{cost != null && (
<StatChip
- icon={STAT_ICONS.cost}
+ glyph={STAT_ICONS.cost}
value={formatMoney(cost, currency)}
compactValue={formatMoney(cost, currency, { compact: true })}
label={`${S.common.cost}(${currency})`}
/>
)}
<StatChip
- icon={STAT_ICONS.elapsed}
+ glyph={STAT_ICONS.elapsed}
value={humanizeDuration(stats.elapsedDeltaMs)}
compactValue={humanizeDuration(stats.elapsedDeltaMs, { compact: true })}
label={S.chat.statElapsed}
diff --git a/packages/web/src/features/chat/thinking-block.tsx b/packages/web/src/features/chat/thinking-block.tsx
index c21b2452..ade0ca1c 100644
--- a/packages/web/src/features/chat/thinking-block.tsx
+++ b/packages/web/src/features/chat/thinking-block.tsx
@@ -5,13 +5,18 @@
* same source every other disclosure row uses; shares the running-state icons (in progress /
* done / failed) with tool cards.
*/
-import { Md, StatusIcon } from "@prismshadow/penguin-ui";
+import {
+ DISCLOSURE_BODY_MD_CLASS,
+ DisclosureRow,
+ LiveDuration,
+ Md,
+ StatusIcon,
+ activityState,
+} from "@prismshadow/penguin-ui";
import type { RunState } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
import { humanizeDuration } from "../../lib/format";
import type { ThinkingItem } from "../../lib/omni/stream-model";
-import { DISCLOSURE_BODY_MD_CLASS, DisclosureRow, activityState } from "./disclosure-row";
-import { LiveDuration } from "./live-duration";
export function ThinkingBlock({ item }: { item: ThinkingItem }) {
const failed = item.stopReason !== undefined && item.stopReason !== "completed";
diff --git a/packages/web/src/features/chat/tool-call-card.tsx b/packages/web/src/features/chat/tool-call-card.tsx
index 7c6da4d9..0be5ff4c 100644
--- a/packages/web/src/features/chat/tool-call-card.tsx
+++ b/packages/web/src/features/chat/tool-call-card.tsx
@@ -16,7 +16,18 @@
*/
import { useMemo, useRef, useState } from "react";
import { DETACHED_TOOL_NOTE_PREFIX } from "@prismshadow/penguin-core/interfaces";
-import { Chevron, StatusIcon, ZoomableImage } from "@prismshadow/penguin-ui";
+import {
+ ActivityProgress,
+ Chevron,
+ DISCLOSURE_OUTPUT_PRE_CLASS,
+ DISCLOSURE_ROW_CLASS,
+ DISCLOSURE_ROW_STICKY_CLASS,
+ LiveDuration,
+ StatusIcon,
+ ZoomableImage,
+ activityState,
+ useElapsedPast,
+} from "@prismshadow/penguin-ui";
import type { RunState } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
import { humanizeDuration } from "../../lib/format";
@@ -24,16 +35,8 @@ import { toolDisplayName } from "../../lib/tool-alias";
import { stripAnsi } from "../../lib/strip-ansi";
import { approvalKey } from "../../lib/omni/stream-model";
import type { ToolCallItem } from "../../lib/omni/stream-model";
-import {
- ActivityProgress,
- DISCLOSURE_OUTPUT_PRE_CLASS,
- DISCLOSURE_ROW_CLASS,
- DISCLOSURE_ROW_STICKY_CLASS,
- activityState,
-} from "./disclosure-row";
import { toneInk } from "../../lib/tone";
import { ApprovalButtons } from "./approval-buttons";
-import { LiveDuration, useElapsedPast } from "./live-duration";
import { useTheme } from "../../state/theme";
import { agentIdFromRunSubagentArgs } from "./agent-topology";
import { SubagentChip } from "./subagent-chip";
diff --git a/packages/web/src/features/chat/work-group.tsx b/packages/web/src/features/chat/work-group.tsx
index 19583733..bba831c5 100644
--- a/packages/web/src/features/chat/work-group.tsx
+++ b/packages/web/src/features/chat/work-group.tsx
@@ -19,19 +19,20 @@
* group away from the end, or the Task has actually finished.
*/
import { useEffect, useRef, useState } from "react";
-import { Chevron, StatusIcon } from "@prismshadow/penguin-ui";
-import { S } from "../../lib/strings";
-import { humanizeDuration } from "../../lib/format";
import {
ActivityProgress,
+ Chevron,
DISCLOSURE_CARD_CLASS,
DISCLOSURE_HEADER_ROW_CLASS,
DISCLOSURE_HEADER_STICKY_CLASS,
DISCLOSURE_HEADER_TITLE_CLASS,
-} from "./disclosure-row";
+ LiveDuration,
+ StatusIcon,
+} from "@prismshadow/penguin-ui";
+import { S } from "../../lib/strings";
+import { humanizeDuration } from "../../lib/format";
import { approvalKey } from "../../lib/omni/stream-model";
import type { ChatItem } from "../../lib/omni/stream-model";
-import { LiveDuration } from "./live-duration";
import { MessageItem } from "./message-item";
import type { StreamRenderContext } from "./message-stream";
import { summarizeWork } from "./work-summary";
diff --git a/packages/web/src/features/company/calendar-page.tsx b/packages/web/src/features/company/calendar-page.tsx
index 74f14e88..c15e960d 100644
--- a/packages/web/src/features/company/calendar-page.tsx
+++ b/packages/web/src/features/company/calendar-page.tsx
@@ -28,7 +28,7 @@ import type {
} from "@prismshadow/penguin-server/api";
import {
Button,
- CloseIcon,
+ Card,
ConfirmModal,
GlyphIcon,
ICONS,
@@ -36,7 +36,7 @@ import {
ICON_SIZE,
Input,
Modal,
- NoticeStrip,
+ Notice,
Segmented,
Select,
Skeleton,
@@ -144,7 +144,7 @@ const CREATE_SLOT_CLASS =
function CreateSlotHint({ className = "" }: { className?: string }) {
return (
<span
- className={`pointer-events-none z-10 inline-flex items-center ${ICON_GAP.tight} text-[10px] leading-4 text-gray-500 opacity-0 transition-opacity duration-150 group-hover/slot:opacity-100 group-focus-visible/slot:opacity-100 dark:text-gray-400 ${className}`}
+ className={`pointer-events-none z-10 inline-flex items-center ${ICON_GAP.tight} text-xs leading-4 text-gray-500 opacity-0 transition-opacity duration-150 group-hover/slot:opacity-100 group-focus-visible/slot:opacity-100 dark:text-gray-400 ${className}`}
>
<GlyphIcon d={ICONS.plus} size={ICON_SIZE.inlineGlyph} />
{S.company.calendar.create}
@@ -417,7 +417,7 @@ export function CalendarPage() {
opts.onOpen?.();
openEdit(i.event);
}}
- className={`flex min-w-0 items-center gap-1 rounded px-1 text-left text-[11px] leading-5 transition-opacity ${color.chip} ${
+ className={`flex min-w-0 items-center gap-1 rounded px-1 text-left text-xs leading-5 transition-opacity ${color.chip} ${
opts.block ? "h-full w-full" : "w-full"
} ${i.past && outcome === null ? "opacity-60" : ""} ${
inert ? "line-through decoration-1 opacity-60" : ""
@@ -506,7 +506,7 @@ export function CalendarPage() {
<div className="pointer-events-none relative pb-5">
<p className="mb-1 flex h-5 items-center">
<span
- className={`inline-flex h-5 min-w-5 items-center justify-center rounded-full px-1 text-[11px] tabular-nums ${
+ className={`inline-flex h-5 min-w-5 items-center justify-center rounded-full px-1 text-xs tabular-nums ${
isToday
? "bg-accent font-semibold text-accent-fg"
: day.inMonth
@@ -517,7 +517,7 @@ export function CalendarPage() {
{new Date(day.dayStartMs).getDate()}
</span>
</p>
- <div className="space-y-0.5">
+ <div className="space-y-1">
{shown.map((i) => (
<span key={i.key} className="pointer-events-auto block">
{chip(i)}
@@ -615,55 +615,57 @@ export function CalendarPage() {
const cols = days.length === 1 ? "grid-cols-[3rem_1fr]" : "grid-cols-[3rem_repeat(7,1fr)]";
return (
<div className="overflow-x-auto">
- <div
- className={`${days.length === 1 ? "" : "min-w-[52rem]"} overflow-hidden rounded-md border border-gray-200 dark:border-gray-800`}
- >
- <div
- className={`grid ${cols} border-b border-gray-200 text-[11px] font-medium text-gray-500 dark:border-gray-800 dark:text-gray-400`}
- >
- <div />
- {days.map((day) => {
- const d = new Date(day.dayStartMs);
- const isToday = day.key === todayKey;
- return (
- <div
- key={day.key}
- className={`flex items-center gap-1.5 border-l border-gray-100 px-2 py-1.5 dark:border-gray-800 ${
- isToday ? "font-semibold text-gray-900 dark:text-gray-100" : ""
- }`}
- >
- {S.company.calendar.weekdays[(d.getDay() + 6) % 7]}
- <span
- className={`inline-flex h-5 min-w-5 items-center justify-center rounded-full px-1 tabular-nums ${
- isToday ? "bg-accent text-accent-fg" : ""
+ {/* The width floor sits on a wrapper: the card keeps its own `min-w-0`. */}
+ <div className={days.length === 1 ? "" : "min-w-[52rem]"}>
+ <Card padding="none">
+ <div
+ className={`grid ${cols} border-b border-gray-200 text-xs font-medium text-gray-500 dark:border-gray-800 dark:text-gray-400`}
+ >
+ <div />
+ {days.map((day) => {
+ const d = new Date(day.dayStartMs);
+ const isToday = day.key === todayKey;
+ return (
+ <div
+ key={day.key}
+ className={`flex items-center gap-1.5 border-l border-gray-100 px-2 py-1.5 dark:border-gray-800 ${
+ isToday ? "font-semibold text-gray-900 dark:text-gray-100" : ""
}`}
>
- {d.getDate()}
- </span>
+ {S.company.calendar.weekdays[(d.getDay() + 6) % 7]}
+ <span
+ className={`inline-flex h-5 min-w-5 items-center justify-center rounded-full px-1 tabular-nums ${
+ isToday ? "bg-accent text-accent-fg" : ""
+ }`}
+ >
+ {d.getDate()}
+ </span>
+ </div>
+ );
+ })}
+ </div>
+ <div
+ ref={scrollRef}
+ className="overflow-y-auto"
+ style={{ height: VISIBLE_HOURS * HOUR_PX }}
+ >
+ <div className={`grid ${cols}`}>
+ <div className="relative" style={{ height: HOUR_PX * 24 }}>
+ {Array.from({ length: 24 }, (_, h) => (
+ // Centred on its hour line: half the label's 16px line box above it.
+ <span
+ key={h}
+ className="absolute right-2 font-mono text-xs tabular-nums text-gray-400 dark:text-gray-500"
+ style={{ top: h * HOUR_PX - 8 }}
+ >
+ {h === 0 ? "" : hourLabel(h)}
+ </span>
+ ))}
</div>
- );
- })}
- </div>
- <div
- ref={scrollRef}
- className="overflow-y-auto"
- style={{ height: VISIBLE_HOURS * HOUR_PX }}
- >
- <div className={`grid ${cols}`}>
- <div className="relative" style={{ height: HOUR_PX * 24 }}>
- {Array.from({ length: 24 }, (_, h) => (
- <span
- key={h}
- className="absolute right-2 font-mono text-[10px] tabular-nums text-gray-400 dark:text-gray-500"
- style={{ top: h * HOUR_PX - 6 }}
- >
- {h === 0 ? "" : hourLabel(h)}
- </span>
- ))}
+ {days.map(timeColumn)}
</div>
- {days.map(timeColumn)}
</div>
- </div>
+ </Card>
</div>
</div>
);
@@ -672,22 +674,24 @@ export function CalendarPage() {
const grid =
view === "month" ? (
<div className="overflow-x-auto">
- <div className="min-w-[44rem] overflow-hidden rounded-md border border-gray-200 dark:border-gray-800">
- <div className="grid grid-cols-7 border-b border-gray-200 text-[11px] font-medium text-gray-500 dark:border-gray-800 dark:text-gray-400">
- {S.company.calendar.weekdays.map((w) => (
- <div key={w} className="px-2 py-1.5">
- {w}
+ <div className="min-w-[44rem]">
+ <Card padding="none">
+ <div className="grid grid-cols-7 border-b border-gray-200 text-xs font-medium text-gray-500 dark:border-gray-800 dark:text-gray-400">
+ {S.company.calendar.weekdays.map((w) => (
+ <div key={w} className="px-2 py-1.5">
+ {w}
+ </div>
+ ))}
+ </div>
+ {monthGrid(anchor).map((row, r) => (
+ <div
+ key={r}
+ className="grid grid-cols-7 border-b border-gray-100 last:border-b-0 dark:border-gray-800"
+ >
+ {row.map(monthCell)}
</div>
))}
- </div>
- {monthGrid(anchor).map((row, r) => (
- <div
- key={r}
- className="grid grid-cols-7 border-b border-gray-100 last:border-b-0 dark:border-gray-800"
- >
- {row.map(monthCell)}
- </div>
- ))}
+ </Card>
</div>
</div>
) : view === "week" ? (
@@ -749,7 +753,7 @@ export function CalendarPage() {
{/* Legend: one entry per employee in the chart's colour order, naming its cadence; a click
filters to it, and strikes through everyone it just switched off. */}
{employees.length > 0 && (
- <div className="mb-3 flex flex-wrap gap-x-1 gap-y-1 text-[11px]">
+ <div className="mb-3 flex flex-wrap gap-x-1 gap-y-1 text-xs">
{employees.map((e) => {
const own = (events ?? []).filter((ev) => ev.agentId === e.agentId);
const cadences = own.map(
@@ -801,52 +805,44 @@ export function CalendarPage() {
)}
{error !== null && (
- <NoticeStrip
+ <Notice
tone="danger"
- className="mb-3 flex flex-wrap items-center justify-between gap-2 rounded-md border px-3 py-2 text-xs"
+ role="alert"
+ className="mb-3"
+ retry={{ label: S.common.retry, onClick: () => void load() }}
>
- <span>{S.company.calendar.loadFailed(error)}</span>
- <Button size="sm" onClick={() => void load()}>
- {S.common.retry}
- </Button>
- </NoticeStrip>
+ {S.company.calendar.loadFailed(error)}
+ </Notice>
)}
{events !== null && events.length === 0 && invalidFiles.length === 0 && !hintDismissed && (
- <NoticeStrip
+ <Notice
tone="neutral"
- className="mb-3 flex items-center gap-2 rounded-md border px-3 py-2 text-xs"
- >
- <span className="min-w-0 flex-1">{S.company.calendar.emptyHint}</span>
- <Button
- size="icon"
- variant="ghost"
- className="shrink-0"
- title={S.company.calendar.dismissHint}
- aria-label={S.company.calendar.dismissHint}
- onClick={() => {
+ className="mb-3"
+ dismiss={{
+ ariaLabel: S.company.calendar.dismissHint,
+ onClick: () => {
dismissHint(emptyHintKey);
setHintDismissed(true);
- }}
- >
- <CloseIcon />
- </Button>
- </NoticeStrip>
+ },
+ }}
+ >
+ {S.company.calendar.emptyHint}
+ </Notice>
)}
{events === null && error === null ? <CalendarSkeleton view={view} /> : grid}
{invalidFiles.length > 0 && (
- <NoticeStrip tone="danger" className="mt-4 rounded-md border px-3 py-2 text-xs">
- <p className="mb-1 font-medium">{S.company.calendar.invalidFiles}</p>
- <ul className="space-y-0.5 font-mono">
+ <Notice tone="danger" title={S.company.calendar.invalidFiles} className="mt-4">
+ <ul className="mt-1 space-y-1 font-mono">
{invalidFiles.map((f) => (
<li key={`${f.agentId}/${f.name}`}>
{f.agentId}/{f.name}: {f.error}
</li>
))}
</ul>
- </NoticeStrip>
+ </Notice>
)}
{/* Create / edit dialog: the scheduled-task form minus its target, the employee as a select. */}
@@ -1076,8 +1072,9 @@ function DayOverflow({
const { triggerRef, panelRef, position } = usePortalPanel({
open,
onClose: () => setOpen(false),
- // A chip row is 20px tall; the header and the panel's own padding add about 40.
- estimatedHeight: total * 22 + 40,
+ // A chip row is 20px tall with 4px between rows; the header and the panel's own padding add
+ // about 40.
+ estimatedHeight: total * 24 + 40,
panelWidth: DAY_PANEL_WIDTH,
});
const close = () => setOpen(false);
@@ -1092,7 +1089,7 @@ function DayOverflow({
aria-expanded={open}
aria-controls={panelId}
onClick={() => setOpen((v) => !v)}
- className="block w-full rounded px-1 text-left text-[10px] text-gray-400 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-600 dark:text-gray-500 dark:hover:bg-gray-800 dark:hover:text-gray-300"
+ className="block w-full rounded px-1 text-left text-xs text-gray-400 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-600 dark:text-gray-500 dark:hover:bg-gray-800 dark:hover:text-gray-300"
>
{S.company.calendar.moreEvents(hidden)}
</button>
@@ -1114,7 +1111,7 @@ function DayOverflow({
className="anim-pop z-[60] flex max-h-[70vh] max-w-[calc(100vw-2rem)] flex-col rounded-md border border-gray-200 bg-white shadow-lg dark:border-gray-700 dark:bg-gray-900"
>
<div className="flex items-center justify-between gap-2 border-b border-gray-100 px-2 py-1.5 dark:border-gray-800">
- <span className="truncate text-[11px] font-medium tabular-nums text-gray-700 dark:text-gray-200">
+ <span className="truncate text-xs font-medium tabular-nums text-gray-700 dark:text-gray-200">
{dateLabel}
</span>
<button
@@ -1123,12 +1120,12 @@ function DayOverflow({
close();
onOpenDay();
}}
- className="shrink-0 text-[11px] text-gray-500 underline-offset-2 transition-colors duration-150 hover:text-gray-900 hover:underline dark:text-gray-400 dark:hover:text-gray-100"
+ className="shrink-0 text-xs text-gray-500 underline-offset-2 transition-colors duration-150 hover:text-gray-900 hover:underline dark:text-gray-400 dark:hover:text-gray-100"
>
{S.company.calendar.openDay}
</button>
</div>
- <div className="space-y-0.5 overflow-y-auto p-1">{children(close)}</div>
+ <div className="space-y-1 overflow-y-auto p-1">{children(close)}</div>
</div>,
document.body,
)}
@@ -1141,36 +1138,38 @@ function CalendarSkeleton({ view }: { view: CalendarView }) {
if (view === "month") {
return (
<div className="overflow-x-auto">
- <div className="min-w-[44rem] overflow-hidden rounded-md border border-gray-200 dark:border-gray-800">
- <div className="grid grid-cols-7 border-b border-gray-200 dark:border-gray-800">
- {Array.from({ length: 7 }, (_, i) => (
- <div key={i} className="px-2 py-2">
- <Skeleton className="h-3 w-8" />
- </div>
- ))}
- </div>
- {Array.from({ length: 5 }, (_, r) => (
- <div
- key={r}
- className="grid grid-cols-7 border-b border-gray-100 last:border-b-0 dark:border-gray-800"
- >
- {Array.from({ length: 7 }, (_, c) => (
- <div
- key={c}
- className="min-h-24 space-y-1 border-r border-gray-100 p-1.5 last:border-r-0 dark:border-gray-800"
- >
- <Skeleton className="h-3 w-4" />
- {(r + c) % 3 === 0 && <Skeleton className="h-4 w-full" />}
+ <div className="min-w-[44rem]">
+ <Card padding="none">
+ <div className="grid grid-cols-7 border-b border-gray-200 dark:border-gray-800">
+ {Array.from({ length: 7 }, (_, i) => (
+ <div key={i} className="px-2 py-2">
+ <Skeleton className="h-3 w-8" />
</div>
))}
</div>
- ))}
+ {Array.from({ length: 5 }, (_, r) => (
+ <div
+ key={r}
+ className="grid grid-cols-7 border-b border-gray-100 last:border-b-0 dark:border-gray-800"
+ >
+ {Array.from({ length: 7 }, (_, c) => (
+ <div
+ key={c}
+ className="min-h-24 space-y-1 border-r border-gray-100 p-1.5 last:border-r-0 dark:border-gray-800"
+ >
+ <Skeleton className="h-3 w-4" />
+ {(r + c) % 3 === 0 && <Skeleton className="h-4 w-full" />}
+ </div>
+ ))}
+ </div>
+ ))}
+ </Card>
</div>
</div>
);
}
return (
- <div className="overflow-hidden rounded-md border border-gray-200 dark:border-gray-800">
+ <Card padding="none">
<div className="flex gap-4 border-b border-gray-200 px-14 py-2 dark:border-gray-800">
{Array.from({ length: view === "week" ? 7 : 1 }, (_, i) => (
<Skeleton key={i} className="h-3 w-12" />
@@ -1184,6 +1183,6 @@ function CalendarSkeleton({ view }: { view: CalendarView }) {
</div>
))}
</div>
- </div>
+ </Card>
);
}
diff --git a/packages/web/src/features/company/channel-sidebar.tsx b/packages/web/src/features/company/channel-sidebar.tsx
index f7529326..ea593d58 100644
--- a/packages/web/src/features/company/channel-sidebar.tsx
+++ b/packages/web/src/features/company/channel-sidebar.tsx
@@ -18,11 +18,13 @@ import { NavLink, useNavigate } from "react-router";
import type { OrgChannelItem } from "@prismshadow/penguin-server/api";
import {
Button,
+ FolderSection,
GlyphIcon,
ICON_GAP,
ICON_SIZE,
PlusIcon,
SkeletonList,
+ Text,
toastError,
toastSuccess,
} from "@prismshadow/penguin-ui";
@@ -32,7 +34,7 @@ import { apiErrorText } from "../../lib/api-error";
import { toneInk, toneSurface } from "../../lib/tone";
import { useAuth } from "../../state/auth";
import { useCompany } from "../../state/company";
-import { FolderSection, Icon } from "../../components/ui/group-list";
+import { Icon } from "../../components/ui/group-list";
import { Truncated } from "../../components/ui/truncated";
import { orgChannelPath } from "./company-nav";
import { JoinChannelConfirm, NewChannelDialog } from "./channel-dialogs";
@@ -145,14 +147,12 @@ function ChannelRow({
</span>
<Truncated text={label} className="min-w-0 flex-1" />
{channel.mentionsMe > 0 && (
- <span
- className={`shrink-0 rounded px-1 text-[10px] font-semibold ${toneSurface.attention}`}
- >
+ <span className={`shrink-0 rounded px-1 text-xs font-semibold ${toneSurface.attention}`}>
{S.company.channels.mentionChip}
</span>
)}
{channel.unread > 0 && (
- <span className="shrink-0 text-[11px] tabular-nums text-gray-500 dark:text-gray-400">
+ <span className="shrink-0 text-xs tabular-nums text-gray-500 dark:text-gray-400">
{channel.unread}
</span>
)}
@@ -164,7 +164,7 @@ function ChannelRow({
<button
type="button"
onClick={join}
- className="pointer-events-none absolute right-1 top-1/2 -translate-y-1/2 rounded bg-gray-200 px-1.5 py-0.5 text-[11px] text-gray-600 opacity-0 transition-opacity duration-150 hover:text-gray-900 focus:pointer-events-auto focus:opacity-100 group-hover:pointer-events-auto group-hover:opacity-100 dark:bg-gray-700 dark:text-gray-300 dark:hover:text-gray-100"
+ className="pointer-events-none absolute right-1 top-1/2 -translate-y-1/2 rounded bg-gray-200 px-1.5 py-0.5 text-xs text-gray-600 opacity-0 transition-opacity duration-150 hover:text-gray-900 focus:pointer-events-auto focus:opacity-100 group-hover:pointer-events-auto group-hover:opacity-100 dark:bg-gray-700 dark:text-gray-300 dark:hover:text-gray-100"
>
{S.company.channels.join}
</button>
@@ -176,7 +176,7 @@ function ChannelRow({
/** A run's title inside the list (My channels / Other channels), with how many it holds. */
function GroupTitle({ label, count }: { label: string; count: number }) {
return (
- <p className="flex items-center gap-1.5 px-2.5 pb-0.5 pt-2.5 text-[11px] font-medium text-gray-500 dark:text-gray-400">
+ <p className="flex items-center gap-1.5 px-2.5 pb-0.5 pt-2.5 text-xs font-medium text-gray-500 dark:text-gray-400">
<span className="min-w-0 truncate">{label}</span>
<span className="tabular-nums text-gray-400 dark:text-gray-500">{count}</span>
</p>
@@ -236,9 +236,9 @@ export function ChannelSidebar({
{/* The list's header, at the height and density of the development list's own, with
"New channel" as its trailing action. */}
<div className="mt-3 flex items-center justify-between gap-2 px-1 pt-2">
- <span className="px-1 text-[11px] font-semibold uppercase tracking-wide text-gray-400 dark:text-gray-500">
+ <Text variant="eyebrow" as="span" className="px-1">
{S.company.channels.listTitle}
- </span>
+ </Text>
<NewChannelButton
projectId={projectId}
orgId={orgId}
@@ -258,7 +258,7 @@ export function ChannelSidebar({
)
) : (
<>
- <ul className="space-y-0.5 pt-1">
+ <ul className="space-y-1 pt-1">
{groups.allHands !== null && row(groups.allHands)}
{groups.mine.length > 0 && (
<li>
@@ -279,7 +279,7 @@ export function ChannelSidebar({
open={archivedOpen}
onToggle={() => setArchivedOpen((v) => !v)}
>
- <ul className="space-y-0.5">{groups.archived.map((c) => row(c))}</ul>
+ <ul className="space-y-1">{groups.archived.map((c) => row(c))}</ul>
</FolderSection>
)}
{groups.allHands === null &&
@@ -341,7 +341,7 @@ export function ChannelRailRows({ projectId, orgId }: { projectId: string; orgId
// back to expanding it just to look.
<span
aria-hidden
- className={`absolute -right-0.5 -top-0.5 min-w-[14px] rounded-full px-1 text-[9px] font-semibold leading-[14px] tabular-nums ${
+ className={`absolute -right-0.5 -top-0.5 min-w-[14px] rounded-full px-1 text-xs font-semibold leading-[14px] tabular-nums ${
channel.mentionsMe > 0
? toneSurface.attention
: "bg-gray-300 text-gray-800 dark:bg-gray-700 dark:text-gray-100"
diff --git a/packages/web/src/features/company/beta-badge.tsx b/packages/web/src/features/company/company-beta.tsx
similarity index 59%
rename from packages/web/src/features/company/beta-badge.tsx
rename to packages/web/src/features/company/company-beta.tsx
index cb91ec8e..eba69648 100644
--- a/packages/web/src/features/company/beta-badge.tsx
+++ b/packages/web/src/features/company/company-beta.tsx
@@ -1,12 +1,10 @@
/**
* Company mode says it is a beta, in the two shapes that fact takes in the shell.
*
- * The tag — a mini 内测版 / Beta mark riding at the top-right of 「公司」 in the 开发 | 公司
- * work-mode switch, which is the one control that names the mode itself and is in view on
- * every page of both modes. A superscript rather than a `Badge`: it qualifies the word it
- * sits on instead of reporting a state, so it must not read as a status mark, and at that
- * size it must not push the switch's two options around either — segmented.tsx pins it out
- * of flow and folds its text into the option's accessible name.
+ * The tag — the package's `BetaBadge` in this app's words, a mini "Beta" mark riding at the
+ * top-right of "Company" in the Development | Company work-mode switch, which is the one control
+ * that names the mode itself and is in view on every page of both modes. The switch
+ * (`Segmented`) pins it out of flow and folds its text into the option's accessible name.
*
* The notice — the sentence a person gets the first time they switch this browser into the
* mode (state/company.tsx's `setWorkMode`), and the once-only decision behind it. The flag
@@ -14,6 +12,7 @@
* browser having shown a toast, not about the user: a second browser is a second first time,
* and a preferences round trip would decide it too late to toast on the click that caused it.
*/
+import { BetaBadge } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
/** The localStorage key remembering that this browser has shown the beta notice. */
@@ -50,20 +49,7 @@ export function markBetaNoticeShown(storage?: BetaNoticeStorage): void {
}
}
-/**
- * The tag itself: the smallest legible rung, in the muted ink and border that keep it from
- * reading as a status mark. The px size is deliberate — this is a superscript over a
- * `text-xs` option, and there is no rung below `text-xs` to step down to. Its host hides it
- * from the accessible name, so the tooltip is the only thing it says on its own, and it is a
- * `title` because the switch it rides on carries no `Tooltip` of any kind.
- */
-export function BetaBadge() {
- return (
- <span
- data-tooltip={S.company.betaTitle}
- className="whitespace-nowrap rounded-sm border border-gray-300 px-0.5 py-px text-[9px] font-medium leading-none text-gray-500 dark:border-gray-600 dark:text-gray-400"
- >
- {S.company.beta}
- </span>
- );
+/** The beta tag on the "Company" option, its tooltip saying what the beta means. */
+export function CompanyBetaBadge() {
+ return <BetaBadge label={S.company.beta} title={S.company.betaTitle} />;
}
diff --git a/packages/web/src/features/company/employee-dialogs.tsx b/packages/web/src/features/company/employee-dialogs.tsx
index 7afee932..a788035e 100644
--- a/packages/web/src/features/company/employee-dialogs.tsx
+++ b/packages/web/src/features/company/employee-dialogs.tsx
@@ -21,6 +21,7 @@ import {
ICONS,
Input,
Modal,
+ RuledSection,
Segmented,
Select,
Textarea,
@@ -39,7 +40,6 @@ import { useTheme } from "../../state/theme";
import { SkillPickList } from "../skills/skill-pick-list";
import type { PickableItem } from "../skills/skill-pick-list";
import { addSkillNames, removeSkillNames, toggleSkillName } from "../skills/skill-selection";
-import { OrgSection } from "./org-layout";
import { MoneyPerMonthInput } from "./shared";
import { fromStoredUsd, isBudgetText, toStoredUsd } from "./budget-input";
import { deskRenewPlan } from "./desk-renew";
@@ -223,8 +223,8 @@ export function HireDialog({
</>
}
>
- <div className="space-y-5">
- <OrgSection title={S.company.chart.hireAgentSection}>
+ <div className="space-y-6">
+ <RuledSection level={3} title={S.company.chart.hireAgentSection}>
<div className="space-y-3">
<div>
<FieldLabel>{S.company.chart.hireSource}</FieldLabel>
@@ -325,8 +325,8 @@ export function HireDialog({
</>
)}
</div>
- </OrgSection>
- <OrgSection title={S.company.chart.hirePositionSection}>
+ </RuledSection>
+ <RuledSection level={3} title={S.company.chart.hirePositionSection}>
<div className="space-y-3">
<Input
label={S.company.chart.employeeTitle}
@@ -370,7 +370,7 @@ export function HireDialog({
}}
/>
</div>
- </OrgSection>
+ </RuledSection>
</div>
</Modal>
<ConfirmModal
diff --git a/packages/web/src/features/company/finance-page.tsx b/packages/web/src/features/company/finance-page.tsx
index 6284e833..81f2444f 100644
--- a/packages/web/src/features/company/finance-page.tsx
+++ b/packages/web/src/features/company/finance-page.tsx
@@ -37,6 +37,8 @@ import {
AgentAvatar,
Badge,
Button,
+ Card,
+ CardHeader,
Chevron,
CloseIcon,
EmptyState,
@@ -45,8 +47,14 @@ import {
ICON_GAP,
ICON_SIZE,
InfoPopover,
- NoticeStrip,
Segmented,
+ StatTile,
+ Table,
+ TableBody,
+ TableCell,
+ TableHead,
+ TableHeaderCell,
+ TableRow,
noAutofill,
toastError,
toastSuccess,
@@ -66,10 +74,10 @@ import { NAV_ICONS } from "../../lib/nav-icons";
import { TrendChart } from "../usage/trend-chart";
import { OrgPage, OrgPageSkeleton, useOrg } from "./org-layout";
import {
+ ErrorLine,
INVALID_ICON,
MoneyPerMonthUnit,
PrincipalChip,
- StatTile,
StoredUsdNote,
TicketStatusBadge,
TitleButton,
@@ -98,10 +106,8 @@ import { agentPrincipal } from "./principals";
const PERCENT_ICON =
"M19 5 5 19M6.5 9a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5zM17.5 20a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5z";
-const cellClass = "px-2 py-2 text-right tabular-nums";
-const headClass = "px-2 py-1.5 text-[11px] font-medium text-gray-500 dark:text-gray-400";
const iconButtonClass =
- "inline-flex items-center justify-center rounded p-0.5 text-gray-400 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-700 disabled:opacity-50 dark:text-gray-500 dark:hover:bg-gray-800 dark:hover:text-gray-200";
+ "inline-flex items-center justify-center rounded p-1 text-gray-400 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-700 disabled:opacity-50 dark:text-gray-500 dark:hover:bg-gray-800 dark:hover:text-gray-200";
/** The tree's indentation step per reporting depth, and the elbow that joins a child to the row above. */
const INDENT_PX = 20;
@@ -125,7 +131,7 @@ function TreeElbow() {
function StateMark({ tone, children }: { tone: Tone; children: string }) {
return (
<span
- className={`inline-flex shrink-0 items-center ${ICON_GAP.tight} text-[11px] ${toneInk[tone]}`}
+ className={`inline-flex shrink-0 items-center ${ICON_GAP.tight} text-xs ${toneInk[tone]}`}
>
<span className={`block h-1.5 w-1.5 rounded-full ${toneDot[tone]}`} />
{children}
@@ -141,9 +147,10 @@ function stateMarkLabel(key: SpendStateKey): string {
}
/**
- * One panel of the finance page: a bordered card with its title inside it and the "?" anchored
- * to that title — the shape the KPI tiles and the cost centre's charts already use. The
- * period switch is the page's, not a panel's, so a card carries no controls of its own.
+ * One panel of the finance page: the package's card with its title inside it and the "?"
+ * anchored to that title — the shape the KPI tiles and the cost centre's charts already use.
+ * The period switch is the page's, not a panel's, so a card carries no controls of its own.
+ * The title sits under the page's own, so it is an h2.
*/
function FinanceCard({
title,
@@ -157,17 +164,10 @@ function FinanceCard({
className?: string;
}) {
return (
- <section
- className={`min-w-0 rounded-md border border-gray-200 bg-white p-3 dark:border-gray-800 dark:bg-gray-900 ${className}`}
- >
- <h2
- className={`mb-2 flex min-w-0 items-center ${ICON_GAP.row} text-xs font-medium text-gray-500 dark:text-gray-400`}
- >
- {title}
- {info !== undefined && <InfoPopover label={title}>{info}</InfoPopover>}
- </h2>
+ <Card as="section" className={className}>
+ <CardHeader title={title} {...(info !== undefined ? { info } : {})} level={2} />
{children}
- </section>
+ </Card>
);
}
@@ -207,7 +207,7 @@ function BudgetEditor({
return (
<span
ref={wrapRef}
- className="inline-flex flex-col items-end gap-0.5"
+ className="inline-flex flex-col items-end gap-1"
onBlur={(e) => {
if (!wrapRef.current?.contains(e.relatedTarget as Node | null)) commit();
}}
@@ -259,7 +259,7 @@ function BudgetEditor({
<CloseIcon />
</button>
</span>
- <span className="text-[10px] text-gray-400 dark:text-gray-500">
+ <span className="text-xs text-gray-400 dark:text-gray-500">
{S.company.finance.budgetEmptyHint}
</span>
<StoredUsdNote usd={toStoredUsd(text, currency)} currency={currency} />
@@ -444,17 +444,12 @@ export function FinancePage() {
return (
<OrgPage title={S.nav.org.finance} info={S.company.finance.info} actions={periodSwitch}>
{error !== null && (
- <NoticeStrip
- tone="danger"
- className="mb-4 flex items-center justify-between gap-2 rounded-md border px-3 py-1.5 text-xs"
- >
- <span>
- {S.company.finance.refreshFailed} · {error}
- </span>
- <Button size="sm" onClick={() => void load()}>
- {S.common.retry}
- </Button>
- </NoticeStrip>
+ <ErrorLine
+ message={S.company.finance.refreshFailed}
+ detail={error}
+ onRetry={() => void load()}
+ className="mb-4"
+ />
)}
<div className={stale ? "opacity-60 transition-opacity" : "transition-opacity"}>
{/* Top row: what the period cost against the budget, beside how it accumulated. */}
@@ -529,143 +524,137 @@ export function FinancePage() {
below the threshold they stack rather than scroll sideways. */}
<div className="mt-4 grid grid-cols-1 gap-4 2xl:grid-cols-2">
<FinanceCard title={S.company.finance.spendTree} info={S.company.finance.spendTreeInfo}>
- <div className="overflow-x-auto">
- <table className="w-full min-w-[20rem] text-xs">
- <thead>
- <tr>
- <th className={`${headClass} text-left`}>{S.company.overview.employees}</th>
- <th className={`${headClass} text-left`}>{S.company.status}</th>
- <th className={`${headClass} text-right`}>
- <span className={`inline-flex items-center ${ICON_GAP.tight}`}>
- {S.company.finance.cumulativeBudget}
- <InfoPopover label={S.company.finance.cumulativeBudget}>
- {S.company.finance.cumulativeInfo}
- </InfoPopover>
- </span>
- </th>
- </tr>
- </thead>
- <tbody className="divide-y divide-gray-100 dark:divide-gray-800/60">
- {rows.map(({ employee, depth }) => {
- const editing = editingId === employee.agentId;
- const marks = spendStateMarks(employee, states.get(employee.agentId));
- return (
- <tr
- key={employee.agentId}
- data-tooltip={spendRowTooltip(
- employee,
- {
- own: S.company.finance.own,
- cumulative: S.company.finance.cumulative,
- budget: S.company.finance.budget,
- noBudget: S.company.noBudget,
- },
- (value) => formatMoney(value, currency),
- )}
- >
- <td className="px-2 py-2" style={{ paddingLeft: 8 + depth * INDENT_PX }}>
- <span className={`flex min-w-0 items-center ${ICON_GAP.row}`}>
- {depth > 0 && <TreeElbow />}
- <AgentAvatar
- id={employee.agentId}
- name={employee.name}
- size={ICON_SIZE.navRow}
- className="shrink-0 rounded"
- />
- <span className="truncate font-medium text-gray-900 dark:text-gray-100">
- {employee.name}
- </span>
- {employee.reportsTo === null &&
- employee.title.trim().toLowerCase() !== "ceo" && (
- <Badge>{S.company.ceo}</Badge>
- )}
- <span className="truncate text-gray-400 dark:text-gray-500">
- {employee.title}
- </span>
+ <Table size="sm" framed={false} tableClassName="min-w-[20rem]">
+ <TableHead>
+ <TableHeaderCell>{S.company.overview.employees}</TableHeaderCell>
+ <TableHeaderCell>{S.company.status}</TableHeaderCell>
+ <TableHeaderCell align="right">
+ <span className={`inline-flex items-center ${ICON_GAP.tight}`}>
+ {S.company.finance.cumulativeBudget}
+ <InfoPopover label={S.company.finance.cumulativeBudget}>
+ {S.company.finance.cumulativeInfo}
+ </InfoPopover>
+ </span>
+ </TableHeaderCell>
+ </TableHead>
+ <TableBody>
+ {rows.map(({ employee, depth }) => {
+ const editing = editingId === employee.agentId;
+ const marks = spendStateMarks(employee, states.get(employee.agentId));
+ return (
+ <TableRow
+ key={employee.agentId}
+ data-tooltip={spendRowTooltip(
+ employee,
+ {
+ own: S.company.finance.own,
+ cumulative: S.company.finance.cumulative,
+ budget: S.company.finance.budget,
+ noBudget: S.company.noBudget,
+ },
+ (value) => formatMoney(value, currency),
+ )}
+ >
+ <TableCell style={{ paddingLeft: 8 + depth * INDENT_PX }}>
+ <span className={`flex min-w-0 items-center ${ICON_GAP.row}`}>
+ {depth > 0 && <TreeElbow />}
+ <AgentAvatar
+ id={employee.agentId}
+ name={employee.name}
+ size={ICON_SIZE.navRow}
+ className="shrink-0 rounded"
+ />
+ <span className="truncate font-medium text-gray-900 dark:text-gray-100">
+ {employee.name}
+ </span>
+ {employee.reportsTo === null &&
+ employee.title.trim().toLowerCase() !== "ceo" && (
+ <Badge>{S.company.ceo}</Badge>
+ )}
+ <span className="truncate text-gray-400 dark:text-gray-500">
+ {employee.title}
</span>
- </td>
- {/* How the employee stands: what it is doing right now, and what its
+ </span>
+ </TableCell>
+ {/* How the employee stands: what it is doing right now, and what its
budget has done to it. Empty while the chart join is in flight and
nothing has crossed a threshold — an empty cell says exactly that. */}
- <td className="whitespace-nowrap px-2 py-2">
- <span className={`flex flex-wrap items-center ${ICON_GAP.menu}`}>
- {marks.map((mark) => (
- <StateMark key={mark.key} tone={mark.tone}>
- {stateMarkLabel(mark.key)}
- </StateMark>
- ))}
- </span>
- </td>
- {/* The meter carries the percent, the amounts follow it, and the budget
+ <TableCell nowrap>
+ <span className={`flex flex-wrap items-center ${ICON_GAP.menu}`}>
+ {marks.map((mark) => (
+ <StateMark key={mark.key} tone={mark.tone}>
+ {stateMarkLabel(mark.key)}
+ </StateMark>
+ ))}
+ </span>
+ </TableCell>
+ {/* The meter carries the percent, the amounts follow it, and the budget
half of them is the button that edits it — so the pencil still sits
on the number it changes. Own spend rides in the row's tooltip. */}
- <td className={`${cellClass} whitespace-nowrap`}>
- {editing ? (
- <BudgetEditor
- initial={employee.budget}
- name={employee.name}
- currency={currency}
- busy={busy}
- onSave={(value) => void saveBudget(employee.agentId, value)}
- onCancel={() => setEditingId(null)}
- />
- ) : (
- <span className={`flex items-center ${ICON_GAP.menu}`}>
- {/* Fixed width, first in the cell: every meter then starts at the
+ <TableCell numeric nowrap>
+ {editing ? (
+ <BudgetEditor
+ initial={employee.budget}
+ name={employee.name}
+ currency={currency}
+ busy={busy}
+ onSave={(value) => void saveBudget(employee.agentId, value)}
+ onCancel={() => setEditingId(null)}
+ />
+ ) : (
+ <span className={`flex items-center ${ICON_GAP.menu}`}>
+ {/* Fixed width, first in the cell: every meter then starts at the
same x and the column reads as one chart. */}
- <span className="w-20 shrink-0">
- <SpendMeter
- label={spendLabel(
- employee.cumulative,
- employee.budget,
- employee.ratio,
- )}
- {...(employee.ratio !== undefined
- ? { ratio: employee.ratio }
- : {})}
- />
+ <span className="w-20 shrink-0">
+ <SpendMeter
+ label={spendLabel(
+ employee.cumulative,
+ employee.budget,
+ employee.ratio,
+ )}
+ {...(employee.ratio !== undefined ? { ratio: employee.ratio } : {})}
+ />
+ </span>
+ <span className="flex-1 text-right">
+ <span className="font-semibold text-gray-900 dark:text-gray-100">
+ {formatMoney(employee.cumulative, currency)}
</span>
- <span className="flex-1 text-right">
- <span className="font-semibold text-gray-900 dark:text-gray-100">
- {formatMoney(employee.cumulative, currency)}
- </span>
- <span aria-hidden className="px-1 text-gray-300 dark:text-gray-600">
- {employee.budget === undefined ? "·" : "/"}
- </span>
- <button
- type="button"
- data-tooltip={S.company.finance.editBudget}
- aria-label={S.company.finance.editBudgetOf(employee.name)}
- onClick={() => setEditingId(employee.agentId)}
- className={`group inline-flex items-center ${ICON_GAP.tight} rounded px-1 py-0.5 tabular-nums transition-colors duration-150 hover:bg-gray-100 dark:hover:bg-gray-800`}
- >
- <span
- className={
- employee.budget === undefined
- ? "text-gray-400 dark:text-gray-500"
- : "text-gray-900 dark:text-gray-100"
- }
- >
- {employee.budget === undefined
- ? S.company.noBudget
- : formatMoney(employee.budget, currency)}
- </span>
- <GlyphIcon
- d={ICONS.pencil}
- size={ICON_SIZE.inlineGlyph}
- className="text-gray-300 transition-colors duration-150 group-hover:text-gray-600 dark:text-gray-600 dark:group-hover:text-gray-300"
- />
- </button>
+ <span aria-hidden className="px-1 text-gray-300 dark:text-gray-600">
+ {employee.budget === undefined ? "·" : "/"}
</span>
+ <button
+ type="button"
+ data-tooltip={S.company.finance.editBudget}
+ aria-label={S.company.finance.editBudgetOf(employee.name)}
+ onClick={() => setEditingId(employee.agentId)}
+ className={`group inline-flex items-center ${ICON_GAP.tight} rounded px-1 py-0.5 tabular-nums transition-colors duration-150 hover:bg-gray-100 dark:hover:bg-gray-800`}
+ >
+ <span
+ className={
+ employee.budget === undefined
+ ? "text-gray-400 dark:text-gray-500"
+ : "text-gray-900 dark:text-gray-100"
+ }
+ >
+ {employee.budget === undefined
+ ? S.company.noBudget
+ : formatMoney(employee.budget, currency)}
+ </span>
+ <GlyphIcon
+ d={ICONS.pencil}
+ size={ICON_SIZE.inlineGlyph}
+ className="text-gray-300 transition-colors duration-150 group-hover:text-gray-600 dark:text-gray-600 dark:group-hover:text-gray-300"
+ />
+ </button>
</span>
- )}
- </td>
- </tr>
- );
- })}
- </tbody>
- </table>
- </div>
+ </span>
+ )}
+ </TableCell>
+ </TableRow>
+ );
+ })}
+ </TableBody>
+ </Table>
</FinanceCard>
<FinanceCard title={S.company.finance.ticketsTable} info={S.company.finance.ticketsInfo}>
@@ -674,97 +663,95 @@ export function FinancePage() {
{S.company.finance.ticketsEmpty}
</p>
) : (
- <div className="overflow-x-auto">
- <table className="w-full min-w-[17rem] text-xs">
- <thead>
- <tr>
- <th className={`${headClass} text-left`}>{S.nav.org.tickets}</th>
- <th className={`${headClass} text-left`}>{S.company.status}</th>
- <th className={`${headClass} text-right`}>
- <span className={`inline-flex items-center ${ICON_GAP.tight}`}>
- {S.company.finance.rolledUp}
- <InfoPopover label={S.company.finance.rolledUp}>
- {S.company.finance.rolledUpInfo}
- </InfoPopover>
- </span>
- </th>
- </tr>
- </thead>
- <tbody className="divide-y divide-gray-100 dark:divide-gray-800/60">
- {ticketRows.map(({ ticket, depth, children }) => {
- const owner = owners.get(ticket.ticketId);
- const open = expandedTickets.has(ticket.ticketId);
- return (
- // The id, the owner and the ticket's own cost ride in the row's
- // tooltip: three columns the table cannot afford beside the spend tree.
- <tr
- key={ticket.ticketId}
- data-tooltip={ticketRowTooltip(
- ticket,
- owner === undefined ? undefined : principalLabel(owner, names),
- {
- owner: S.company.tickets.owner,
- noOwner: S.company.tickets.noOwner,
- cost: S.company.tickets.cost,
- rolledUp: S.company.finance.rolledUp,
- },
- (value) => formatMoney(value, currency),
- )}
- >
- <td className="px-2 py-2" style={{ paddingLeft: 8 + depth * INDENT_PX }}>
- <span className={`flex min-w-0 items-center ${ICON_GAP.row}`}>
- {depth > 0 && <TreeElbow />}
- {children > 0 ? (
- <button
- type="button"
- aria-expanded={open}
- data-tooltip={
- open
- ? S.company.finance.collapseChildren
- : S.company.finance.expandChildren
- }
- aria-label={`${
- open
- ? S.company.finance.collapseChildren
- : S.company.finance.expandChildren
- } · ${ticket.title}`}
- onClick={() => toggleTicket(ticket.ticketId)}
- className={`${iconButtonClass} ${FOLD_BOX}`}
- >
- <Chevron open={open} size={ICON_SIZE.chevronDense} />
- </button>
- ) : (
- <span aria-hidden className={FOLD_BOX} />
- )}
- {/* The title is the link; the rest of the row reads. */}
- <TitleButton
- className="truncate font-medium text-gray-900 dark:text-gray-100"
- title={S.company.finance.openTicket}
- onClick={() => openTicket(ticket.ticketId)}
+ <Table size="sm" framed={false} tableClassName="min-w-[17rem]">
+ <TableHead>
+ <TableHeaderCell>{S.nav.org.tickets}</TableHeaderCell>
+ <TableHeaderCell>{S.company.status}</TableHeaderCell>
+ <TableHeaderCell align="right">
+ <span className={`inline-flex items-center ${ICON_GAP.tight}`}>
+ {S.company.finance.rolledUp}
+ <InfoPopover label={S.company.finance.rolledUp}>
+ {S.company.finance.rolledUpInfo}
+ </InfoPopover>
+ </span>
+ </TableHeaderCell>
+ </TableHead>
+ <TableBody>
+ {ticketRows.map(({ ticket, depth, children }) => {
+ const owner = owners.get(ticket.ticketId);
+ const open = expandedTickets.has(ticket.ticketId);
+ return (
+ // The id, the owner and the ticket's own cost ride in the row's
+ // tooltip: three columns the table cannot afford beside the spend tree.
+ <TableRow
+ key={ticket.ticketId}
+ data-tooltip={ticketRowTooltip(
+ ticket,
+ owner === undefined ? undefined : principalLabel(owner, names),
+ {
+ owner: S.company.tickets.owner,
+ noOwner: S.company.tickets.noOwner,
+ cost: S.company.tickets.cost,
+ rolledUp: S.company.finance.rolledUp,
+ },
+ (value) => formatMoney(value, currency),
+ )}
+ >
+ <TableCell style={{ paddingLeft: 8 + depth * INDENT_PX }}>
+ <span className={`flex min-w-0 items-center ${ICON_GAP.row}`}>
+ {depth > 0 && <TreeElbow />}
+ {children > 0 ? (
+ <button
+ type="button"
+ aria-expanded={open}
+ data-tooltip={
+ open
+ ? S.company.finance.collapseChildren
+ : S.company.finance.expandChildren
+ }
+ aria-label={`${
+ open
+ ? S.company.finance.collapseChildren
+ : S.company.finance.expandChildren
+ } · ${ticket.title}`}
+ onClick={() => toggleTicket(ticket.ticketId)}
+ className={`${iconButtonClass} ${FOLD_BOX}`}
>
- {ticket.title}
- </TitleButton>
- {children > 0 && !open && (
- <span className="shrink-0 text-[11px] text-gray-400 dark:text-gray-500">
- {S.company.finance.childCount(children)}
- </span>
- )}
- </span>
- </td>
- <td className="whitespace-nowrap px-2 py-2">
- <TicketStatusBadge status={ticket.status} />
- </td>
- <td
- className={`${cellClass} whitespace-nowrap font-semibold text-gray-900 dark:text-gray-100`}
- >
- {formatMoney(ticket.rolledUp, currency)}
- </td>
- </tr>
- );
- })}
- </tbody>
- </table>
- </div>
+ <Chevron open={open} size={ICON_SIZE.chevronDense} />
+ </button>
+ ) : (
+ <span aria-hidden className={FOLD_BOX} />
+ )}
+ {/* The title is the link; the rest of the row reads. */}
+ <TitleButton
+ className="truncate font-medium text-gray-900 dark:text-gray-100"
+ title={S.company.finance.openTicket}
+ onClick={() => openTicket(ticket.ticketId)}
+ >
+ {ticket.title}
+ </TitleButton>
+ {children > 0 && !open && (
+ <span className="shrink-0 text-xs text-gray-400 dark:text-gray-500">
+ {S.company.finance.childCount(children)}
+ </span>
+ )}
+ </span>
+ </TableCell>
+ <TableCell nowrap>
+ <TicketStatusBadge status={ticket.status} />
+ </TableCell>
+ <TableCell
+ numeric
+ nowrap
+ className="font-semibold text-gray-900 dark:text-gray-100"
+ >
+ {formatMoney(ticket.rolledUp, currency)}
+ </TableCell>
+ </TableRow>
+ );
+ })}
+ </TableBody>
+ </Table>
)}
</FinanceCard>
</div>
@@ -779,7 +766,7 @@ export function FinancePage() {
{S.company.finance.alertsEmpty}
</p>
) : (
- <div className="grid gap-x-8 gap-y-3 sm:grid-cols-2">
+ <div className="grid gap-x-6 gap-y-3 sm:grid-cols-2">
<AlertGroup
title={S.company.finance.pausedGroup}
tone="danger"
@@ -794,7 +781,7 @@ export function FinancePage() {
/>
</div>
)}
- <p className="mt-3 text-[11px] text-gray-400 dark:text-gray-500">
+ <p className="mt-3 text-xs text-gray-400 dark:text-gray-500">
{S.company.finance.alertsHint}
</p>
</FinanceCard>
@@ -818,7 +805,7 @@ function AlertGroup({
if (alerts.length === 0) return null;
return (
<div>
- <p className={`text-[11px] font-medium ${toneInk[tone]}`}>
+ <p className={`text-xs font-medium ${toneInk[tone]}`}>
{title} · {alerts.length}
</p>
<ul className="mt-1 divide-y divide-gray-100 dark:divide-gray-800/60">
diff --git a/packages/web/src/features/company/finance-tree.ts b/packages/web/src/features/company/finance-tree.ts
index 8844411b..3271ec7d 100644
--- a/packages/web/src/features/company/finance-tree.ts
+++ b/packages/web/src/features/company/finance-tree.ts
@@ -158,8 +158,14 @@ export function shiftPeriod(period: string, delta: number): string | null {
return `${String(y).padStart(4, "0")}-${String(mo + 1).padStart(2, "0")}`;
}
+/**
+ * The four tones a budget reading takes. Narrower than `Tone`, so a reading with a budget is
+ * also a package `ToneName` (a `StatTile`'s or a `ProgressBar`'s tone) once `muted` is ruled out.
+ */
+export type BudgetTone = Extract<Tone, "muted" | "success" | "attention" | "danger">;
+
/** The tone a spend-against-budget ratio takes: attention from 80%, danger from 100%, success below; muted without a budget. */
-export function budgetTone(ratio: number | undefined): Tone {
+export function budgetTone(ratio: number | undefined): BudgetTone {
if (ratio === undefined || !Number.isFinite(ratio)) return "muted";
if (ratio >= 1) return "danger";
if (ratio >= 0.8) return "attention";
diff --git a/packages/web/src/features/company/handbook-explorer.tsx b/packages/web/src/features/company/handbook-explorer.tsx
index 6768d5dc..72f8b514 100644
--- a/packages/web/src/features/company/handbook-explorer.tsx
+++ b/packages/web/src/features/company/handbook-explorer.tsx
@@ -65,7 +65,7 @@ export function HandbookExplorer({
// Only the index overrides its name: every other row says on screen everything it means.
rowLabel={(row) => (row.isIndex ? tooltip(row) : undefined)}
rowTrailing={(row) => (
- <span className="shrink-0 text-[11px] tabular-nums text-gray-400 dark:text-gray-500">
+ <span className="shrink-0 text-xs tabular-nums text-gray-400 dark:text-gray-500">
{row.kind === "dir"
? row.docs
: row.file === null
diff --git a/packages/web/src/features/company/handbook-page.tsx b/packages/web/src/features/company/handbook-page.tsx
index 23bf4346..1d4470b1 100644
--- a/packages/web/src/features/company/handbook-page.tsx
+++ b/packages/web/src/features/company/handbook-page.tsx
@@ -21,6 +21,7 @@ import { useCallback, useEffect, useMemo, useState } from "react";
import type { KeyboardEvent as ReactKeyboardEvent, MouseEvent as ReactMouseEvent } from "react";
import type { OrgHandbookFile, OrgHandbookFileResponse } from "@prismshadow/penguin-server/api";
import {
+ Badge,
Button,
ConfirmModal,
EmptyState,
@@ -30,6 +31,7 @@ import {
Input,
Md,
Modal,
+ RuledSection,
Skeleton,
Textarea,
toastError,
@@ -46,7 +48,7 @@ import { useShortcutLabel } from "../../lib/shortcuts/use-keymap";
import { useDocumentTitle } from "../../lib/use-document-title";
import { useLocale } from "../../state/locale";
import type { TreeToggle } from "../../components/ui/file-tree";
-import { OrgEmptyLine, OrgPage, OrgSection, useOrg } from "./org-layout";
+import { OrgEmptyLine, OrgPage, useOrg } from "./org-layout";
import { ErrorLine } from "./shared";
import { COLLAPSE_ALL_ICON, HandbookExplorer } from "./handbook-explorer";
import {
@@ -62,7 +64,7 @@ import {
} from "./handbook-tree";
/** The two panes: a fixed list column beside the document, stacked on a narrow screen. */
-const PANES_CLASS = "grid grid-cols-1 gap-x-10 gap-y-8 lg:grid-cols-[17rem_minmax(0,1fr)]";
+const PANES_CLASS = "grid grid-cols-1 gap-x-10 gap-y-6 lg:grid-cols-[17rem_minmax(0,1fr)]";
/** The size a listing row would report for content just written, before the listing is re-read. */
const byteLength = (text: string) => new TextEncoder().encode(text).length;
@@ -299,7 +301,7 @@ export function HandbookPage() {
<div className={PANES_CLASS}>
{/* The create button sits in the section's action slot rather than the page's: it
is the list's own action, and a button in both headers keeps their rules level. */}
- <OrgSection
+ <RuledSection
title={S.company.handbook.documents}
count={files?.length ?? 0}
actions={
@@ -314,7 +316,7 @@ export function HandbookPage() {
setToggled(null);
setExpanded(new Set<string>());
}}
- className="inline-flex items-center justify-center rounded p-0.5 text-gray-400 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-700 disabled:opacity-40 dark:text-gray-500 dark:hover:bg-gray-800 dark:hover:text-gray-200"
+ className="inline-flex items-center justify-center rounded p-1 text-gray-400 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-700 disabled:opacity-40 dark:text-gray-500 dark:hover:bg-gray-800 dark:hover:text-gray-200"
>
<GlyphIcon d={COLLAPSE_ALL_ICON} size={ICON_SIZE.groupHeaderAction} />
</button>
@@ -335,7 +337,7 @@ export function HandbookPage() {
{tree.nodes.length === 0 && (
<OrgEmptyLine>{S.company.handbook.noOtherDocuments}</OrgEmptyLine>
)}
- </OrgSection>
+ </RuledSection>
<section className="min-w-0" aria-label={selected}>
{/* The document's own header: its path (a file name, not a heading, so no
@@ -350,13 +352,13 @@ export function HandbookPage() {
in a list of them. The explorer row carries the same sentence in its tooltip
and its accessible name. */}
{isIndex && (
- <span className="shrink-0 rounded-full bg-gray-100 px-1.5 text-[10px] font-semibold text-gray-500 dark:bg-gray-800 dark:text-gray-400">
- {S.company.handbook.indexLabel}
+ <span className="shrink-0">
+ <Badge size="sm">{S.company.handbook.indexLabel}</Badge>
</span>
)}
{selectedFile !== null && (
<span
- className="hidden shrink-0 text-[11px] text-gray-400 sm:inline dark:text-gray-500"
+ className="hidden shrink-0 text-xs text-gray-400 sm:inline dark:text-gray-500"
data-tooltip={S.company.handbook.updatedAt(
formatDateTime(selectedFile.updatedAt),
formatBytes(selectedFile.size),
@@ -369,7 +371,7 @@ export function HandbookPage() {
<div className="flex shrink-0 items-center gap-1.5">
{editing ? (
<>
- <span className="hidden text-[11px] text-gray-400 sm:inline dark:text-gray-500">
+ <span className="hidden text-xs text-gray-400 sm:inline dark:text-gray-500">
{S.company.handbook.editorHint(saveShortcut)}
</span>
<Button size="sm" disabled={saving} onClick={() => setEditing(false)}>
diff --git a/packages/web/src/features/company/org-chart-page.tsx b/packages/web/src/features/company/org-chart-page.tsx
index a488e3c7..29b7379d 100644
--- a/packages/web/src/features/company/org-chart-page.tsx
+++ b/packages/web/src/features/company/org-chart-page.tsx
@@ -38,7 +38,7 @@ import {
Menu,
MenuItem,
MenuSeparator,
- NoticeStrip,
+ Notice,
toastError,
toastSuccess,
} from "@prismshadow/penguin-ui";
@@ -448,20 +448,19 @@ export function OrgChartPage() {
>
{/* A refresh that failed while a chart is on screen: say so above it, keep the chart. */}
{error !== null && (
- <NoticeStrip
+ <Notice
tone="danger"
- className="mb-3 flex flex-wrap items-center justify-between gap-2 rounded-md border px-3 py-1.5 text-xs"
+ role="alert"
+ className="mb-3"
+ retry={{ label: S.common.retry, onClick: () => void load() }}
>
- <span>{S.company.chart.refreshFailed(error)}</span>
- <Button size="sm" onClick={() => void load()}>
- {S.common.retry}
- </Button>
- </NoticeStrip>
+ {S.company.chart.refreshFailed(error)}
+ </Notice>
)}
{layout.detached.length > 0 && (
- <NoticeStrip tone="attention" className="mb-3 rounded-md border px-3 py-1.5 text-xs">
+ <Notice tone="attention" className="mb-3">
{S.company.chart.detachedNotice(layout.detached.length)}
- </NoticeStrip>
+ </Notice>
)}
{layout.nodes.length === 0 ? (
<EmptyState title={S.company.chart.empty} />
@@ -469,7 +468,7 @@ export function OrgChartPage() {
<>
<div className="mb-3 flex flex-wrap items-center justify-between gap-2">
<ChartLegend />
- <span className="text-[11px] text-gray-500 dark:text-gray-400">
+ <span className="text-xs text-gray-500 dark:text-gray-400">
{S.company.chart.employeeCount(chart.employees.length)}
</span>
</div>
@@ -514,7 +513,7 @@ export function OrgChartPage() {
</svg>
{layout.detachedTop !== null && (
<p
- className={`absolute right-0 left-0 text-center text-[11px] font-medium ${toneInk.danger}`}
+ className={`absolute right-0 left-0 text-center text-xs font-medium ${toneInk.danger}`}
style={{ top: layout.detachedTop - CHART_DETACHED_LABEL_H }}
>
{S.company.chart.detached}
diff --git a/packages/web/src/features/company/org-dialogs.tsx b/packages/web/src/features/company/org-dialogs.tsx
index 32aa7b3b..1e3705f4 100644
--- a/packages/web/src/features/company/org-dialogs.tsx
+++ b/packages/web/src/features/company/org-dialogs.tsx
@@ -264,7 +264,7 @@ function MissionExamples({
data-tooltip-content="text"
disabled={disabled}
onClick={() => onPick(copy)}
- className="min-w-0 truncate rounded-md border border-gray-200 px-2 py-1 text-left text-[11px] text-gray-600 transition-colors duration-150 hover:border-gray-300 hover:bg-gray-50 hover:text-gray-900 disabled:cursor-not-allowed disabled:opacity-60 dark:border-gray-700 dark:text-gray-400 dark:hover:border-gray-600 dark:hover:bg-gray-800 dark:hover:text-gray-100"
+ className="min-w-0 truncate rounded-md border border-gray-200 px-2 py-1 text-left text-xs text-gray-600 transition-colors duration-150 hover:border-gray-300 hover:bg-gray-50 hover:text-gray-900 disabled:cursor-not-allowed disabled:opacity-60 dark:border-gray-700 dark:text-gray-400 dark:hover:border-gray-600 dark:hover:bg-gray-800 dark:hover:text-gray-100"
>
{copy.name}
</button>
diff --git a/packages/web/src/features/company/org-layout.tsx b/packages/web/src/features/company/org-layout.tsx
index dd54c6cc..e98f4cab 100644
--- a/packages/web/src/features/company/org-layout.tsx
+++ b/packages/web/src/features/company/org-layout.tsx
@@ -18,9 +18,10 @@
* overview's inbox, a channel's reference — so the window belongs to the shell around the
* pages rather than to any one of them.
*
- * The page primitives live here too — `OrgPage`, `OrgSection`, `OrgEmptyLine` and the
- * skeleton — so every organization page shares one frame, one header row and one section
- * rule instead of each drawing its own.
+ * The page primitives live here too — `OrgPage` (the UI package's page frame and header at the
+ * organization pages' width), `OrgEmptyLine` and the skeleton — so every organization page
+ * shares one frame and one header row instead of each drawing its own; a page's sections are
+ * the package's `RuledSection`.
*/
import { createContext, useContext, useEffect, useState } from "react";
import type { ReactNode } from "react";
@@ -30,10 +31,11 @@ import {
Button,
EmptyState,
GlyphIcon,
+ Heading,
ICONS,
- ICON_GAP,
ICON_SIZE,
- InfoPopover,
+ PageFrame,
+ PageHeader,
Skeleton,
} from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
@@ -59,15 +61,6 @@ export function useOrg(): OrgContextValue {
return ctx;
}
-/** The scrolling column every organization surface sits in, and the width the narrow pages read best at. */
-function OrgFrame({ wide = false, children }: { wide?: boolean; children: ReactNode }) {
- return (
- <div className="h-full overflow-y-auto p-4 md:p-6">
- <div className={wide ? "min-w-0" : "mx-auto max-w-6xl"}>{children}</div>
- </div>
- );
-}
-
/**
* The frame the two organization-less surfaces sit in — the empty landing and the stale deep
* link. Each is one short block of guidance with nothing above or below it, so the column
@@ -78,9 +71,9 @@ function OrgFrame({ wide = false, children }: { wide?: boolean; children: ReactN
*/
function OrgCenteredFrame({ children }: { children: ReactNode }) {
return (
- <div className="h-full overflow-y-auto p-4 md:p-6">
- <div className="flex min-h-full flex-col justify-center">{children}</div>
- </div>
+ <PageFrame width="full" contentClassName="flex min-h-full flex-col justify-center">
+ {children}
+ </PageFrame>
);
}
@@ -93,9 +86,9 @@ export function OrgIndexRedirect() {
// first load never reads as a broken route.
if (!company.orgsLoaded) {
return (
- <OrgFrame>
+ <PageFrame width="xl">
<OrgPageSkeleton />
- </OrgFrame>
+ </PageFrame>
);
}
const target = resolveOrgLanding(
@@ -146,7 +139,9 @@ function OrgEmptyLanding() {
<span className="mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-gray-100 text-gray-500 dark:bg-gray-800 dark:text-gray-300">
<GlyphIcon d={ICONS.building} size={ICON_SIZE.sectionMark + 6} />
</span>
- <h1 className="mt-4 text-2xl font-semibold tracking-tight">{S.company.landingTitle}</h1>
+ <Heading level={1} display className="mt-4">
+ {S.company.landingTitle}
+ </Heading>
<p className="mx-auto mt-2 max-w-xl text-sm text-gray-600 dark:text-gray-300">
{S.company.landingBody}
</p>
@@ -276,10 +271,11 @@ export function OrgLayout() {
}
/**
- * The page frame every organization page shares: a scrolling column with the page title,
- * its "?" (the page's semantics, disclosed on request) and the header actions on one row,
- * the content below. The organization's name is not repeated in the title — the switcher
- * above the sidebar already names it; the overview's own hero is the one place it is.
+ * The page every organization page is: the package's page frame at the organization pages'
+ * width, with its header — the page title, its "?" (the page's semantics, disclosed on
+ * request) and the header actions on one row — and the content below. The organization's
+ * name is not repeated in the title — the switcher above the sidebar already names it; the
+ * overview's own hero is the one place it is.
*/
export function OrgPage({
title,
@@ -296,18 +292,10 @@ export function OrgPage({
children: ReactNode;
}) {
return (
- <OrgFrame wide={wide}>
- <div className="mb-5 flex flex-wrap items-center justify-between gap-x-4 gap-y-2">
- <h1 className={`flex min-w-0 items-center ${ICON_GAP.row} text-xl font-semibold`}>
- {title}
- {info !== undefined && <InfoPopover label={title}>{info}</InfoPopover>}
- </h1>
- {actions !== undefined && (
- <div className="flex flex-wrap items-center gap-2">{actions}</div>
- )}
- </div>
+ <PageFrame width={wide ? "full" : "xl"}>
+ <PageHeader title={title} info={info} actions={actions} />
{children}
- </OrgFrame>
+ </PageFrame>
);
}
@@ -317,7 +305,7 @@ export function OrgPageSkeleton() {
<div className="space-y-6" aria-busy="true">
<Skeleton className="h-20" />
<Skeleton className="h-24" />
- <div className="grid grid-cols-1 gap-8 lg:grid-cols-2">
+ <div className="grid grid-cols-1 gap-6 lg:grid-cols-2">
<Skeleton className="h-40" />
<Skeleton className="h-40" />
</div>
@@ -325,50 +313,6 @@ export function OrgPageSkeleton() {
);
}
-/**
- * A ruled section: a small uppercase title with an optional count, its "?" and optional
- * trailing controls, a rule beneath, then the body. Sections, not cards — the page reads
- * as one column of titled runs rather than a grid of boxes.
- */
-export function OrgSection({
- title,
- info,
- count,
- actions,
- children,
- className = "",
-}: {
- title: string;
- info?: string;
- /** How many items the body holds, shown after the title (omit for sections that are not lists). */
- count?: number;
- actions?: ReactNode;
- children: ReactNode;
- className?: string;
-}) {
- return (
- <section className={`min-w-0 ${className}`}>
- <div className="mb-3 flex items-center justify-between gap-2 border-b border-gray-200 pb-2 dark:border-gray-800">
- <h2
- className={`flex min-w-0 items-center ${ICON_GAP.row} text-[11px] font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400`}
- >
- {title}
- {count !== undefined && (
- <span className="rounded-full bg-gray-100 px-1.5 text-[10px] font-semibold tabular-nums text-gray-500 dark:bg-gray-800 dark:text-gray-400">
- {count}
- </span>
- )}
- {info !== undefined && <InfoPopover label={title}>{info}</InfoPopover>}
- </h2>
- {actions !== undefined && (
- <div className="flex shrink-0 items-center gap-1.5">{actions}</div>
- )}
- </div>
- {children}
- </section>
- );
-}
-
/** A section with nothing to list: one quiet line where the rows would be. */
export function OrgEmptyLine({ children }: { children: ReactNode }) {
return <p className="py-1 text-xs text-gray-400 dark:text-gray-500">{children}</p>;
diff --git a/packages/web/src/features/company/org-session-groups.tsx b/packages/web/src/features/company/org-session-groups.tsx
index 32238f94..69acdaa9 100644
--- a/packages/web/src/features/company/org-session-groups.tsx
+++ b/packages/web/src/features/company/org-session-groups.tsx
@@ -35,6 +35,7 @@ import {
Button,
CloseIcon,
Dropdown,
+ FolderSection,
ICONS,
ICON_GAP,
ICON_SIZE,
@@ -53,7 +54,7 @@ import { useCompany } from "../../state/company";
import { useProject } from "../../state/project";
import { useLiveSessionStatuses } from "../../state/sessions";
import { writeClipboard } from "../../lib/clipboard";
-import { FolderSection, Icon } from "../../components/ui/group-list";
+import { Icon } from "../../components/ui/group-list";
import {
DESK_ROW_ACTIONS,
SessionRowHoverActions,
@@ -455,7 +456,7 @@ export function OrgSessionGroups({
{S.company.sessionList.noEmployees}
</p>
) : (
- <ul className="space-y-0.5">
+ <ul className="space-y-1">
{desks.map((d) => (
<DeskRow
key={d.agentId}
@@ -480,13 +481,13 @@ export function OrgSessionGroups({
<button
type="button"
onClick={() => dismissAllTempSessions(user?.userId ?? null, projectId, orgId)}
- className="shrink-0 rounded px-1.5 py-1 text-[11px] font-medium text-gray-400 transition-colors duration-150 hover:text-gray-700 dark:text-gray-500 dark:hover:text-gray-200"
+ className="shrink-0 rounded px-1.5 py-1 text-xs font-medium text-gray-400 transition-colors duration-150 hover:text-gray-700 dark:text-gray-500 dark:hover:text-gray-200"
>
{S.company.sessionList.closeAllTemporary}
</button>
}
>
- <ul className="space-y-0.5">
+ <ul className="space-y-1">
{tempRows.map((row) => (
<TempRow
key={row.sessionId}
diff --git a/packages/web/src/features/company/org-switcher.tsx b/packages/web/src/features/company/org-switcher.tsx
index e58668d1..e04ce610 100644
--- a/packages/web/src/features/company/org-switcher.tsx
+++ b/packages/web/src/features/company/org-switcher.tsx
@@ -120,7 +120,7 @@ export function OrgSwitcher({ onNavigate }: { onNavigate?: () => void }) {
</span>
{/* The Project the organization belongs to: the second line, so the name stays the headline. */}
{current !== null && (
- <span className="block truncate text-[11px] leading-tight text-gray-500 dark:text-gray-400">
+ <span className="block truncate text-xs leading-tight text-gray-500 dark:text-gray-400">
{projectName(current.projectId)}
</span>
)}
@@ -128,7 +128,7 @@ export function OrgSwitcher({ onNavigate }: { onNavigate?: () => void }) {
{channelNote !== null && (
<span
aria-hidden
- className={`shrink-0 rounded-full px-1.5 text-[10px] font-semibold tabular-nums ${
+ className={`shrink-0 rounded-full px-1.5 text-xs font-semibold tabular-nums ${
company.channelMentions > 0
? toneSurface.attention
: "bg-gray-200 text-gray-700 dark:bg-gray-700 dark:text-gray-200"
diff --git a/packages/web/src/features/company/overview-page.tsx b/packages/web/src/features/company/overview-page.tsx
index 9d36181a..55bc8ff0 100644
--- a/packages/web/src/features/company/overview-page.tsx
+++ b/packages/web/src/features/company/overview-page.tsx
@@ -36,9 +36,12 @@ import {
Chevron,
EmptyState,
GlyphIcon,
+ Heading,
ICON_GAP,
ICON_SIZE,
+ RuledSection,
Segmented,
+ Text,
toastError,
} from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
@@ -57,7 +60,7 @@ import { STAT_ICONS } from "../../lib/stat-icons";
import { orgChannelPath, orgKey, orgPagePath } from "./company-nav";
import type { CompanyNavKey } from "./company-nav";
import { CHANNEL_ICON } from "./channel-sidebar";
-import { OrgEmptyLine, OrgPage, OrgPageSkeleton, OrgSection, useOrg } from "./org-layout";
+import { OrgEmptyLine, OrgPage, OrgPageSkeleton, useOrg } from "./org-layout";
import {
BudgetBar,
ErrorLine,
@@ -156,9 +159,9 @@ function SummaryLabel({
}) {
return (
<div className="flex items-start justify-between gap-2">
- <span className="block text-[11px] font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400">
+ <Text variant="eyebrow" as="span" className="block">
{label}
- </span>
+ </Text>
<JumpButton label={jump} onClick={onJump} />
</div>
);
@@ -226,9 +229,7 @@ function MissionFold({ mission }: { mission: string }) {
const toggle = expanded ? S.company.overview.collapse : S.company.overview.expand;
return (
<div className="mt-3 max-w-3xl">
- <p className="text-[11px] font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400">
- {S.company.overview.mission}
- </p>
+ <Text variant="eyebrow">{S.company.overview.mission}</Text>
<div className="mt-0.5 flex items-baseline gap-3">
<p
ref={textRef}
@@ -514,7 +515,10 @@ export function OverviewPage() {
period's spend is not repeated here — it is the last cell of the KPI strip. */}
<header className="min-w-0 border-b border-gray-200 pb-5 dark:border-gray-800">
<div className="flex flex-wrap items-center gap-2">
- <h2 className="text-2xl font-semibold tracking-tight">{detail.name}</h2>
+ {/* The organization's name on the h1 rung, one outline level under the page title. */}
+ <Heading level={1} as="h2">
+ {detail.name}
+ </Heading>
<OrgStatusPill org={detail} />
</div>
<p className="mt-1.5 text-xs text-gray-500 dark:text-gray-400">
@@ -675,7 +679,7 @@ export function OverviewPage() {
</div>
{steps.fresh ? (
- <OrgSection
+ <RuledSection
title={S.company.overview.firstStepsTitle}
info={S.company.overview.firstStepsInfo}
className="mt-8"
@@ -693,11 +697,11 @@ export function OverviewPage() {
/>
))}
</ol>
- </OrgSection>
+ </RuledSection>
) : (
<>
{/* The inbox: everything that needs the reader, newest first. */}
- <OrgSection
+ <RuledSection
title={S.company.overview.inbox}
info={S.company.overview.inboxInfo}
count={inbox.length}
@@ -719,7 +723,7 @@ export function OverviewPage() {
{visibleInbox.length === 0 ? (
<OrgEmptyLine>{S.company.overview.inboxEmpty}</OrgEmptyLine>
) : (
- <ul className="space-y-0.5">
+ <ul className="space-y-1">
{visibleInbox.map((row) => (
<li key={row.key} className={rowClass}>
<span
@@ -757,12 +761,12 @@ export function OverviewPage() {
))}
</ul>
)}
- </OrgSection>
+ </RuledSection>
{/* Today's timeline: a dot per instance on a rule, in the tone of its outcome. */}
{/* No jump of its own: the KPI cell above carries the one button to the calendar,
and every row's title opens it too. */}
- <OrgSection title={S.company.overview.today} count={today.total} className="mt-8">
+ <RuledSection title={S.company.overview.today} count={today.total} className="mt-8">
{today.entries.length === 0 ? (
<OrgEmptyLine>{S.company.overview.todayEmpty}</OrgEmptyLine>
) : (
@@ -803,10 +807,10 @@ export function OverviewPage() {
)}
</ol>
)}
- </OrgSection>
+ </RuledSection>
{/* Budget alerts: who, warned or paused, when. */}
- <OrgSection
+ <RuledSection
title={S.company.overview.alerts}
count={detail.alerts.length}
className="mt-8"
@@ -814,7 +818,7 @@ export function OverviewPage() {
{detail.alerts.length === 0 ? (
<OrgEmptyLine>{S.company.overview.alertsEmpty}</OrgEmptyLine>
) : (
- <ul className="space-y-0.5">
+ <ul className="space-y-1">
{detail.alerts.map((a) => (
<li key={`${a.agentId}/${a.period}`} className={rowClass}>
<TitleButton
@@ -836,7 +840,7 @@ export function OverviewPage() {
))}
</ul>
)}
- </OrgSection>
+ </RuledSection>
</>
)}
</OrgPage>
diff --git a/packages/web/src/features/company/shared.tsx b/packages/web/src/features/company/shared.tsx
index 965d3899..93680629 100644
--- a/packages/web/src/features/company/shared.tsx
+++ b/packages/web/src/features/company/shared.tsx
@@ -3,8 +3,8 @@
* budget bar and ring, the budget field and the two marks a budget box wears (its unit, and
* what a converted amount will be stored as), the ticket status and priority pills, the
* blocked badge, the failed-refresh line, the two ways out of a summary — the title that
- * opens what it names, and the corner button a titleless card or row uses instead — the
- * labelled value and the bordered KPI tile, and principal naming.
+ * opens what it names, and the corner button a titleless card or row uses instead — and
+ * principal naming. The bordered KPI tile is the shared UI package's `StatTile`.
* Every status colour here is a tone from lib/tone.ts, picked by meaning.
*/
import { useId } from "react";
@@ -17,24 +17,23 @@ import type {
import {
AgentAvatar,
Badge,
- Button,
FieldError,
FieldHint,
FieldLabel,
GlyphIcon,
- ICON_GAP,
ICON_SIZE,
Input,
- NoticeStrip,
+ Notice,
+ ProgressBar,
} from "@prismshadow/penguin-ui";
import type { BadgeStyle, ToneName } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
import { formatMoney, formatPercent } from "../../lib/format";
import { toneDot, toneInk } from "../../lib/tone";
-import type { Tone } from "../../lib/tone";
import type { Currency } from "../../state/theme";
import { toStoredUsd, unitLabel } from "./budget-input";
import { budgetTone } from "./finance-tree";
+import type { BudgetTone } from "./finance-tree";
import { parsePrincipal } from "./principals";
import { ORG_STATUS_TONE, orgStatusKind } from "./shell-org-status";
import type { OrgStatusKind } from "./shell-org-status";
@@ -174,21 +173,17 @@ export function ErrorLine({
className?: string;
}) {
return (
- <NoticeStrip
+ <Notice
tone="danger"
role="alert"
- className={`flex flex-wrap items-center justify-between gap-x-3 gap-y-2 rounded-md border px-3 py-2 text-xs ${className}`}
+ className={className}
+ retry={{ label: S.common.retry, onClick: onRetry }}
>
- <span data-slot="body" className="min-w-0">
- <span className="font-medium">{message}</span>
- {detail !== undefined && detail !== message && (
- <span className="ml-2 opacity-80">{detail}</span>
- )}
- </span>
- <Button size="sm" data-slot="actions" onClick={onRetry}>
- {S.common.retry}
- </Button>
- </NoticeStrip>
+ <span className="font-medium">{message}</span>
+ {detail !== undefined && detail !== message && (
+ <span className="ml-2 opacity-80">{detail}</span>
+ )}
+ </Notice>
);
}
@@ -269,7 +264,15 @@ export function SpendRing({
);
}
-/** Spend against a budget as a bar: attention from 80%, danger from 100%; a muted rule when there is no budget. */
+/** A budget reading as the progress bar's fill; no budget draws an empty neutral bar. */
+const BUDGET_FILL: Record<BudgetTone, ToneName> = {
+ muted: "neutral",
+ success: "success",
+ attention: "attention",
+ danger: "danger",
+};
+
+/** Spend against a budget as a bar: attention from 80%, danger from 100%; an empty bar when there is no budget. */
export function BudgetBar({
cost,
budget,
@@ -298,17 +301,12 @@ export function BudgetBar({
{label}
</p>
)}
- <div
- role="progressbar"
- aria-label={label}
- aria-valuemin={0}
- aria-valuemax={100}
- aria-valuenow={Math.round(width)}
+ <ProgressBar
+ value={Math.round(width)}
+ tone={BUDGET_FILL[tone]}
+ label={label}
data-tooltip={label}
- className="h-1.5 w-full overflow-hidden rounded-full bg-gray-100 dark:bg-gray-800"
- >
- <div className={`h-full rounded-full ${toneDot[tone]}`} style={{ width: `${width}%` }} />
- </div>
+ />
</div>
);
}
@@ -335,7 +333,7 @@ export function MoneyPerMonthUnit({ currency }: { currency: Currency }) {
export function StoredUsdNote({ usd, currency }: { usd: number | null; currency: Currency }) {
if (currency === "USD" || usd === null) return null;
return (
- <span className="mt-1 block text-[11px] text-gray-400 dark:text-gray-500">
+ <span className="mt-1 block text-xs text-gray-400 dark:text-gray-500">
{S.company.budgetStoredAs(formatMoney(usd, "USD"))}
</span>
);
@@ -488,52 +486,3 @@ export function PrincipalChip({
</span>
);
}
-
-/**
- * One KPI as its own bordered card, the shape the cost center's summary uses: a small glyph
- * beside the label, the value bold beneath it, and a line of detail under that. A tone inks
- * the glyph and the value together, so the reading and its mark say the same thing. The card
- * is plain elements — a KPI is a reading, not a control, and a whole-card click would swallow
- * whatever sits inside it; anything extra rides beside the value as children (the finance
- * page hangs its gauge there).
- */
-export function StatTile({
- icon,
- label,
- value,
- tone,
- detail,
- children,
-}: {
- /** A 24x24 line path, drawn through GlyphIcon like every other mark in the app. */
- icon: string;
- label: string;
- value: ReactNode;
- tone?: Tone;
- /** One quiet line under the value: what the number is measured against. */
- detail?: string;
- children?: ReactNode;
-}) {
- const ink = tone !== undefined ? toneInk[tone] : "";
- return (
- <div className="rounded-md border border-gray-200 bg-white p-3 dark:border-gray-800 dark:bg-gray-900">
- <p
- className={`mb-1.5 flex items-center ${ICON_GAP.row} text-[11px] text-gray-500 dark:text-gray-400`}
- >
- <GlyphIcon d={icon} size={ICON_SIZE.inlineGlyph} className={ink} />
- <span className="truncate">{label}</span>
- </p>
- <div className="flex items-center justify-between gap-2">
- <div className="min-w-0">
- <p className={`truncate text-lg font-semibold tabular-nums ${ink}`}>{value}</p>
- {detail !== undefined && (
- <p className="mt-0.5 text-[11px] leading-snug text-gray-500 dark:text-gray-400">
- {detail}
- </p>
- )}
- </div>
- {children}
- </div>
- </div>
- );
-}
diff --git a/packages/web/src/features/company/ticket-dialog.tsx b/packages/web/src/features/company/ticket-dialog.tsx
index 8edb21b9..fcc2ce88 100644
--- a/packages/web/src/features/company/ticket-dialog.tsx
+++ b/packages/web/src/features/company/ticket-dialog.tsx
@@ -46,12 +46,15 @@ import {
ICON_GAP,
ICON_SIZE,
Input,
- Md,
+ KeyValue,
+ KeyValueRow,
Modal,
- NoticeStrip,
+ Notice,
+ RuledSection,
Segmented,
Select,
Skeleton,
+ Text,
Textarea,
toastError,
toastInfo,
@@ -66,7 +69,6 @@ import { useAuth } from "../../state/auth";
import { useCompany } from "../../state/company";
import { useProject } from "../../state/project";
import { useTheme } from "../../state/theme";
-import { OrgSection } from "./org-layout";
import { PathMarkdown, PathText } from "./path-capsule";
import {
BlockedBadge,
@@ -416,14 +418,11 @@ function TicketDialog({
navigate(chatPath(session.sessionId));
};
- /** One field of the summary grid: every row is one line tall, so labels and values line up down the column. */
+ /** One field of the summary list: every row is one line tall, so labels and values line up down the column. */
const row = (label: string, value: ReactNode) => (
- <>
- <dt className="whitespace-nowrap text-gray-500 dark:text-gray-400">{label}</dt>
- <dd className="flex min-w-0 items-center gap-1.5 text-gray-800 dark:text-gray-100">
- {value}
- </dd>
- </>
+ <KeyValueRow label={label}>
+ <span className="flex min-w-0 items-center gap-1.5">{value}</span>
+ </KeyValueRow>
);
return (
@@ -457,19 +456,17 @@ function TicketDialog({
<CloseButton onClose={onClose} />
</div>
- <div className="min-h-0 flex-1 space-y-5 overflow-y-auto px-4 py-4 sm:px-6">
+ <div className="min-h-0 flex-1 space-y-6 overflow-y-auto px-4 py-4 sm:px-6">
{error !== null && detail === null ? (
- <NoticeStrip
+ <Notice
tone="danger"
- className="flex flex-wrap items-center justify-between gap-2 rounded-md border px-3 py-2 text-xs"
+ role="alert"
+ retry={{ label: S.common.retry, onClick: () => void load() }}
>
- <span>{error}</span>
- <Button size="sm" onClick={() => void load()}>
- {S.common.retry}
- </Button>
- </NoticeStrip>
+ {error}
+ </Notice>
) : detail === null || !contextReady ? (
- <div className="space-y-5">
+ <div className="space-y-6">
<div className="flex gap-2">
<Skeleton className="h-5 w-14 rounded-full" />
<Skeleton className="h-5 w-10 rounded-full" />
@@ -490,7 +487,7 @@ function TicketDialog({
{...(detail.blockedBy !== undefined ? { by: detail.blockedBy } : {})}
/>
)}
- <span className="inline-flex items-center gap-0.5 font-mono">
+ <span className="inline-flex items-center gap-1 font-mono">
{detail.ticketId}
<CopyButton
text={detail.ticketId}
@@ -511,31 +508,30 @@ function TicketDialog({
</span>
</span>
</div>
- {detail.invalid !== undefined && (
- <NoticeStrip tone="danger" className="rounded-md border px-3 py-2 text-xs">
- {detail.invalid}
- </NoticeStrip>
- )}
+ {detail.invalid !== undefined && <Notice tone="danger">{detail.invalid}</Notice>}
{blocked && (
- <NoticeStrip
- tone="attention"
- className="flex flex-wrap items-center gap-x-3 gap-y-1 rounded-md border px-3 py-2 text-xs"
- >
- <span>
- <span className="font-medium">{S.company.tickets.blockedReason}:</span>{" "}
- <PathText text={detail.blocked ?? ""} scope={{ projectId }} />
- </span>
- {detail.blockedBy !== undefined && (
- <span className="inline-flex items-center gap-1.5">
- <span>{S.company.tickets.blockedBy}:</span>
- <PrincipalChip principal={detail.blockedBy} names={names} />
+ <Notice tone="attention">
+ <span className="flex flex-wrap items-center gap-x-3 gap-y-1">
+ <span>
+ <span className="font-medium">{S.company.tickets.blockedReason}:</span>{" "}
+ <PathText text={detail.blocked ?? ""} scope={{ projectId }} />
</span>
- )}
- </NoticeStrip>
+ {detail.blockedBy !== undefined && (
+ <span className="inline-flex items-center gap-1.5">
+ <span>{S.company.tickets.blockedBy}:</span>
+ <PrincipalChip principal={detail.blockedBy} names={names} />
+ </span>
+ )}
+ </span>
+ </Notice>
)}
{/* Summary: the header fields as a definition list, a form while editing. */}
- <OrgSection title={S.company.tickets.summary} actions={sectionActions("summary")}>
+ <RuledSection
+ level={3}
+ title={S.company.tickets.summary}
+ actions={sectionActions("summary")}
+ >
{editing === "summary" && summaryDraft !== null ? (
<div className="grid grid-cols-1 gap-3 md:grid-cols-2">
<div className="md:col-span-2">
@@ -607,7 +603,7 @@ function TicketDialog({
</div>
</div>
) : (
- <dl className="grid grid-cols-[auto_1fr] gap-x-4 gap-y-1.5 text-xs">
+ <KeyValue>
{row(
S.company.tickets.owner,
<PrincipalChip principal={detail.owner} names={names} />,
@@ -669,15 +665,20 @@ function TicketDialog({
S.common.created,
<span className="font-mono tabular-nums">{created}</span>,
)}
- </dl>
+ </KeyValue>
)}
- </OrgSection>
+ </RuledSection>
- <OrgSection title={S.company.tickets.goal} actions={sectionActions("goal")}>
+ <RuledSection
+ level={3}
+ title={S.company.tickets.goal}
+ actions={sectionActions("goal")}
+ >
{textSection("goal", detail.goal, S.company.tickets.noGoal)}
- </OrgSection>
+ </RuledSection>
- <OrgSection
+ <RuledSection
+ level={3}
title={S.company.tickets.acceptance}
actions={sectionActions("acceptance")}
>
@@ -686,12 +687,12 @@ function TicketDialog({
detail.acceptanceCriteria,
S.company.tickets.noAcceptance,
)}
- </OrgSection>
+ </RuledSection>
{/* Progress: the sentences as written, oldest first, plus the one-line append.
Who wrote one and when is a history entry, not a chip on the sentence; the
bullets are md-compact so a one-line note reads as a line, not a paragraph. */}
- <OrgSection title={S.company.tickets.progress}>
+ <RuledSection level={3} title={S.company.tickets.progress}>
{detail.progress.length === 0 ? (
<p className="text-xs text-gray-400 dark:text-gray-500">
{S.company.tickets.progressEmpty}
@@ -722,11 +723,15 @@ function TicketDialog({
{S.company.tickets.addProgress}
</Button>
</div>
- </OrgSection>
+ </RuledSection>
- <OrgSection title={S.company.tickets.result} actions={sectionActions("result")}>
+ <RuledSection
+ level={3}
+ title={S.company.tickets.result}
+ actions={sectionActions("result")}
+ >
{textSection("result", detail.result, S.company.tickets.noResult)}
- </OrgSection>
+ </RuledSection>
{/* The child tickets, folded: a plain list, each opened by clicking its title. */}
<Fold
@@ -742,7 +747,7 @@ function TicketDialog({
{S.company.tickets.childrenEmpty}
</p>
) : (
- <ul className="space-y-0.5">
+ <ul className="space-y-1">
{children.map((c) => (
<li key={c.ticketId} className="flex items-center gap-2 px-2 py-1.5 text-sm">
<span className="flex min-w-0 flex-1">
@@ -762,7 +767,7 @@ function TicketDialog({
)}
{"cost" in c && (
<span
- className="shrink-0 font-mono text-[11px] tabular-nums text-gray-400 dark:text-gray-500"
+ className="shrink-0 font-mono text-xs tabular-nums text-gray-400 dark:text-gray-500"
data-tooltip={S.company.tickets.cost}
>
{formatMoney(c.cost, currency)}
@@ -788,7 +793,7 @@ function TicketDialog({
{detail.sessionItems.length === 0 ? (
<p className="text-xs text-gray-400 dark:text-gray-500">{S.common.none}</p>
) : (
- <ul className="space-y-0.5">
+ <ul className="space-y-1">
{detail.sessionItems.map((s) => (
<li key={s.sessionId} className="flex items-center gap-2 px-2 py-1.5 text-sm">
<PrincipalChip principal={agentPrincipal(s.agentId)} names={names} />
@@ -816,7 +821,7 @@ function TicketDialog({
)}
</span>
{s.lastActiveAt !== undefined && (
- <span className="shrink-0 font-mono text-[11px] tabular-nums text-gray-400 dark:text-gray-500">
+ <span className="shrink-0 font-mono text-xs tabular-nums text-gray-400 dark:text-gray-500">
{formatDateTime(s.lastActiveAt)}
</span>
)}
@@ -862,7 +867,7 @@ function TicketDialog({
return (
<li
key={h.key}
- className="flex flex-wrap items-baseline gap-x-1.5 gap-y-0.5 text-gray-600 dark:text-gray-300"
+ className="flex flex-wrap items-baseline gap-x-1.5 gap-y-1 text-gray-600 dark:text-gray-300"
>
{parts.map((part, i) => (
<Fragment key={i}>
@@ -1091,7 +1096,7 @@ export function MoveTicketConfirm({
}
/**
- * A section of the dialog that is folded on every visit: the ruled header of `OrgSection`
+ * A section of the dialog that is folded on every visit: the ruled header of a `RuledSection`
* with the app's one collapse chevron in front of it, and what it holds after it — a count,
* a count and a cost — so a reader decides from the closed row whether to open it. The panel
* stays in the DOM and is `hidden` while collapsed — the WAI-ARIA disclosure pattern, so
@@ -1117,13 +1122,18 @@ function Fold({
aria-expanded={open}
aria-controls={panelId}
onClick={() => setOpen((v) => !v)}
- className={`flex w-full items-center ${ICON_GAP.row} border-b border-gray-200 pb-2 text-left text-[11px] font-semibold uppercase tracking-wide text-gray-500 transition-colors duration-150 hover:text-gray-800 dark:border-gray-800 dark:text-gray-400 dark:hover:text-gray-200`}
+ className={`group/fold flex w-full items-center ${ICON_GAP.row} border-b border-gray-200 pb-2 text-left text-xs text-gray-500 transition-colors duration-150 hover:text-gray-800 dark:border-gray-800 dark:text-gray-400 dark:hover:text-gray-200`}
>
<Chevron open={open} size={ICON_SIZE.chevronDense} />
- <span className="min-w-0 truncate">{title}</span>
- <span className="min-w-0 truncate font-normal normal-case tracking-normal text-gray-400 dark:text-gray-500">
- · {summary}
- </span>
+ {/* The title is a group label, like the ruled sections' above it. */}
+ <Text
+ variant="eyebrow"
+ as="span"
+ className="min-w-0 truncate transition-colors duration-150 group-hover/fold:text-fg"
+ >
+ {title}
+ </Text>
+ <span className="min-w-0 truncate text-gray-400 dark:text-gray-500">· {summary}</span>
</button>
<div id={panelId} hidden={!open} className="mt-3 space-y-4">
{children}
diff --git a/packages/web/src/features/company/tickets-page.tsx b/packages/web/src/features/company/tickets-page.tsx
index 02d5ab77..93ac49a0 100644
--- a/packages/web/src/features/company/tickets-page.tsx
+++ b/packages/web/src/features/company/tickets-page.tsx
@@ -37,14 +37,14 @@ import type {
} from "@prismshadow/penguin-server/api";
import {
Button,
- CloseIcon,
+ Count,
FieldLabel,
GlyphIcon,
ICONS,
ICON_SIZE,
Input,
Modal,
- NoticeStrip,
+ Notice,
SearchInput,
Segmented,
Select,
@@ -238,7 +238,7 @@ export function TicketsPage() {
return (
<>
<span className="flex items-start gap-1.5">
- <span className="line-clamp-2 min-w-0 flex-1 text-[13px] font-medium leading-snug text-gray-900 dark:text-gray-100">
+ <span className="line-clamp-2 min-w-0 flex-1 text-sm font-medium leading-snug text-gray-900 dark:text-gray-100">
{t.title}
</span>
{/* The priority reads with the title and shares its line, a size under it; the line
@@ -256,7 +256,7 @@ export function TicketsPage() {
{/* The time-bound line, drawn only when there is something on it: the priority has
moved up to the title and an empty row would leave a gap under it. */}
{(t.due !== undefined || isBlocked(t)) && (
- <span className="mt-2 flex flex-wrap items-center gap-1.5 text-[11px] text-gray-500 dark:text-gray-400">
+ <span className="mt-2 flex flex-wrap items-center gap-1.5 text-xs text-gray-500 dark:text-gray-400">
{t.due !== undefined && (
<span
className={`inline-flex items-center gap-1 font-mono tabular-nums ${overdue ? toneInk.danger : ""}`}
@@ -281,14 +281,14 @@ export function TicketsPage() {
)}
{t.parent !== undefined && (
<span
- className="mt-2 block truncate text-[11px] text-gray-400 dark:text-gray-500"
+ className="mt-2 block truncate text-xs text-gray-400 dark:text-gray-500"
data-tooltip={t.parent}
data-tooltip-content="text"
>
{S.company.tickets.parentLine(titles.get(t.parent) ?? t.parent)}
</span>
)}
- <span className="mt-2 flex items-center gap-2 text-[11px] text-gray-500 dark:text-gray-400">
+ <span className="mt-2 flex items-center gap-2 text-xs text-gray-500 dark:text-gray-400">
<span
className="flex min-w-0 text-gray-700 dark:text-gray-200"
data-tooltip={`${S.company.tickets.owner} ${principalLabel(t.owner, names)}`}
@@ -302,7 +302,7 @@ export function TicketsPage() {
/** The card's frame: a hairline box, danger-edged when the server flagged the ticket. */
const cardFrame = (t: OrgTicketItem) =>
- `block w-full rounded-md border bg-white p-2.5 text-left text-xs dark:bg-gray-900 ${
+ `block w-full rounded-md border bg-white p-3 text-left text-xs dark:bg-gray-900 ${
t.invalid !== undefined
? "border-red-300 dark:border-red-800"
: "border-gray-200 dark:border-gray-800"
@@ -364,40 +364,33 @@ export function TicketsPage() {
}
>
{error !== null && (
- <NoticeStrip
+ <Notice
tone="danger"
- className="mb-3 flex flex-wrap items-center justify-between gap-2 rounded-md border px-3 py-2 text-xs"
+ role="alert"
+ className="mb-3"
+ retry={{ label: S.common.retry, onClick: () => void load() }}
>
- <span>{S.company.tickets.loadFailed(error)}</span>
- <Button size="sm" onClick={() => void load()}>
- {S.common.retry}
- </Button>
- </NoticeStrip>
+ {S.company.tickets.loadFailed(error)}
+ </Notice>
)}
{board !== null &&
allTickets(board).length === 0 &&
board.invalidFiles.length === 0 &&
!hintDismissed && (
- <NoticeStrip
+ <Notice
tone="neutral"
- className="mb-3 flex items-center gap-2 rounded-md border px-3 py-2 text-xs"
- >
- <span className="min-w-0 flex-1">{S.company.tickets.emptyHint}</span>
- <Button
- size="icon"
- variant="ghost"
- className="shrink-0"
- title={S.company.tickets.dismissHint}
- aria-label={S.company.tickets.dismissHint}
- onClick={() => {
+ className="mb-3"
+ dismiss={{
+ ariaLabel: S.company.tickets.dismissHint,
+ onClick: () => {
dismissHint(emptyHintKey);
setHintDismissed(true);
- }}
- >
- <CloseIcon />
- </Button>
- </NoticeStrip>
+ },
+ }}
+ >
+ {S.company.tickets.emptyHint}
+ </Notice>
)}
<div ref={drag.boardRef} className="overflow-x-auto pb-2">
@@ -423,15 +416,13 @@ export function TicketsPage() {
<span className="text-xs font-semibold text-gray-700 dark:text-gray-200">
{S.company.tickets.columns[col.status] ?? col.status}
</span>
- <span className="rounded-full bg-gray-200/70 px-1.5 py-px text-[11px] font-medium tabular-nums text-gray-600 dark:bg-gray-800 dark:text-gray-300">
- {col.tickets.length}
- </span>
+ <Count n={col.tickets.length} />
</div>
<div className="flex flex-1 flex-col gap-2 px-2 pb-2">
{col.tickets.map(card)}
{col.tickets.length === 0 && (
<div
- className={`flex min-h-20 flex-1 items-center justify-center rounded-md border border-dashed px-2 text-center text-[11px] ${
+ className={`flex min-h-20 flex-1 items-center justify-center rounded-md border border-dashed px-2 text-center text-xs ${
dropOver === col.status
? "border-accent text-gray-600 dark:text-gray-300"
: "border-gray-300 text-gray-400 dark:border-gray-700 dark:text-gray-500"
@@ -451,7 +442,7 @@ export function TicketsPage() {
</div>
{(invalids.length > 0 || (board !== null && board.invalidFiles.length > 0)) && (
- <NoticeStrip tone="danger" className="mt-2 rounded-md border px-3 py-2 text-xs">
+ <Notice tone="danger" className="mt-2">
{invalids.length > 0 && (
<>
<p className="mb-1 flex items-center gap-1.5 font-medium">
@@ -460,7 +451,7 @@ export function TicketsPage() {
</span>
{S.company.tickets.invalidTickets}
</p>
- <ul className="mb-2 space-y-0.5">
+ <ul className="mb-2 space-y-1">
{invalids.map((t) => (
<li key={t.ticketId} className="flex items-baseline">
<TitleButton
@@ -484,7 +475,7 @@ export function TicketsPage() {
</span>
{S.company.tickets.invalidFiles}
</p>
- <ul className="space-y-0.5 font-mono">
+ <ul className="space-y-1 font-mono">
{board.invalidFiles.map((f) => (
<li key={f.path}>
{f.path}: {f.error}
@@ -493,7 +484,7 @@ export function TicketsPage() {
</ul>
</>
)}
- </NoticeStrip>
+ </Notice>
)}
{/* The lifted card's ghost: the card's own face at its own width, following the
@@ -557,7 +548,7 @@ function ColumnSkeleton({ status }: { status: OrgTicketStatus }) {
(_, i) => (
<div
key={i}
- className="space-y-2 rounded-md border border-gray-200 bg-white p-2.5 dark:border-gray-800 dark:bg-gray-900"
+ className="space-y-2 rounded-md border border-gray-200 bg-white p-3 dark:border-gray-800 dark:bg-gray-900"
>
<Skeleton className="h-3.5 w-4/5" />
<Skeleton className="h-3 w-2/5" />
diff --git a/packages/web/src/features/machines/machines-page.tsx b/packages/web/src/features/machines/machines-page.tsx
index ea4b7946..b1738f6b 100644
--- a/packages/web/src/features/machines/machines-page.tsx
+++ b/packages/web/src/features/machines/machines-page.tsx
@@ -33,6 +33,8 @@ import {
ICONS,
ICON_SIZE,
NoticeStrip,
+ PageFrame,
+ PageHeader,
SearchInput,
Skeleton,
toastError,
@@ -325,11 +327,13 @@ export function MachinesPage() {
const noImage = state !== null && imageVersion === null;
return (
- <div className="h-full overflow-y-auto p-4 md:p-6">
- <div className="mx-auto max-w-3xl">
- <div className="flex flex-wrap items-center justify-between gap-2">
- <h1 className="ui-display text-xl font-semibold">{S.machines.pageTitle}</h1>
- <div className="flex items-center gap-2">
+ <PageFrame width="sm">
+ {/* The notices belong to the header: they sit under the title, and the selection bar
+ keeps one gap below whichever block ends the header. */}
+ <PageHeader
+ title={S.machines.pageTitle}
+ actions={
+ <>
{behind.length > 0 && (
<Button
size="sm"
@@ -466,21 +470,9 @@ export function MachinesPage() {
</div>
)}
</Dropdown>
- </div>
- </div>
- {projectId !== null && hostForm !== null && (
- <SshHostDialog
- key={hostForm.kind === "edit" ? hostForm.host.alias : "add"}
- mode={hostForm}
- projectId={projectId}
- onClose={() => setHostForm(null)}
- onSaved={(next) => {
- setState(next);
- setError(null);
- }}
- />
- )}
-
+ </>
+ }
+ >
{error !== null && (
<NoticeStrip tone="danger" className="mt-4 rounded-md border px-3 py-2 text-sm">
{error}
@@ -491,85 +483,97 @@ export function MachinesPage() {
{S.machines.noImage}
</NoticeStrip>
)}
+ </PageHeader>
+ {projectId !== null && hostForm !== null && (
+ <SshHostDialog
+ key={hostForm.kind === "edit" ? hostForm.host.alias : "add"}
+ mode={hostForm}
+ projectId={projectId}
+ onClose={() => setHostForm(null)}
+ onSaved={(next) => {
+ setState(next);
+ setError(null);
+ }}
+ />
+ )}
- {/* The selection bar: a fixed slot between the title and the cards, so the cards
- never move when a selection appears or goes. The count is the slot's label; on the
- right, select all and none, then the two verbs — bare glyphs here (see Verb), each
- dimmed when it would do nothing. */}
- <div className="mt-3 flex min-h-10 flex-wrap items-center gap-x-3 gap-y-2 px-1 text-xs text-gray-500">
- <span className="tabular-nums">{S.machines.selectedCount(selectedIds.length)}</span>
- <span className="ml-auto flex flex-wrap items-center gap-1">
- <Verb
- wordless
- label={S.machines.pickAll}
- d={SELECT_ALL_PATH}
- disabled={inUse.length === 0 || selectedIds.length === inUse.length}
- onClick={pickAll}
- />
- <Verb
- wordless
- label={S.machines.pickNone}
- d={SELECT_NONE_PATH}
- disabled={selectedIds.length === 0}
- onClick={pickNone}
- />
- <span className="mx-1 h-4 w-px bg-gray-200 dark:bg-gray-700" aria-hidden="true" />
- <Verb
- wordless
- label={S.machines.use}
- d={PLUG_PATH}
- disabled={selectedIds.length === 0 || posting || noImage}
- onClick={() => void use(selectedIds)}
+ {/* The selection bar: a fixed slot between the title and the cards, so the cards
+ never move when a selection appears or goes. The count is the slot's label; on the
+ right, select all and none, then the two verbs — bare glyphs here (see Verb), each
+ dimmed when it would do nothing. */}
+ <div className="flex min-h-10 flex-wrap items-center gap-x-3 gap-y-2 px-1 text-xs text-gray-500">
+ <span className="tabular-nums">{S.machines.selectedCount(selectedIds.length)}</span>
+ <span className="ml-auto flex flex-wrap items-center gap-1">
+ <Verb
+ wordless
+ label={S.machines.pickAll}
+ d={SELECT_ALL_PATH}
+ disabled={inUse.length === 0 || selectedIds.length === inUse.length}
+ onClick={pickAll}
+ />
+ <Verb
+ wordless
+ label={S.machines.pickNone}
+ d={SELECT_NONE_PATH}
+ disabled={selectedIds.length === 0}
+ onClick={pickNone}
+ />
+ <span className="mx-1 h-4 w-px bg-gray-200 dark:bg-gray-700" aria-hidden="true" />
+ <Verb
+ wordless
+ label={S.machines.use}
+ d={PLUG_PATH}
+ disabled={selectedIds.length === 0 || posting || noImage}
+ onClick={() => void use(selectedIds)}
+ />
+ <Verb
+ wordless
+ label={S.machines.stopUsing}
+ d={UNPLUG_PATH}
+ disabled={selectedIds.length === 0 || posting}
+ onClick={() => void stopUsing(selectedIds)}
+ />
+ </span>
+ </div>
+
+ {state === null ? (
+ <Skeleton className="h-40 w-full rounded-xl" />
+ ) : (
+ <ul className="space-y-2">
+ {local !== null && (
+ <LocalCard
+ machine={local}
+ locale={locale}
+ open={expanded.has(local.id)}
+ onToggleOpen={() => toggleExpanded(local.id)}
/>
- <Verb
- wordless
- label={S.machines.stopUsing}
- d={UNPLUG_PATH}
- disabled={selectedIds.length === 0 || posting}
- onClick={() => void stopUsing(selectedIds)}
+ )}
+ {inUse.map((machine) => (
+ <MachineCard
+ key={machine.id}
+ machine={machine}
+ job={jobFor(jobs, machine.id)}
+ imageVersion={imageVersion}
+ locale={locale}
+ selected={selection.has(machine.id)}
+ onToggle={() => togglePicked(machine.id)}
+ open={expanded.has(machine.id)}
+ onToggleOpen={() => toggleExpanded(machine.id)}
+ busy={posting}
+ onUse={(replaceProgram) => void use([machine.id], replaceProgram)}
+ onStopUsing={() => void stopUsing([machine.id])}
+ onConfigure={() => void configure(machine.alias)}
/>
- </span>
- </div>
-
- {state === null ? (
- <Skeleton className="h-40 w-full rounded-xl" />
- ) : (
- <ul className="space-y-2">
- {local !== null && (
- <LocalCard
- machine={local}
- locale={locale}
- open={expanded.has(local.id)}
- onToggleOpen={() => toggleExpanded(local.id)}
- />
- )}
- {inUse.map((machine) => (
- <MachineCard
- key={machine.id}
- machine={machine}
- job={jobFor(jobs, machine.id)}
- imageVersion={imageVersion}
- locale={locale}
- selected={selection.has(machine.id)}
- onToggle={() => togglePicked(machine.id)}
- open={expanded.has(machine.id)}
- onToggleOpen={() => toggleExpanded(machine.id)}
- busy={posting}
- onUse={(replaceProgram) => void use([machine.id], replaceProgram)}
- onStopUsing={() => void stopUsing([machine.id])}
- onConfigure={() => void configure(machine.alias)}
- />
- ))}
- {inUse.length === 0 && (
- <li className="rounded-xl border border-dashed border-gray-300 p-4 text-sm text-gray-500 dark:border-gray-700">
- <p>{S.machines.noneInUse}</p>
- <p className="mt-1 text-xs">{S.machines.sshHint}</p>
- </li>
- )}
- </ul>
- )}
- </div>
- </div>
+ ))}
+ {inUse.length === 0 && (
+ <li className="rounded-xl border border-dashed border-gray-300 p-4 text-sm text-gray-500 dark:border-gray-700">
+ <p>{S.machines.noneInUse}</p>
+ <p className="mt-1 text-xs">{S.machines.sshHint}</p>
+ </li>
+ )}
+ </ul>
+ )}
+ </PageFrame>
);
}
diff --git a/packages/web/src/features/models/model-tags.ts b/packages/web/src/features/models/model-tags.ts
index 10e941bf..6982853a 100644
--- a/packages/web/src/features/models/model-tags.ts
+++ b/packages/web/src/features/models/model-tags.ts
@@ -23,7 +23,7 @@ import type { DiscountedPrice } from "./model-grouping";
/** The pill itself: no fill at all, so a row of marks sits on its row rather than on top of it. */
export const TAG_SHAPE =
- "whitespace-nowrap rounded-full border border-gray-200 px-1.5 text-[10px] font-medium leading-[15px] dark:border-gray-700";
+ "whitespace-nowrap rounded-full border border-gray-200 px-1.5 text-xs font-medium leading-[15px] dark:border-gray-700";
export const TAG_INK = {
/** This model's standing in the Project. */
diff --git a/packages/web/src/features/models/models-page.tsx b/packages/web/src/features/models/models-page.tsx
index 040c64b7..879f4efa 100644
--- a/packages/web/src/features/models/models-page.tsx
+++ b/packages/web/src/features/models/models-page.tsx
@@ -52,11 +52,12 @@ import {
GlyphIcon,
ICONS,
ICON_SIZE,
- InfoPopover,
Input,
Link,
Modal,
NoticeStrip,
+ PageFrame,
+ PageHeader,
PasswordInput,
ProviderLogo,
Segmented,
@@ -64,6 +65,7 @@ import {
SkeletonList,
Spinner,
Switch,
+ TodoNotice,
buttonClass,
toastError,
toastInfo,
@@ -78,7 +80,8 @@ import { useProject } from "../../state/project";
import { useAuth } from "../../state/auth";
import { USD_TO_CNY, useTheme } from "../../state/theme";
import type { Currency } from "../../state/theme";
-import { AiCreateModal, CreateButtons } from "../ai-create";
+import { AiCreateModal } from "../ai-create";
+import { AiCreateButtons } from "../ai-create/ai-create-buttons";
import { formatDateTime, humanizeTokens } from "../../lib/format";
import {
MODEL_PROVIDERS,
@@ -140,7 +143,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 { TodoNotice } from "../../components/ui/todo-notice";
import { buildImportedRows } from "./group-import";
import { tpsTone, ttftTone } from "./speed-test";
import type { SpeedResult, SpeedTone } from "./speed-test";
@@ -1153,394 +1155,394 @@ export function ModelsPage() {
const oauthKeyAuth = oauthFlow === undefined ? null : KEY_AUTH[oauthFlow];
return (
- <div className="h-full overflow-y-auto p-4 md:p-6">
- <div className="mx-auto max-w-5xl">
- <div className="mb-4">
- <div className="flex flex-wrap items-center justify-between gap-2">
- <h1 className="ui-display 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, the owner-only "sync presets" action and the pair of
- create buttons — the AI path and the group form, offered side by side (per-model
- entry points still 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. */}
- <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.models.searchPlaceholder}
- />
- </div>
- {/* 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"
- variant="primary"
- onClick={() => void syncPresets()}
- disabled={busy || rows === null}
- title={`${S.models.syncCatalogHint} · ${syncNote}`}
- >
- {S.models.syncCatalog}
- <span className="sr-only"> · {syncNote}</span>
- </Button>
- )}
- {isOwner && (
- <CreateButtons
- size="sm"
- // Only the form needs the table: AddGroupDialog is mounted behind `rows`, so
- // without it the manual button would be a dead click. The AI path is left live
- // precisely because a failed load is one of the things it can repair.
- manualDisabled={rows === null}
- onAi={() => setAiAddOpen(true)}
- onManual={() => setAddGroupOpen(true)}
- />
- )}
+ <PageFrame>
+ {/* The header holds search, the owner-only "sync presets" action and the pair of create
+ buttons — the AI path and the group form, offered side by side (per-model entry points
+ still live in each group header); on narrow screens the actions wrap to their own line
+ and the search box shrinks flexibly, fixed width at >=sm. A member reads why nothing
+ here is editable behind the title's "?". */}
+ <PageHeader
+ title={S.models.title}
+ info={isOwner ? undefined : S.models.readOnlyHint}
+ actions={
+ <>
+ <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.models.searchPlaceholder}
+ />
</div>
- </div>
- {/* Last stop on the Models trail, in the one shape all four dismissible trails use:
- directly under the title, naming what is waiting, carrying the sync itself, and
- carrying the way down for someone who has looked and decided to stay off the
- catalog. This is the one page whose two counts are both real — the catalog is a
- list of entries, so an entry the table lacks is genuinely new — and both come off
- the delta the sync action itself computes (catalog-sync.ts), never a second count.
- The toolbar's "sync presets" button is unchanged and still runs it directly. */}
- {isOwner && todo && syncCounts && (
- <TodoNotice
- text={
- syncCounts.added === null
- ? S.todo.changesUpgradable(syncCounts.updated)
- : S.todo.changesWithAdded(syncCounts.added, syncCounts.updated)
- }
- actionLabel={S.todo.updateNow}
- busy={syncing}
- onAction={() => setSyncConfirmOpen(true)}
- dismissLabel={S.todo.dismiss}
- onDismiss={() => dismissTodo(projectId, "models", todo.signature)}
- />
- )}
- </div>
-
- {rows === null ? (
- <SkeletonList rows={4} />
- ) : rows.length === 0 ? (
- <EmptyState
- title={S.models.empty}
- action={
- isOwner && <Button onClick={() => setAddingTo("custom")}>{S.models.addCustom}</Button>
+ {/* 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"
+ variant="primary"
+ onClick={() => void syncPresets()}
+ disabled={busy || rows === null}
+ title={`${S.models.syncCatalogHint} · ${syncNote}`}
+ >
+ {S.models.syncCatalog}
+ <span className="sr-only"> · {syncNote}</span>
+ </Button>
+ )}
+ {isOwner && (
+ <AiCreateButtons
+ size="sm"
+ // Only the form needs the table: AddGroupDialog is mounted behind `rows`, so
+ // without it the manual button would be a dead click. The AI path is left live
+ // precisely because a failed load is one of the things it can repair.
+ manualDisabled={rows === null}
+ onAi={() => setAiAddOpen(true)}
+ onManual={() => setAddGroupOpen(true)}
+ />
+ )}
+ </>
+ }
+ >
+ {/* Last stop on the Models trail, in the one shape all four dismissible trails use:
+ directly under the title, naming what is waiting, carrying the sync itself, and
+ carrying the way down for someone who has looked and decided to stay off the
+ catalog. This is the one page whose two counts are both real — the catalog is a
+ list of entries, so an entry the table lacks is genuinely new — and both come off
+ the delta the sync action itself computes (catalog-sync.ts), never a second count.
+ The toolbar's "sync presets" button is unchanged and still runs it directly. */}
+ {isOwner && todo && syncCounts && (
+ <TodoNotice
+ text={
+ syncCounts.added === null
+ ? S.todo.changesUpgradable(syncCounts.updated)
+ : S.todo.changesWithAdded(syncCounts.added, syncCounts.updated)
}
+ actionLabel={S.todo.updateNow}
+ busy={syncing}
+ onAction={() => setSyncConfirmOpen(true)}
+ dismissLabel={S.todo.dismiss}
+ onDismiss={() => dismissTodo(projectId, "models", todo.signature)}
/>
- ) : groups.length === 0 ? (
- <EmptyState title={S.models.noSearchResults} />
- ) : (
- <div className="space-y-3">
- {groups.map((group) => {
- const open = isGroupExpanded(expanded, group.provider.id, searching);
- const drag = groupDragProps(group.provider.id);
- const platformAuthorized =
- group.provider.id === PENGUIN_GO_PROVIDER_ID &&
- group.rows.some((row) => Boolean(row.credential?.apiKeyMasked));
- return (
- // The drop indicator is drawn against the WHOLE group, so "below" reads as
- // after this group and its model cards rather than between the header and
- // its own first card. It needs this wrapper to live in: the section clips
- // its children (overflow-hidden carries the expand/collapse transition).
- // Absolutely positioned, so it costs no layout width and cannot push the
- // header's up-to-six actions out of a narrow page.
- <div key={group.provider.id} className="relative">
- {drag.dropEdge !== null && (
- <div
- aria-hidden
- className={`pointer-events-none absolute inset-x-0 z-10 h-0.5 rounded-full bg-accent ${
- drag.dropEdge === "above" ? "-top-1.5" : "-bottom-1.5"
- }`}
- />
- )}
- <section className="overflow-hidden rounded-md border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-900">
- {/* Group header: collapse button (logo + vendor name + count) + group-level
- actions on the right. Actions are separate elements because buttons can't
- nest. The row is a size container: the sidebar can narrow it while the
- viewport remains desktop-sized, so action labels must respond to this
- row's actual width rather than viewport breakpoints. Narrow rows never
- hide an action — each one keeps its icon (with aria-label + title) and
- only sheds its text label. The row is also the drag handle for
- reordering the group (groupDragProps). */}
- <div
- {...drag.header}
- className={`@container flex items-center gap-2 bg-gray-50 pr-2 transition-colors duration-150 hover:bg-gray-100 dark:bg-gray-900/60 dark:hover:bg-gray-800/60${canDrag && !searching ? " cursor-grab" : ""}`}
+ )}
+ </PageHeader>
+
+ {rows === null ? (
+ <SkeletonList rows={4} />
+ ) : rows.length === 0 ? (
+ <EmptyState
+ title={S.models.empty}
+ action={
+ isOwner && <Button onClick={() => setAddingTo("custom")}>{S.models.addCustom}</Button>
+ }
+ />
+ ) : groups.length === 0 ? (
+ <EmptyState title={S.models.noSearchResults} />
+ ) : (
+ <div className="space-y-3">
+ {groups.map((group) => {
+ const open = isGroupExpanded(expanded, group.provider.id, searching);
+ const drag = groupDragProps(group.provider.id);
+ const platformAuthorized =
+ group.provider.id === PENGUIN_GO_PROVIDER_ID &&
+ group.rows.some((row) => Boolean(row.credential?.apiKeyMasked));
+ return (
+ // The drop indicator is drawn against the WHOLE group, so "below" reads as
+ // after this group and its model cards rather than between the header and
+ // its own first card. It needs this wrapper to live in: the section clips
+ // its children (overflow-hidden carries the expand/collapse transition).
+ // Absolutely positioned, so it costs no layout width and cannot push the
+ // header's up-to-six actions out of a narrow page.
+ <div key={group.provider.id} className="relative">
+ {drag.dropEdge !== null && (
+ <div
+ aria-hidden
+ className={`pointer-events-none absolute inset-x-0 z-10 h-0.5 rounded-full bg-accent ${
+ drag.dropEdge === "above" ? "-top-1.5" : "-bottom-1.5"
+ }`}
+ />
+ )}
+ <section className="overflow-hidden rounded-md border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-900">
+ {/* Group header: collapse button (logo + vendor name + count) + group-level
+ actions on the right. Actions are separate elements because buttons can't
+ nest. The row is a size container: the sidebar can narrow it while the
+ viewport remains desktop-sized, so action labels must respond to this
+ row's actual width rather than viewport breakpoints. Narrow rows never
+ hide an action — each one keeps its icon (with aria-label + title) and
+ only sheds its text label. The row is also the drag handle for
+ reordering the group (groupDragProps). */}
+ <div
+ {...drag.header}
+ className={`@container flex items-center gap-2 bg-gray-50 pr-2 transition-colors duration-150 hover:bg-gray-100 dark:bg-gray-900/60 dark:hover:bg-gray-800/60${canDrag && !searching ? " cursor-grab" : ""}`}
+ >
+ <button
+ type="button"
+ aria-expanded={open}
+ onClick={() => toggleGroup(group.provider.id)}
+ className="flex min-w-0 flex-1 items-center gap-2 px-3 py-2.5 text-left"
>
- <button
- type="button"
- aria-expanded={open}
- onClick={() => toggleGroup(group.provider.id)}
- className="flex min-w-0 flex-1 items-center gap-2.5 px-3 py-2.5 text-left"
- >
- <ProviderLogo
- provider={group.provider.id}
- className="h-5 w-5 shrink-0 text-gray-700 dark:text-gray-300"
- />
- {/* The vendor name is the only thing in this row allowed to take the
- remaining space, and the only one that truncates. Giving it a
- minimum width is what made a narrow row overlap: the items beside
- it never shrink, so once their widths plus that floor exceeded the
- button, the whole group overflowed the box and ran under the
- actions. The floor is gone; what gives way instead is the two marks
- after it, which drop out on a narrow row (below, and the actions'
- labels do the same at @3xl). The name then always has the leftovers
- to itself and truncates inside them, so nothing can overlap. */}
- <span className="min-w-0 truncate text-sm font-semibold">
- {group.provider.label}
- </span>
- <span className="hidden shrink-0 whitespace-nowrap font-mono text-xs text-gray-400 @xl:inline">
- {S.models.modelCount(group.rows.length)}
+ <ProviderLogo
+ provider={group.provider.id}
+ className="h-5 w-5 shrink-0 text-gray-700 dark:text-gray-300"
+ />
+ {/* The vendor name is the only thing in this row allowed to take the
+ remaining space, and the only one that truncates. Giving it a
+ minimum width is what made a narrow row overlap: the items beside
+ it never shrink, so once their widths plus that floor exceeded the
+ button, the whole group overflowed the box and ran under the
+ actions. The floor is gone; what gives way instead is the two marks
+ after it, which drop out on a narrow row (below, and the actions'
+ labels do the same at @3xl). The name then always has the leftovers
+ to itself and truncates inside them, so nothing can overlap. */}
+ <span className="min-w-0 truncate text-sm font-semibold">
+ {group.provider.label}
+ </span>
+ <span className="hidden shrink-0 whitespace-nowrap font-mono text-xs text-gray-400 @xl:inline">
+ {S.models.modelCount(group.rows.length)}
+ </span>
+ {/* The recommendation rides the collapse bar itself, so it is read with
+ the group's name rather than as a caption floating above the
+ section. `shrink-0` keeps it whole: the vendor name beside it is
+ the element allowed to truncate on a narrow page. */}
+ {group.provider.recommended && (
+ // Not a `Badge`: every Badge tone is a status or `neutral`, and an
+ // endorsement is neither, which is the category tone.ts keeps out on
+ // purpose. Unfilled, like the card marks below it: an outline
+ // is enough to make it a pill, and a block of colour on the collapse
+ // bar competes with the vendor name it is endorsing. It holds on
+ // longer than the model count beside it and gives way before the
+ // name does.
+ //
+ // Gold, and the darker end of it: `yellow-700` (#a16207) is the last
+ // rung that still clears 4.5:1 against this bar's gray-50 — 12px bold
+ // is not WCAG "large text", so the brighter golds above it are not
+ // available in light mode. Dark mode takes yellow-400, the bright
+ // gold, which clears it comfortably on this app's near-black. The
+ // ring is the text's own hue at 40%, in both themes: a ring brighter
+ // than the words it encloses reads as a highlighter, not as gold.
+ <span className="hidden shrink-0 whitespace-nowrap rounded-full border border-yellow-700/40 px-2 py-0.5 text-xs font-semibold text-yellow-700 @lg:inline dark:border-yellow-400/40 dark:text-yellow-400">
+ {S.models.recommendedGroup}
</span>
- {/* The recommendation rides the collapse bar itself, so it is read with
- the group's name rather than as a caption floating above the
- section. `shrink-0` keeps it whole: the vendor name beside it is
- the element allowed to truncate on a narrow page. */}
- {group.provider.recommended && (
- // Not a `Badge`: every Badge tone is a status or `neutral`, and an
- // endorsement is neither, which is the category tone.ts keeps out on
- // purpose. Unfilled, like the card marks below it: an outline
- // is enough to make it a pill, and a block of colour on the collapse
- // bar competes with the vendor name it is endorsing. It holds on
- // longer than the model count beside it and gives way before the
- // name does.
- //
- // Gold, and the darker end of it: `yellow-700` (#a16207) is the last
- // rung that still clears 4.5:1 against this bar's gray-50 — 11px bold
- // is not WCAG "large text", so the brighter golds above it are not
- // available in light mode. Dark mode takes yellow-400, the bright
- // gold, which clears it comfortably on this app's near-black. The
- // ring is the text's own hue at 40%, in both themes: a ring brighter
- // than the words it encloses reads as a highlighter, not as gold.
- <span className="hidden shrink-0 whitespace-nowrap rounded-full border border-yellow-700/40 px-2 py-0.5 text-[11px] font-semibold text-yellow-700 @lg:inline dark:border-yellow-400/40 dark:text-yellow-400">
- {S.models.recommendedGroup}
- </span>
- )}
- </button>
- {isOwner && platformAuthorized && (
- // A stored Penguin Go key enables catalog refresh, but authorization remains
- // a separate action so the owner can replace it with another account.
- // Sync leads the group actions and sits immediately before Add model.
- <Button
- size="sm"
- variant="ghost"
- className="shrink-0"
- disabled={busy}
- aria-label={`${S.models.platformSync} ${group.provider.label}`}
- title={S.models.platformSync}
- onClick={() => void syncPlatformModels()}
- >
- <GlyphIcon d={ICONS.rotateCw} size={ICON_SIZE.groupHeaderAction} />
- <span className="hidden @3xl:inline">{S.models.platformSync}</span>
- </Button>
- )}
- {isOwner && !isVendorGroup(group.provider.id) && (
- // Add-model entry point: on every group header whose group decides a
- // protocol — custom, user-defined, and the gateways. A vendor group
- // carries the built-in catalog and nothing else: it persists no
- // client_type, so AgentHub places its entries by the model id alone
- // and anything outside the catalog's ids cannot start. The way to add
- // a model of one's own is a custom group, which has a protocol to
- // pick. Narrow rows never hide a group action — they drop its label
- // and keep the icon (same pattern for every action in this row), so
- // the button stays reachable.
- <Button
- size="sm"
- variant="ghost"
- className="shrink-0"
- disabled={busy}
- aria-label={`${S.models.addToGroup} ${group.provider.label}`}
- title={S.models.addToGroup}
- onClick={() => setAddingTo(group.provider.id)}
- >
- <GlyphIcon d={ICONS.plus} size={ICON_SIZE.groupHeaderAction} />
- <span className="hidden @3xl:inline">{S.models.addToGroup}</span>
- </Button>
)}
- {isOwner &&
- (group.provider.oauth || group.provider.bridgeAuth !== undefined) && (
- // Authorize-a-key action: rendered off the group's own catalog
- // descriptor, so a provider gains this button by publishing a flow
- // rather than by being named here — `oauth` for the ones whose PKCE
- // round-trip the App runs itself, `bridgeAuth` for the ones an
- // authorization bridge runs for it. Same narrow-row rule as its
- // neighbours — the label goes, the icon and its names stay. It leads the
- // manual key action: where a group can mint a key, that is the shorter path.
- <Button
- size="sm"
- variant="ghost"
- className="shrink-0"
- disabled={busy}
- aria-label={`${S.models.oauthKey} ${group.provider.label}`}
- title={S.models.oauthKey}
- onClick={() => setOauthFor(group.provider.id)}
- >
- <GlyphIcon d={SIGN_IN_ICON} size={ICON_SIZE.groupHeaderAction} />
- <span className="hidden @3xl:inline">{S.models.oauthKey}</span>
- </Button>
- )}
- {isOwner && group.provider.id !== "custom" && (
- // Bulk key action: icon-only while this row is narrow, labeled from
- // @3xl up. The button itself never disappears — aria-label + title
- // carry the name while the visible label is dropped.
- <Button
- size="sm"
- variant="ghost"
- className="shrink-0"
- disabled={busy}
- aria-label={`${S.models.groupApiKey} ${group.provider.label}`}
- title={S.models.groupApiKey}
- onClick={() => setGroupKeyFor(group.provider.id)}
- >
- <GlyphIcon d={ICONS.key} size={ICON_SIZE.groupHeaderAction} />
- <span className="hidden @3xl:inline">{S.models.groupApiKey}</span>
- </Button>
- )}
- {isOwner && (
- <Button
- size="sm"
- variant="ghost"
- className="shrink-0"
- disabled={busy || speedRunning !== null}
- aria-label={`${S.models.speedTest} ${group.provider.label}`}
- title={
- speedRunning === group.provider.id
- ? S.models.speedPending
- : S.models.speedTest
- }
- onClick={() => setSpeedFor(group.provider.id)}
- >
- <GlyphIcon d={GAUGE_ICON} size={ICON_SIZE.groupHeaderAction} />
- {/* Compact rows keep this accessible action icon-only. */}
- <span className="hidden @3xl:inline">
- {speedRunning === group.provider.id
- ? S.models.speedPending
- : S.models.speedTest}
- </span>
- </Button>
- )}
- {isOwner && !MODEL_PROVIDERS.some((p) => p.id === group.provider.id) && (
- // Whole-group delete, user-defined groups only: a built-in group is
- // catalog identity (its rows delete one by one), a user-defined group
- // exists solely through its rows and can go as a unit.
+ </button>
+ {isOwner && platformAuthorized && (
+ // A stored Penguin Go key enables catalog refresh, but authorization remains
+ // a separate action so the owner can replace it with another account.
+ // Sync leads the group actions and sits immediately before Add model.
+ <Button
+ size="sm"
+ variant="ghost"
+ className="shrink-0"
+ disabled={busy}
+ aria-label={`${S.models.platformSync} ${group.provider.label}`}
+ title={S.models.platformSync}
+ onClick={() => void syncPlatformModels()}
+ >
+ <GlyphIcon d={ICONS.rotateCw} size={ICON_SIZE.groupHeaderAction} />
+ <span className="hidden @3xl:inline">{S.models.platformSync}</span>
+ </Button>
+ )}
+ {isOwner && !isVendorGroup(group.provider.id) && (
+ // Add-model entry point: on every group header whose group decides a
+ // protocol — custom, user-defined, and the gateways. A vendor group
+ // carries the built-in catalog and nothing else: it persists no
+ // client_type, so AgentHub places its entries by the model id alone
+ // and anything outside the catalog's ids cannot start. The way to add
+ // a model of one's own is a custom group, which has a protocol to
+ // pick. Narrow rows never hide a group action — they drop its label
+ // and keep the icon (same pattern for every action in this row), so
+ // the button stays reachable.
+ <Button
+ size="sm"
+ variant="ghost"
+ className="shrink-0"
+ disabled={busy}
+ aria-label={`${S.models.addToGroup} ${group.provider.label}`}
+ title={S.models.addToGroup}
+ onClick={() => setAddingTo(group.provider.id)}
+ >
+ <GlyphIcon d={ICONS.plus} size={ICON_SIZE.groupHeaderAction} />
+ <span className="hidden @3xl:inline">{S.models.addToGroup}</span>
+ </Button>
+ )}
+ {isOwner &&
+ (group.provider.oauth || group.provider.bridgeAuth !== undefined) && (
+ // Authorize-a-key action: rendered off the group's own catalog
+ // descriptor, so a provider gains this button by publishing a flow
+ // rather than by being named here — `oauth` for the ones whose PKCE
+ // round-trip the App runs itself, `bridgeAuth` for the ones an
+ // authorization bridge runs for it. Same narrow-row rule as its
+ // neighbours — the label goes, the icon and its names stay. It leads the
+ // manual key action: where a group can mint a key, that is the shorter path.
<Button
size="sm"
variant="ghost"
className="shrink-0"
disabled={busy}
- aria-label={`${S.models.deleteGroup} ${group.provider.label}`}
- title={S.models.deleteGroup}
- onClick={() => setDeleteGroupFor(group.provider.id)}
+ aria-label={`${S.models.oauthKey} ${group.provider.label}`}
+ title={S.models.oauthKey}
+ onClick={() => setOauthFor(group.provider.id)}
>
- <GlyphIcon d={ICONS.trash} size={ICON_SIZE.groupHeaderAction} />
- <span className="hidden @3xl:inline">{S.models.deleteGroup}</span>
+ <GlyphIcon d={SIGN_IN_ICON} size={ICON_SIZE.groupHeaderAction} />
+ <span className="hidden @3xl:inline">{S.models.oauthKey}</span>
</Button>
)}
- {group.provider.apiKeyUrl && (
- // External link: its label is the last one admitted as space grows
- // (@4xl); below that only the link's external glyph is left, with a
- // small padding bump for a usable touch target.
- <Link
- href={group.provider.apiKeyUrl}
- external
- variant="standalone"
- aria-label={`${S.models.getApiKey} ${group.provider.label}`}
- data-tooltip={S.models.getApiKey}
- className="shrink-0 whitespace-nowrap p-1 text-xs @4xl:p-0"
- >
- <span className="hidden @4xl:inline">{S.models.getApiKey}</span>
- </Link>
- )}
- {/* Collapse arrow sits at the far right of the header (after group actions); it too can be clicked to collapse. */}
- <button
- type="button"
- aria-expanded={open}
- aria-label={group.provider.label}
- onClick={() => toggleGroup(group.provider.id)}
- className="shrink-0 p-1.5"
+ {isOwner && group.provider.id !== "custom" && (
+ // Bulk key action: icon-only while this row is narrow, labeled from
+ // @3xl up. The button itself never disappears — aria-label + title
+ // carry the name while the visible label is dropped.
+ <Button
+ size="sm"
+ variant="ghost"
+ className="shrink-0"
+ disabled={busy}
+ aria-label={`${S.models.groupApiKey} ${group.provider.label}`}
+ title={S.models.groupApiKey}
+ onClick={() => setGroupKeyFor(group.provider.id)}
>
- <Chevron open={open} className="text-gray-400" />
- </button>
- </div>
-
- {/* Expand/collapse height transition: grid-template-rows tweens between
- 0fr and 1fr, with the inner overflow-hidden handling clipping — pure
- CSS, no need to measure content height. Content stays in the DOM while
- collapsed (height is 0), so both directions animate. */}
- <div
- className={`grid transition-[grid-template-rows] duration-200 ease-out ${open ? "grid-rows-[1fr]" : "grid-rows-[0fr]"}`}
+ <GlyphIcon d={ICONS.key} size={ICON_SIZE.groupHeaderAction} />
+ <span className="hidden @3xl:inline">{S.models.groupApiKey}</span>
+ </Button>
+ )}
+ {isOwner && (
+ <Button
+ size="sm"
+ variant="ghost"
+ className="shrink-0"
+ disabled={busy || speedRunning !== null}
+ aria-label={`${S.models.speedTest} ${group.provider.label}`}
+ title={
+ speedRunning === group.provider.id
+ ? S.models.speedPending
+ : S.models.speedTest
+ }
+ onClick={() => setSpeedFor(group.provider.id)}
+ >
+ <GlyphIcon d={GAUGE_ICON} size={ICON_SIZE.groupHeaderAction} />
+ {/* Compact rows keep this accessible action icon-only. */}
+ <span className="hidden @3xl:inline">
+ {speedRunning === group.provider.id
+ ? S.models.speedPending
+ : S.models.speedTest}
+ </span>
+ </Button>
+ )}
+ {isOwner && !MODEL_PROVIDERS.some((p) => p.id === group.provider.id) && (
+ // Whole-group delete, user-defined groups only: a built-in group is
+ // catalog identity (its rows delete one by one), a user-defined group
+ // exists solely through its rows and can go as a unit.
+ <Button
+ size="sm"
+ variant="ghost"
+ className="shrink-0"
+ disabled={busy}
+ aria-label={`${S.models.deleteGroup} ${group.provider.label}`}
+ title={S.models.deleteGroup}
+ onClick={() => setDeleteGroupFor(group.provider.id)}
+ >
+ <GlyphIcon d={ICONS.trash} size={ICON_SIZE.groupHeaderAction} />
+ <span className="hidden @3xl:inline">{S.models.deleteGroup}</span>
+ </Button>
+ )}
+ {group.provider.apiKeyUrl && (
+ // External link: its label is the last one admitted as space grows
+ // (@4xl); below that only the link's external glyph is left, with a
+ // small padding bump for a usable touch target.
+ <Link
+ href={group.provider.apiKeyUrl}
+ external
+ variant="standalone"
+ aria-label={`${S.models.getApiKey} ${group.provider.label}`}
+ data-tooltip={S.models.getApiKey}
+ className="shrink-0 whitespace-nowrap p-1 text-xs @4xl:p-0"
+ >
+ <span className="hidden @4xl:inline">{S.models.getApiKey}</span>
+ </Link>
+ )}
+ {/* Collapse arrow sits at the far right of the header (after group actions); it too can be clicked to collapse. */}
+ <button
+ type="button"
+ aria-expanded={open}
+ aria-label={group.provider.label}
+ onClick={() => toggleGroup(group.provider.id)}
+ className="shrink-0 p-1.5"
>
- {/* inert while collapsed: a card with zero height shouldn't still be Tab-focusable or clickable. */}
- <div className="overflow-hidden" inert={!open}>
- <div
- className={`grid grid-cols-1 gap-2 border-t border-gray-200 p-2.5 transition-opacity duration-200 sm:grid-cols-2 lg:grid-cols-3 dark:border-gray-800 ${open ? "opacity-100" : "opacity-0"}`}
- >
- {group.rows.length === 0 ? (
- // An empty group only ever occurs for custom (always shown when there's no search query, to host the add entry point).
- <p className="col-span-full py-1 text-center text-xs text-gray-400 dark:text-gray-500">
- {S.models.groupEmptyHint}
- </p>
- ) : (
- group.rows.map((row) => (
- <ModelCard
- key={`${row.provider}:${row.modelId}`}
- row={row}
- currency={currency}
- isDefault={sameModelRef(rowRef(row), defaultModel)}
- isVisionModel={sameModelRef(rowRef(row), visionModel)}
- speed={speedResults.get(refMapKey(row.provider, row.modelId))}
- usedTokens={usedTokens.get(refMapKey(row.provider, row.modelId))}
- hourTick={hourTick}
- onOpen={() => {
- setEditingMovedToCustom(false);
- setEditing(rowRef(row));
- }}
- onMoveToCustom={
- isOwner
- ? () => {
- setEditingMovedToCustom(true);
- setEditing(rowRef(row));
- }
- : undefined
- }
- onSyncPresets={isOwner ? () => void syncPresets() : undefined}
- />
- ))
- )}
- </div>
+ <Chevron open={open} className="text-gray-400" />
+ </button>
+ </div>
+
+ {/* Expand/collapse: grid-template-rows goes between 0fr and 1fr, with the
+ inner overflow-hidden handling clipping — no need to measure content height.
+ The grid carries the theme's layout motion, which decides how the fold moves
+ (and stills it under reduced motion). Content stays in the DOM while
+ collapsed (height is 0), so both directions animate. The section keeps its
+ own head rather than being a CollapsibleSection: the head is the group's
+ drag handle and a size container, and its chevron trails the actions. */}
+ <div
+ data-layout-motion
+ className={`grid ${open ? "grid-rows-[1fr]" : "grid-rows-[0fr]"}`}
+ >
+ {/* inert while collapsed: a card with zero height shouldn't still be Tab-focusable or clickable. */}
+ <div className="overflow-hidden" inert={!open}>
+ <div
+ className={`grid grid-cols-1 gap-2 border-t border-gray-200 p-3 transition-opacity duration-200 sm:grid-cols-2 lg:grid-cols-3 dark:border-gray-800 ${open ? "opacity-100" : "opacity-0"}`}
+ >
+ {group.rows.length === 0 ? (
+ // An empty group only ever occurs for custom (always shown when there's no search query, to host the add entry point).
+ <p className="col-span-full py-1 text-center text-xs text-gray-400 dark:text-gray-500">
+ {S.models.groupEmptyHint}
+ </p>
+ ) : (
+ group.rows.map((row) => (
+ <ModelCard
+ key={`${row.provider}:${row.modelId}`}
+ row={row}
+ currency={currency}
+ isDefault={sameModelRef(rowRef(row), defaultModel)}
+ isVisionModel={sameModelRef(rowRef(row), visionModel)}
+ speed={speedResults.get(refMapKey(row.provider, row.modelId))}
+ usedTokens={usedTokens.get(refMapKey(row.provider, row.modelId))}
+ hourTick={hourTick}
+ onOpen={() => {
+ setEditingMovedToCustom(false);
+ setEditing(rowRef(row));
+ }}
+ onMoveToCustom={
+ isOwner
+ ? () => {
+ setEditingMovedToCustom(true);
+ setEditing(rowRef(row));
+ }
+ : undefined
+ }
+ onSyncPresets={isOwner ? () => void syncPresets() : undefined}
+ />
+ ))
+ )}
</div>
</div>
- </section>
- </div>
- );
- })}
- {isOwner && query.trim() === "" && (
- // "Add group" (user-defined group): hidden while searching (the group list itself is being filtered).
- <button
- type="button"
- onClick={() => setAddGroupOpen(true)}
- className="w-full rounded-md border border-dashed border-gray-300 px-3 py-2.5 text-sm text-gray-500 transition-colors hover:border-gray-400 hover:text-gray-700 dark:border-gray-700 dark:text-gray-400 dark:hover:border-gray-600 dark:hover:text-gray-200"
- >
- + {S.models.addGroup}
- </button>
- )}
- </div>
- )}
+ </div>
+ </section>
+ </div>
+ );
+ })}
+ {isOwner && query.trim() === "" && (
+ // "Add group" (user-defined group): hidden while searching (the group list itself is being filtered).
+ <button
+ type="button"
+ onClick={() => setAddGroupOpen(true)}
+ className="w-full rounded-md border border-dashed border-gray-300 px-3 py-2.5 text-sm text-gray-500 transition-colors hover:border-gray-400 hover:text-gray-700 dark:border-gray-700 dark:text-gray-400 dark:hover:border-gray-600 dark:hover:text-gray-200"
+ >
+ + {S.models.addGroup}
+ </button>
+ )}
+ </div>
+ )}
- {loadError && <p className="mt-3 text-xs text-red-600 dark:text-red-400">{loadError}</p>}
- </div>
+ {loadError && <p className="mt-3 text-xs text-red-600 dark:text-red-400">{loadError}</p>}
{rows && groupKeyFor && (
<GroupKeyDialog
@@ -1807,7 +1809,7 @@ export function ModelsPage() {
}}
/>
)}
- </div>
+ </PageFrame>
);
}
@@ -2221,13 +2223,13 @@ export function ModelCard({
const speedBadges =
speed === "pending" ? (
- <span className="shrink-0 text-[11px] text-gray-400">{S.models.speedPending}</span>
+ <span className="shrink-0 text-xs text-gray-400">{S.models.speedPending}</span>
) : speed ? (
speed.ok ? (
- <span className="flex shrink-0 items-center gap-1.5 text-[11px] font-medium">
+ <span className="flex shrink-0 items-center gap-1.5 text-xs font-medium">
{speed.ttftMs !== undefined && (
<span
- className={`flex items-center gap-0.5 ${TONE_CLASS[ttftTone(speed.ttftMs)]}`}
+ className={`flex items-center gap-1 ${TONE_CLASS[ttftTone(speed.ttftMs)]}`}
data-tooltip={S.models.ttftTitle}
>
<GlyphIcon d={CLOCK_ICON} size={11} />
@@ -2236,7 +2238,7 @@ export function ModelCard({
)}
{speed.tps !== undefined && (
<span
- className={`flex items-center gap-0.5 ${TONE_CLASS[tpsTone(speed.tps)]}`}
+ className={`flex items-center gap-1 ${TONE_CLASS[tpsTone(speed.tps)]}`}
data-tooltip={S.models.tpsTitle}
>
<GlyphIcon d={ZAP_ICON} size={11} />
@@ -2246,7 +2248,7 @@ export function ModelCard({
</span>
) : (
<span
- className="shrink-0 text-[11px] font-medium text-red-600 dark:text-red-400"
+ className="shrink-0 text-xs font-medium text-red-600 dark:text-red-400"
data-tooltip={speed.message}
>
{S.models.speedFailed}
@@ -2267,17 +2269,17 @@ export function ModelCard({
but it is a detail you go looking for rather than one you scan by, and it is a click
away in the config dialog; the width it was taking now belongs to the name. */}
<span className="flex w-full min-w-0 items-baseline gap-2">
- <span className="min-w-0 flex-1 truncate text-[13px] font-medium">
+ <span className="min-w-0 flex-1 truncate text-sm font-medium">
{modelLabelOf(row.displayName, row.modelId)}
</span>
{/* What this model has spent over its whole life, on the row's right edge. Recessive by
- design — grey and a size below the meta line: it is context for a name you are
+ design — grey, on the small rung below the name: it is context for a name you are
scanning past, not a figure the page is about. A model that has never run shows
nothing rather than a zero, which would read as a measurement instead of an
absence. */}
{usedTokens !== undefined && usedTokens > 0 && (
<span
- className="shrink-0 text-[10px] tabular-nums text-gray-400 dark:text-gray-500"
+ className="shrink-0 text-xs tabular-nums text-gray-400 dark:text-gray-500"
data-tooltip={S.models.usedTokensTitle}
>
{S.models.usedTokens(humanizeTokens(usedTokens))}
@@ -2303,7 +2305,7 @@ export function ModelCard({
{/* 3. Meta line: the truncating text takes the flexible space; speed badges keep their own
non-shrinking slot on the right so the numbers never wrap or get pushed out. */}
<span className="flex w-full items-center gap-1.5">
- <span className="min-w-0 flex-1 truncate text-[11px] text-gray-400 dark:text-gray-500">
+ <span className="min-w-0 flex-1 truncate text-xs text-gray-400 dark:text-gray-500">
{meta.map((part, i) => (
<Fragment key={i}>
{i > 0 && " · "}
@@ -2321,7 +2323,7 @@ export function ModelCard({
{fix !== null && (
<NoticeStrip
tone="attention"
- className="flex items-center justify-between gap-2 border-t px-3 py-2 text-[11px]"
+ className="flex items-center justify-between gap-2 border-t px-3 py-2 text-xs"
>
<span className="min-w-0">
{fix === "sync" ? S.models.vendorRowStalePin : S.models.vendorRowUnroutable}
@@ -2926,7 +2928,7 @@ function ModelDialog({
<FieldLabel required block={false}>
{S.models.modelId}
</FieldLabel>
- <span className="flex shrink-0 items-baseline gap-2.5">
+ <span className="flex shrink-0 items-baseline gap-2">
{/* The model-homepage entry lives in the dialog header (top-right button); only the "get model ids" provider link stays here. */}
{dialogProvider?.modelsUrl && (
<Link
@@ -3119,12 +3121,12 @@ function ModelDialog({
the dialog agree about what a mark looks like. The model homepage entry stays a
small secondary button on the right — a property of the model, not an input. */}
{!isNew && (
- <div className="flex items-center gap-2.5 rounded-md bg-gray-50 px-3 py-2 dark:bg-gray-800/60">
+ <div className="flex items-center gap-3 rounded-md bg-gray-50 px-3 py-2 dark:bg-gray-800/60">
<ProviderLogo
provider={form.provider}
className="h-6 w-6 shrink-0 text-gray-700 dark:text-gray-300"
/>
- <div className="flex min-w-0 flex-1 flex-col gap-0.5">
+ <div className="flex min-w-0 flex-1 flex-col gap-1">
<span className="truncate text-sm font-medium">{modelLabel}</span>
{/* Upstream id in small text: when there's no display name the line above is
already showing it, so don't repeat. Tested on the trimmed value, not on
diff --git a/packages/web/src/features/plugins/plugin-detail-page.tsx b/packages/web/src/features/plugins/plugin-detail-page.tsx
index fc2c9153..d7c31488 100644
--- a/packages/web/src/features/plugins/plugin-detail-page.tsx
+++ b/packages/web/src/features/plugins/plugin-detail-page.tsx
@@ -19,6 +19,9 @@ import {
CopyCheckGlyph,
GlyphIcon,
ICONS,
+ KeyValue,
+ KeyValueRow,
+ PageFrame,
REHYPE_PLUGINS,
REMARK_PLUGINS,
Skeleton,
@@ -74,123 +77,110 @@ export function PluginDetailPage() {
return (
// The list's frame exactly — same column, same reserved gutter — so the content's edges stay
// put when a row is opened and closed again.
- <div className="h-full overflow-y-auto p-4 [scrollbar-gutter:stable] md:p-6">
- <div className="mx-auto max-w-5xl">
- <Link
- to="/plugins"
- className="inline-flex items-center gap-1.5 text-xs text-gray-500 transition-colors duration-150 hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-200"
- >
- <GlyphIcon d={ICONS.chevronLeft} size={14} />
- {S.pluginRegistry.back}
- </Link>
+ <PageFrame className="[scrollbar-gutter:stable]">
+ <Link
+ to="/plugins"
+ className="inline-flex items-center gap-1.5 text-xs text-gray-500 transition-colors duration-150 hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-200"
+ >
+ <GlyphIcon d={ICONS.chevronLeft} size={14} />
+ {S.pluginRegistry.back}
+ </Link>
- {error ? (
- <div className="mt-6 flex items-center gap-3">
- <p className={`text-sm ${toneInk.danger}`}>{error}</p>
- <Button size="sm" onClick={() => window.location.reload()}>
- {S.common.retry}
- </Button>
- </div>
- ) : entry === undefined ? (
- <div className="mt-6">
- <Skeleton className="h-6 w-72" />
- <Skeleton className="mt-3 h-4 w-full" />
- <Skeleton className="mt-6 h-40 w-full" />
- </div>
- ) : entry === null ? (
- <p className="mt-6 text-sm text-gray-400 dark:text-gray-500">
- {S.pluginRegistry.notFound}
- </p>
- ) : (
- <>
- <header className="mt-4 flex items-start gap-3">
- <div className="flex h-11 w-11 shrink-0 items-center justify-center rounded-lg bg-gray-100 text-gray-500 dark:bg-gray-800 dark:text-gray-400">
- <GlyphIcon d={NAV_ICONS.plugins} size={22} />
- </div>
- <div className="min-w-0 flex-1">
- <div className="flex flex-wrap items-baseline gap-2">
- <h1 className="min-w-0 break-all font-mono text-base font-semibold">
- {entry.name}
- </h1>
- <span className="font-mono text-xs text-gray-400">v{entry.version}</span>
- <button
- type="button"
- onClick={() => flash(entry.name)}
- data-tooltip={S.pluginRegistry.copySpecifier}
- className="inline-flex items-center gap-1 rounded border border-gray-200 px-1.5 py-0.5 text-[11px] text-gray-500 transition-colors duration-150 hover:bg-gray-100 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-800"
- >
- <CopyCheckGlyph copied={copied} size={12} />
- {S.pluginRegistry.copySpecifier}
- </button>
- <CopiedStatus copied={copied} />
- </div>
- <p className="mt-1 text-sm text-gray-600 dark:text-gray-300">{entry.description}</p>
+ {error ? (
+ <div className="mt-6 flex items-center gap-3">
+ <p className={`text-sm ${toneInk.danger}`}>{error}</p>
+ <Button size="sm" onClick={() => window.location.reload()}>
+ {S.common.retry}
+ </Button>
+ </div>
+ ) : entry === undefined ? (
+ <div className="mt-6">
+ <Skeleton className="h-6 w-72" />
+ <Skeleton className="mt-3 h-4 w-full" />
+ <Skeleton className="mt-6 h-40 w-full" />
+ </div>
+ ) : entry === null ? (
+ <p className="mt-6 text-sm text-gray-400 dark:text-gray-500">{S.pluginRegistry.notFound}</p>
+ ) : (
+ <>
+ <header className="mt-4 flex items-start gap-3">
+ <div className="flex h-11 w-11 shrink-0 items-center justify-center rounded-lg bg-gray-100 text-gray-500 dark:bg-gray-800 dark:text-gray-400">
+ <GlyphIcon d={NAV_ICONS.plugins} size={22} />
+ </div>
+ <div className="min-w-0 flex-1">
+ <div className="flex flex-wrap items-baseline gap-2">
+ <h1 className="min-w-0 break-all font-mono text-base font-semibold">
+ {entry.name}
+ </h1>
+ <span className="font-mono text-xs text-gray-400">v{entry.version}</span>
+ <button
+ type="button"
+ onClick={() => flash(entry.name)}
+ data-tooltip={S.pluginRegistry.copySpecifier}
+ className="inline-flex items-center gap-1 rounded border border-gray-200 px-1.5 py-0.5 text-xs text-gray-500 transition-colors duration-150 hover:bg-gray-100 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-800"
+ >
+ <CopyCheckGlyph copied={copied} size={12} />
+ {S.pluginRegistry.copySpecifier}
+ </button>
+ <CopiedStatus copied={copied} />
</div>
- </header>
-
- <dl className="mt-4 grid grid-cols-[auto_1fr] gap-x-4 gap-y-1.5 text-xs">
- <Field label={S.pluginRegistry.license}>{entry.license}</Field>
- {entry.authors.length > 0 && (
- <Field label={S.pluginRegistry.authors}>{entry.authors.join(", ")}</Field>
- )}
- {entry.repository && (
- <Field label={S.pluginRegistry.repository}>
- <ExternalLink href={entry.repository} />
- </Field>
- )}
- {entry.homepage && (
- <Field label={S.pluginRegistry.homepage}>
- <ExternalLink href={entry.homepage} />
- </Field>
- )}
- </dl>
+ <p className="mt-1 text-sm text-gray-600 dark:text-gray-300">{entry.description}</p>
+ </div>
+ </header>
- {(entry.keywords ?? []).length > 0 && (
- <div className="mt-3 flex flex-wrap items-center gap-1.5 text-[11px]">
- {(entry.keywords ?? []).map((keyword) => (
- <span
- key={keyword}
- className="rounded-full bg-gray-100 px-2 py-0.5 font-mono text-gray-500 dark:bg-gray-800 dark:text-gray-400"
- >
- {keyword}
- </span>
- ))}
- </div>
+ <KeyValue className="mt-4">
+ <KeyValueRow label={S.pluginRegistry.license}>{entry.license}</KeyValueRow>
+ {entry.authors.length > 0 && (
+ <KeyValueRow label={S.pluginRegistry.authors}>{entry.authors.join(", ")}</KeyValueRow>
+ )}
+ {entry.repository && (
+ <KeyValueRow label={S.pluginRegistry.repository}>
+ <ExternalLink href={entry.repository} />
+ </KeyValueRow>
+ )}
+ {entry.homepage && (
+ <KeyValueRow label={S.pluginRegistry.homepage}>
+ <ExternalLink href={entry.homepage} />
+ </KeyValueRow>
)}
+ </KeyValue>
- <p className="mt-4 rounded-md bg-gray-50 px-3 py-2 text-xs text-gray-500 dark:bg-gray-800/60 dark:text-gray-400">
- {S.pluginRegistry.installHint}
- </p>
+ {(entry.keywords ?? []).length > 0 && (
+ <div className="mt-3 flex flex-wrap items-center gap-1.5 text-xs">
+ {(entry.keywords ?? []).map((keyword) => (
+ <span
+ key={keyword}
+ className="rounded-full bg-gray-100 px-2 py-0.5 font-mono text-gray-500 dark:bg-gray-800 dark:text-gray-400"
+ >
+ {keyword}
+ </span>
+ ))}
+ </div>
+ )}
- <section className="mt-6 border-t border-gray-200 pt-5 dark:border-gray-800">
- <h2 className="text-sm font-semibold">{S.pluginRegistry.readme}</h2>
- {readme === undefined ? (
- <Skeleton className="mt-3 h-40 w-full" />
- ) : readme === null ? (
- <p className="mt-3 text-sm text-gray-400 dark:text-gray-500">
- {S.pluginRegistry.noReadme}
- </p>
- ) : (
- <div className="md-body mt-3 text-sm text-gray-800 dark:text-gray-100">
- <ReactMarkdown remarkPlugins={REMARK_PLUGINS} rehypePlugins={REHYPE_PLUGINS}>
- {readme}
- </ReactMarkdown>
- </div>
- )}
- </section>
- </>
- )}
- </div>
- </div>
- );
-}
+ <p className="mt-4 rounded-md bg-gray-50 px-3 py-2 text-xs text-gray-500 dark:bg-gray-800/60 dark:text-gray-400">
+ {S.pluginRegistry.installHint}
+ </p>
-function Field({ label, children }: { label: string; children: React.ReactNode }) {
- return (
- <>
- <dt className="text-gray-400 dark:text-gray-500">{label}</dt>
- <dd className="min-w-0 break-all text-gray-600 dark:text-gray-300">{children}</dd>
- </>
+ <section className="mt-6 border-t border-gray-200 pt-5 dark:border-gray-800">
+ <h2 className="text-sm font-semibold">{S.pluginRegistry.readme}</h2>
+ {readme === undefined ? (
+ <Skeleton className="mt-3 h-40 w-full" />
+ ) : readme === null ? (
+ <p className="mt-3 text-sm text-gray-400 dark:text-gray-500">
+ {S.pluginRegistry.noReadme}
+ </p>
+ ) : (
+ <div className="md-body mt-3 text-sm text-gray-800 dark:text-gray-100">
+ <ReactMarkdown remarkPlugins={REMARK_PLUGINS} rehypePlugins={REHYPE_PLUGINS}>
+ {readme}
+ </ReactMarkdown>
+ </div>
+ )}
+ </section>
+ </>
+ )}
+ </PageFrame>
);
}
diff --git a/packages/web/src/features/plugins/plugin-detail.tsx b/packages/web/src/features/plugins/plugin-detail.tsx
index 6e1e3de2..3a56e0d1 100644
--- a/packages/web/src/features/plugins/plugin-detail.tsx
+++ b/packages/web/src/features/plugins/plugin-detail.tsx
@@ -218,7 +218,7 @@ export function PluginDetailModal({
<p className="text-sm leading-relaxed text-gray-700 dark:text-gray-300">
{localizedText(locale, plugin.description, plugin.descriptionZh)}
</p>
- <p className="mt-1.5 text-[11px] text-gray-400 dark:text-gray-500">{meta}</p>
+ <p className="mt-1.5 text-xs text-gray-400 dark:text-gray-500">{meta}</p>
{/* The hook points the package answers at: bare point names (`stop`, `user_prompt`) — identifiers, not copy. */}
{plugin.hooks.length > 0 && (
<div className="mt-2 flex flex-wrap gap-1.5">
diff --git a/packages/web/src/features/plugins/plugins-page.tsx b/packages/web/src/features/plugins/plugins-page.tsx
index 03566705..b1541130 100644
--- a/packages/web/src/features/plugins/plugins-page.tsx
+++ b/packages/web/src/features/plugins/plugins-page.tsx
@@ -1,9 +1,8 @@
/**
* Plugin library page: the built-in plugin library (loaded by core from the @penguinharness/* packages), shown sectioned by category.
* A plugin ships skills and/or a hook package (scripts the harness runs at the loop's hook
- * points, e.g. after every Task), and is installed on an Agent as a whole. Groups are
- * borderless — the group header (category name + plugin count, no icon) is collapsible,
- * highlights on hover, and animates height on expand/collapse; expanded by default. Cards
+ * points, e.g. after every Task), and is installed on an Agent as a whole. Each list is a
+ * collapsible section whose head strip folds it (the theme's layout motion moves the fold). Cards
* within a group form a grid, generously sized: two per row from the sm breakpoint up, one per
* row on narrow screens. Each card = a rounded icon tile centered against the two text rows
* (its color comes from skillTileColor — a per-name palette hashed from the plugin name; DTO
@@ -51,18 +50,21 @@ import type {
import {
AgentAvatar,
Button,
- Chevron,
+ CollapsibleSection,
ConfirmModal,
GlyphIcon,
ICONS,
ICON_SIZE,
- InfoPopover,
Modal,
- NoticeStrip,
+ Notice,
+ PageFrame,
+ PageHeader,
SearchInput,
Skeleton,
SkeletonCard,
StatusIcon,
+ Text,
+ TodoNotice,
UpdateDot,
toastError,
toastSuccess,
@@ -81,7 +83,6 @@ import { agentDisplayName, useProject } from "../../state/project";
import { useSessions } from "../../state/sessions";
import { MachinePicker, type MachineChoice } from "../machines/machine-picker";
import { NAV_ICONS } from "../../lib/nav-icons";
-import { TodoNotice } from "../../components/ui/todo-notice";
import { DRAFT_SESSION_ID } from "../chat/chat-page";
import { draftKey, loadDraft, saveDraft } from "../chat/draft-cache";
import { prepareNewChatDraft } from "../chat/new-chat";
@@ -600,18 +601,16 @@ export function PluginsPage() {
// The scrollbar gutter stays reserved: a filter that shortens the page below the viewport
// would otherwise take the scrollbar with it and shift everything sideways at the click.
return (
- <div className="h-full overflow-y-auto p-4 [scrollbar-gutter:stable] md:p-6">
- <div className="mx-auto max-w-5xl">
- <div className="flex items-center justify-between gap-2">
- <h1 className="ui-display flex items-center gap-1.5 text-xl font-semibold">
- {S.plugins.pageTitle}
- <InfoPopover label={S.plugins.pageTitle}>{S.plugins.pageDesc}</InfoPopover>
- </h1>
- {/* The options loaded plugins declare live on the Settings dialog's Plugins page, an
- admin's page; this opens the dialog there rather than sending anyone through the
- user menu to find it. */}
- {isAdmin && (
- <div className="flex shrink-0 items-center gap-2">
+ <PageFrame className="[scrollbar-gutter:stable]">
+ {/* The options loaded plugins declare live on the Settings dialog's Plugins page, an
+ admin's page; the header's gear opens the dialog there rather than sending anyone
+ through the user menu to find it. */}
+ <PageHeader
+ title={S.plugins.pageTitle}
+ info={S.plugins.pageDesc}
+ actions={
+ isAdmin ? (
+ <>
{/* Which machine's plugins the rows show, and which table an install or a
removal edits: the shared one, or that machine's own. */}
{otherMachines.length > 0 && (
@@ -631,14 +630,10 @@ export function PluginsPage() {
>
<GlyphIcon d={ICONS.gear} size={ICON_SIZE.iconButton} />
</Button>
- </div>
- )}
- </div>
- <SettingsDialog
- open={settingsOpen}
- onClose={() => setSettingsOpen(false)}
- section="plugins"
- />
+ </>
+ ) : undefined
+ }
+ >
{/* Last stop on the plugins trail: what the sidebar's dot was pointing at, the control
that takes all of it in one press, and the way to clear it for someone who has looked
and decided to stay on the installed copies. A plugin is never NEW here — one nobody
@@ -655,136 +650,142 @@ export function PluginsPage() {
onDismiss={() => dismissTodo(projectId, "plugins", todo.signature)}
/>
)}
-
{remote !== null && "error" in remote && remote.machineId === viewMachine && (
- <NoticeStrip tone="attention" className="mt-4 rounded-md px-3 py-2 text-xs">
+ <Notice tone="attention" className="mt-4">
{S.plugins.machineUnreadable(nameOf(remote.machineId), remote.error)}
- </NoticeStrip>
+ </Notice>
)}
{deployment !== null && viewIncludesHere && deployment.restartPending && (
- <NoticeStrip tone="attention" className="mt-4 rounded-md px-3 py-2 text-xs">
+ <Notice tone="attention" className="mt-4">
{S.plugins.restartPending}
- </NoticeStrip>
+ </Notice>
)}
+ </PageHeader>
+ <SettingsDialog
+ open={settingsOpen}
+ onClose={() => setSettingsOpen(false)}
+ section="plugins"
+ />
- {error ? (
- <div className="mt-6 flex items-center gap-3">
- <p className={`text-sm ${toneInk.danger}`}>{error}</p>
- <Button size="sm" onClick={() => window.location.reload()}>
- {S.common.retry}
- </Button>
- </div>
- ) : groups === null ? (
- <div className="mt-6 grid grid-cols-1 gap-2.5">
- {Array.from({ length: 4 }, (_, i) => (
- <SkeletonCard key={i} className="p-4">
- <Skeleton className="h-4 w-32" />
- <Skeleton className="mt-2 h-4 w-3/4" />
- <Skeleton className="mt-3 h-6 w-36" />
- </SkeletonCard>
- ))}
- </div>
- ) : (
- <div className="mt-6 md:grid md:grid-cols-[minmax(0,1fr)_12rem] md:gap-4">
- <div className="min-w-0 space-y-3">
- <SearchInput
- size="sm"
- value={query}
- placeholder={S.plugins.searchPlaceholder}
- aria-label={S.plugins.searchPlaceholder}
- onChange={setQuery}
- />
- {/* ONE list, one plugin per row, every kind in the same card: what is installed
+ {/* The header block ends in its own bottom margin, so the content's top margin tops it
+ up to the page's usual gap under the header. */}
+ {error ? (
+ <div className="mt-2 flex items-center gap-3">
+ <p className={`text-sm ${toneInk.danger}`}>{error}</p>
+ <Button size="sm" onClick={() => window.location.reload()}>
+ {S.common.retry}
+ </Button>
+ </div>
+ ) : groups === null ? (
+ <div className="mt-2 grid grid-cols-1 gap-2">
+ {Array.from({ length: 4 }, (_, i) => (
+ <SkeletonCard key={i} className="p-4">
+ <Skeleton className="h-4 w-32" />
+ <Skeleton className="mt-2 h-4 w-3/4" />
+ <Skeleton className="mt-3 h-6 w-36" />
+ </SkeletonCard>
+ ))}
+ </div>
+ ) : (
+ <div className="mt-2 md:grid md:grid-cols-[minmax(0,1fr)_12rem] md:gap-4">
+ <div className="min-w-0 space-y-3">
+ <SearchInput
+ size="sm"
+ value={query}
+ placeholder={S.plugins.searchPlaceholder}
+ aria-label={S.plugins.searchPlaceholder}
+ onChange={setQuery}
+ />
+ {/* ONE list, one plugin per row, every kind in the same card: what is installed
first — the library's plugins (they ship with the build and every Agent may use
them) and the module plugins this Project asks for — then what could be. A
plugin's category is a tag on its row, not a group around it. */}
+ <PluginList
+ title={S.plugins.installedSection(installedRows.length)}
+ open={installedOpen || filtering}
+ onToggle={() => setInstalledOpen((v) => !v)}
+ >
+ {installedRows.map((row) =>
+ row.kind === "library" ? (
+ <PluginCard
+ key={`library:${row.plugin.name}`}
+ plugin={row.plugin}
+ category={row.category}
+ installed={installed}
+ onQuickInvoke={quickInvoke}
+ onToggleInstall={toggleInstall}
+ onUpdateOutdated={updateOutdated}
+ />
+ ) : (
+ <ModuleRow
+ key={`module:${row.specifier}`}
+ specifier={row.specifier}
+ entry={row.entry}
+ state={row.state}
+ error={row.error}
+ shipped={row.shipped}
+ onlyOn={row.onlyOn}
+ removeBlocked={row.removeBlocked}
+ busy={pendingSpecifier === row.specifier}
+ blocked={pendingSpecifier !== null && pendingSpecifier !== row.specifier}
+ onInstall={null}
+ onRemove={
+ isAdmin
+ ? () => setPendingApply({ specifier: row.specifier, install: false })
+ : null
+ }
+ />
+ ),
+ )}
+ </PluginList>
+ {availableRows.length > 0 && (
<PluginList
- title={S.plugins.installedSection(installedRows.length)}
- open={installedOpen || filtering}
- onToggle={() => setInstalledOpen((v) => !v)}
+ title={S.plugins.availableSection(availableRows.length)}
+ open={availableOpen || filtering}
+ onToggle={() => setAvailableOpen((v) => !v)}
>
- {installedRows.map((row) =>
- row.kind === "library" ? (
- <PluginCard
- key={`library:${row.plugin.name}`}
- plugin={row.plugin}
- category={row.category}
- installed={installed}
- onQuickInvoke={quickInvoke}
- onToggleInstall={toggleInstall}
- onUpdateOutdated={updateOutdated}
- />
- ) : (
- <ModuleRow
- key={`module:${row.specifier}`}
- specifier={row.specifier}
- entry={row.entry}
- state={row.state}
- error={row.error}
- shipped={row.shipped}
- onlyOn={row.onlyOn}
- removeBlocked={row.removeBlocked}
- busy={pendingSpecifier === row.specifier}
- blocked={pendingSpecifier !== null && pendingSpecifier !== row.specifier}
- onInstall={null}
- onRemove={
- isAdmin
- ? () => setPendingApply({ specifier: row.specifier, install: false })
- : null
- }
- />
- ),
- )}
+ {availableRows.map((row) => (
+ <ModuleRow
+ key={`module:${row.specifier}`}
+ specifier={row.specifier}
+ entry={row.entry}
+ state={row.state}
+ shipped={row.shipped}
+ busy={pendingSpecifier === row.specifier}
+ blocked={pendingSpecifier !== null && pendingSpecifier !== row.specifier}
+ onInstall={
+ isAdmin
+ ? () => setPendingApply({ specifier: row.specifier, install: true })
+ : null
+ }
+ onRemove={null}
+ />
+ ))}
</PluginList>
- {availableRows.length > 0 && (
- <PluginList
- title={S.plugins.availableSection(availableRows.length)}
- open={availableOpen || filtering}
- onToggle={() => setAvailableOpen((v) => !v)}
- >
- {availableRows.map((row) => (
- <ModuleRow
- key={`module:${row.specifier}`}
- specifier={row.specifier}
- entry={row.entry}
- state={row.state}
- shipped={row.shipped}
- busy={pendingSpecifier === row.specifier}
- blocked={pendingSpecifier !== null && pendingSpecifier !== row.specifier}
- onInstall={
- isAdmin
- ? () => setPendingApply({ specifier: row.specifier, install: true })
- : null
- }
- onRemove={null}
- />
- ))}
- </PluginList>
- )}
- {filtering && installedRows.length === 0 && availableRows.length === 0 && (
- <p className="px-1 text-sm text-gray-400 dark:text-gray-500">{S.plugins.noMatch}</p>
- )}
- </div>
- {/* The filter column: the categories on the page, then two attributes with a
+ )}
+ {filtering && installedRows.length === 0 && availableRows.length === 0 && (
+ <p className="px-1 text-sm text-gray-400 dark:text-gray-500">{S.plugins.noMatch}</p>
+ )}
+ </div>
+ {/* The filter column: the categories on the page, then two attributes with a
handful of values each (what a plugin carries, what it is here). Free-form
keywords are not a facet — they feed the search box. A pick narrows both lists,
and the lists unfold while anything is picked or typed. */}
- <PluginFilters
- facets={facets}
- picked={picked}
- onCategory={(c) => setPickedCategories((prev) => toggle(prev, c))}
- onKind={(k) => setPickedKinds((prev) => toggle(prev, k))}
- onState={(st) => setPickedStates((prev) => toggle(prev, st))}
- onClear={() => {
- setPickedCategories(new Set());
- setPickedKinds(new Set());
- setPickedStates(new Set());
- setQuery("");
- }}
- />
- </div>
- )}
- </div>
+ <PluginFilters
+ facets={facets}
+ picked={picked}
+ onCategory={(c) => setPickedCategories((prev) => toggle(prev, c))}
+ onKind={(k) => setPickedKinds((prev) => toggle(prev, k))}
+ onState={(st) => setPickedStates((prev) => toggle(prev, st))}
+ onClear={() => {
+ setPickedCategories(new Set());
+ setPickedKinds(new Set());
+ setPickedStates(new Set());
+ setQuery("");
+ }}
+ />
+ </div>
+ )}
{/* A module plugin change: what it costs is said before it runs. */}
{pendingApply !== null && (
@@ -833,7 +834,7 @@ export function PluginsPage() {
</div>
</ConfirmModal>
)}
- </div>
+ </PageFrame>
);
}
@@ -986,8 +987,8 @@ export function availablePluginRows(
}
/**
- * A titled list of rows: the header bar the library's groups had — the whole row toggles
- * the fold, as on the model page — with one column of cards under it.
+ * A titled list of rows: a collapsible section whose head strip toggles the fold, as on the
+ * model page, with one column of cards under it.
*/
function PluginList({
title,
@@ -1001,29 +1002,13 @@ function PluginList({
children: React.ReactNode;
}) {
return (
- <section className="overflow-hidden rounded-md bg-white dark:bg-gray-900">
- <button
- type="button"
- aria-expanded={open}
- onClick={onToggle}
- className="flex w-full items-center gap-2.5 bg-gray-50 px-3 py-2.5 text-left transition-colors duration-150 hover:bg-gray-100 dark:bg-gray-900/60 dark:hover:bg-gray-800/60"
- >
- <span className="min-w-0 truncate text-sm font-semibold">{title}</span>
- <span className="min-w-0 flex-1" />
- <Chevron open={open} className="text-gray-400" />
- </button>
+ <CollapsibleSection title={title} open={open} onOpenChange={onToggle}>
<div
- className={`grid transition-[grid-template-rows] duration-200 ease-out ${open ? "grid-rows-[1fr]" : "grid-rows-[0fr]"}`}
+ className={`grid grid-cols-1 gap-2 p-2 transition-opacity duration-200 ${open ? "opacity-100" : "opacity-0"}`}
>
- <div className="overflow-hidden" inert={!open}>
- <div
- className={`grid grid-cols-1 gap-2.5 p-2.5 transition-opacity duration-200 ${open ? "opacity-100" : "opacity-0"}`}
- >
- {children}
- </div>
- </div>
+ {children}
</div>
- </section>
+ </CollapsibleSection>
);
}
@@ -1137,7 +1122,7 @@ function PluginFilters({
type="button"
aria-pressed={on}
onClick={onClick}
- className={`flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-[13px] transition-colors duration-150 ${
+ className={`flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-sm transition-colors duration-150 ${
on
? "bg-gray-200/70 font-medium text-gray-900 dark:bg-gray-700/70 dark:text-gray-100"
: "text-gray-600 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-800/70"
@@ -1153,17 +1138,17 @@ function PluginFilters({
{on && <GlyphIcon d="M20 6 9 17l-5-5" size={10} />}
</span>
<span className="min-w-0 flex-1 truncate">{label}</span>
- <span className="shrink-0 font-mono text-[11px] text-gray-400 dark:text-gray-500">
+ <span className="shrink-0 font-mono text-xs tabular-nums text-gray-400 dark:text-gray-500">
{count}
</span>
</button>
);
const group = (title: string, children: React.ReactNode) => (
<div>
- <div className="mb-1 px-2 text-[11px] font-semibold tracking-wide text-gray-400 uppercase dark:text-gray-500">
+ <Text variant="eyebrow" as="div" className="mb-1 px-2">
{title}
- </div>
- <div className="space-y-0.5">{children}</div>
+ </Text>
+ <div className="space-y-1">{children}</div>
</div>
);
const active = picked.categories.size > 0 || picked.kinds.size > 0 || picked.states.size > 0;
@@ -1176,7 +1161,7 @@ function PluginFilters({
onClick={onClear}
tabIndex={active ? 0 : -1}
aria-hidden={!active}
- className={`px-2 text-[11px] text-gray-400 underline-offset-2 hover:underline dark:text-gray-500 ${active ? "" : "invisible"}`}
+ className={`px-2 text-xs text-gray-400 underline-offset-2 hover:underline dark:text-gray-500 ${active ? "" : "invisible"}`}
>
{S.plugins.filterClear}
</button>
@@ -1320,7 +1305,7 @@ function PluginCard({
/>
<div className="min-w-0 flex-1">
<span
- className="block truncate font-mono text-[13px] font-semibold"
+ className="block truncate font-mono text-[length:var(--ui-text-code-size)] font-semibold"
data-tooltip={plugin.name}
data-tooltip-content="code"
>
@@ -1339,14 +1324,14 @@ function PluginCard({
{/* Metadata line under the header (e.g. `v2026.08.29.1 · updated 3 days ago · used by
2 agents`); what the plugin contains lives in the detail Modal this card opens. */}
<p
- className="mt-2.5 truncate text-[11px] text-gray-400 dark:text-gray-500"
+ className="mt-2.5 truncate text-xs text-gray-400 dark:text-gray-500"
data-tooltip={meta}
data-tooltip-content="text"
>
{meta}
</p>
{/* Tag line: the category, "built in" (the library ships with the build), what it carries. */}
- <div className="mt-2 flex flex-wrap items-center gap-1.5 text-[11px]">
+ <div className="mt-2 flex flex-wrap items-center gap-1.5 text-xs">
<Tag>{category}</Tag>
<Tag title={S.plugins.libraryBuiltinHint}>{S.plugins.builtin}</Tag>
{plugin.skills.length > 0 && <Tag mono>{S.skills.skillCount(plugin.skills.length)}</Tag>}
@@ -1410,7 +1395,7 @@ function PluginCard({
title={S.skills.manageInstallTitle(plugin.name)}
onClose={() => setInstallOpen(false)}
>
- <div className="space-y-0.5">
+ <div className="space-y-1">
{agents.length === 0 && (
<p className="py-1.5 text-xs text-gray-400">{S.common.loading}</p>
)}
@@ -1633,7 +1618,7 @@ function ModuleRow({
<div className="min-w-0 flex-1">
<div className="flex items-baseline gap-2">
<span
- className="min-w-0 truncate font-mono text-[13px] font-semibold"
+ className="min-w-0 truncate font-mono text-[length:var(--ui-text-code-size)] font-semibold"
data-tooltip={`${S.pluginRegistry.specifierHint}: ${specifier}`}
data-tooltip-content="code"
>
@@ -1650,7 +1635,7 @@ function ModuleRow({
</div>
</div>
<p
- className="mt-2.5 truncate text-[11px] text-gray-400 dark:text-gray-500"
+ className="mt-2.5 truncate text-xs text-gray-400 dark:text-gray-500"
data-tooltip={`${meta}${meta === "" ? "" : " · "}${stateText}`}
data-tooltip-content="text"
>
@@ -1671,14 +1656,14 @@ function ModuleRow({
</p>
{state === "failed" && error !== undefined && (
<p
- className={`mt-1 truncate text-[11px] ${toneInk.danger}`}
+ className={`mt-1 truncate text-xs ${toneInk.danger}`}
data-tooltip={error}
data-tooltip-content="text"
>
{error}
</p>
)}
- <div className="mt-2 flex flex-wrap items-center gap-1.5 text-[11px]">
+ <div className="mt-2 flex flex-wrap items-center gap-1.5 text-xs">
{(entry?.categories ?? []).map((category) => (
<Tag key={category}>{category}</Tag>
))}
diff --git a/packages/web/src/features/schedules/schedule-panel.tsx b/packages/web/src/features/schedules/schedule-panel.tsx
index b5687037..df9e9926 100644
--- a/packages/web/src/features/schedules/schedule-panel.tsx
+++ b/packages/web/src/features/schedules/schedule-panel.tsx
@@ -44,7 +44,7 @@ import { apiErrorText } from "../../lib/api-error";
import { toneInk } from "../../lib/tone";
import { useLocale } from "../../state/locale";
import { useProject } from "../../state/project";
-import { CreateButtons } from "../ai-create";
+import { AiCreateButtons } from "../ai-create/ai-create-buttons";
import { describeSchedule } from "./schedule-describe";
import { ScheduleAiModal } from "./schedule-ai-modal";
import { ScheduleFormModal } from "./schedule-form-modal";
@@ -238,7 +238,7 @@ export function SchedulePanel({ session, active, onPrefillComposer }: SchedulePa
</div>
{/* The AI half is open to every member — asking the agent for a task is a message,
not a write — while the form writes files and stays with the owner. */}
- <CreateButtons
+ <AiCreateButtons
size="sm"
onAi={() => openAi("")}
{...(isOwner ? { onManual: () => setForm({ editing: null }) } : {})}
@@ -270,7 +270,7 @@ export function SchedulePanel({ session, active, onPrefillComposer }: SchedulePa
) : visible.length === 0 ? (
<SettingsEmpty>{S.schedule.panelNoMatch}</SettingsEmpty>
) : (
- <ul className="space-y-0.5">
+ <ul className="space-y-1">
{visible.map((item) => {
const line = describeSchedule(item, locale);
return (
diff --git a/packages/web/src/features/schedules/schedule-suggestions.tsx b/packages/web/src/features/schedules/schedule-suggestions.tsx
index 4224bc52..a8a6f7ce 100644
--- a/packages/web/src/features/schedules/schedule-suggestions.tsx
+++ b/packages/web/src/features/schedules/schedule-suggestions.tsx
@@ -84,7 +84,7 @@ export function ScheduleSuggestions({
<div className="mb-1 text-xs font-medium text-gray-500 dark:text-gray-400">
{S.schedule.suggestionsTitle}
</div>
- <ul className="space-y-0.5">
+ <ul className="space-y-1">
{scheduleSuggestions(mode).map((s) => (
<li key={s.key}>
<button
@@ -100,7 +100,7 @@ export function ScheduleSuggestions({
<span className="truncate text-sm text-gray-800 dark:text-gray-100">
{s.name}
</span>
- <span className="shrink-0 text-[11px] text-gray-400 dark:text-gray-500">
+ <span className="shrink-0 text-xs text-gray-400 dark:text-gray-500">
{s.hint}
</span>
</span>
diff --git a/packages/web/src/features/traces/trace-event-row.tsx b/packages/web/src/features/traces/trace-event-row.tsx
index 88f1e736..e762b90e 100644
--- a/packages/web/src/features/traces/trace-event-row.tsx
+++ b/packages/web/src/features/traces/trace-event-row.tsx
@@ -226,8 +226,8 @@ function SessionMetaBody({ p }: { p: Record<string, unknown> }) {
// Pre-split traces embedded `tools` here; per the explicit-incompatibility decision the
// legacy field is not rendered — the toolset view is the tool_list_ready event.
return (
- <div className="space-y-2.5">
- <dl className="grid grid-cols-[auto_minmax(0,1fr)] gap-x-3 gap-y-0.5 text-xs">
+ <div className="space-y-2">
+ <dl className="grid grid-cols-[auto_minmax(0,1fr)] gap-x-3 gap-y-1 text-xs">
{rows.map(([k, v]) => (
<Fragment key={k}>
<dt className="text-gray-400">{k}</dt>
@@ -435,7 +435,7 @@ export function EventRow({
: "hover:bg-gray-50 dark:hover:bg-gray-800/50"
}`}
>
- <span className="shrink-0 font-mono text-[11px] text-gray-400">
+ <span className="shrink-0 font-mono text-xs text-gray-400">
{formatTime(msg.timestamp)}
</span>
<TypeIcon type={payloadType} />
diff --git a/packages/web/src/features/traces/trace-file-view.tsx b/packages/web/src/features/traces/trace-file-view.tsx
index e13fd929..30b1103e 100644
--- a/packages/web/src/features/traces/trace-file-view.tsx
+++ b/packages/web/src/features/traces/trace-file-view.tsx
@@ -32,7 +32,15 @@ import type {
TraceTaskStats,
TraceToolSpan,
} from "@prismshadow/penguin-server/api";
-import { Chevron, GlyphIcon, Skeleton } from "@prismshadow/penguin-ui";
+import {
+ Badge,
+ Card,
+ CardHeader,
+ Chevron,
+ GlyphIcon,
+ Skeleton,
+ StatChip,
+} from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
import { S } from "../../lib/strings";
import { apiErrorText } from "../../lib/api-error";
@@ -125,7 +133,7 @@ function SummaryRow({ label, value, detail }: { label: string; value: string; de
data-tooltip={hasDetail ? `${label}${detail}` : undefined}
className="flex items-baseline justify-between gap-3 py-0.5"
>
- <span className="shrink-0 text-[11px] text-gray-400">{label}</span>
+ <span className="shrink-0 text-xs text-gray-400">{label}</span>
<span className="truncate font-mono text-sm font-semibold tabular-nums">{value}</span>
{hasDetail && <span className="sr-only">{detail}</span>}
</div>
@@ -138,19 +146,13 @@ const inputOf = (b: Buckets): number => b.cacheRead + b.cacheWrite;
/** Cache hit rate of this round's input: the shared formula (lib/format.ts cacheHitRate, also used by the Cost center's bubble); input 0 → null (shown as `—`). */
const hitRateOf = (b: Buckets): number | null => cacheHitRate(b.cacheRead, b.cacheWrite);
-/** Shared style for stat rows (icon + value, tabular figures). */
-const CHIP_CLASS =
- "flex shrink-0 items-center font-mono text-[11px] tabular-nums text-gray-500 dark:text-gray-400";
-
-/** Icon + value; hover shows what this item is (plain text alone doesn't convey the meaning). */
-function StatChip({ icon, value, label }: { icon: string; value: string; label: string }) {
- return (
- <span data-tooltip={label} aria-label={label} className={`${CHIP_CLASS} gap-1`}>
- <GlyphIcon d={icon} className="text-gray-400" />
- {value}
- </span>
- );
-}
+/**
+ * The size, ink and face a round's readings share, and no chip breaking over two lines. The chips
+ * themselves are the package's `StatChip` (a glyph and a value in tabular figures, named by its
+ * tooltip), which take these from the row they sit in; the input chip below is two readings in
+ * one and spells its own.
+ */
+const CHIP_ROW_CLASS = "whitespace-nowrap font-mono text-xs text-gray-500 dark:text-gray-400";
/**
* This round's input chip: `↑ 84k (◎ 60k)` — the parenthesized number is the
@@ -167,16 +169,19 @@ function InputChip({ buckets }: { buckets: Buckets }) {
return (
<span
aria-label={`${S.traces.taskInput} ${humanizeTokens(input)} · ${hitTitle}`}
- className={CHIP_CLASS}
+ className="flex shrink-0 items-center tabular-nums"
>
<span data-tooltip={S.traces.taskInput} className="flex items-center gap-1">
- <GlyphIcon d={STAT_ICONS.input} className="text-gray-400" />
+ <GlyphIcon d={STAT_ICONS.input} />
{humanizeTokens(input)}
</span>
- <span data-tooltip={hitTitle} className="ml-1 flex items-center gap-0.5 text-gray-400">
+ {/* The parentheses hug the reading they enclose; the glyph keeps a chip's gap to its figure. */}
+ <span data-tooltip={hitTitle} className="ml-1 flex items-center text-gray-400">
<span>(</span>
- <GlyphIcon d={STAT_ICONS.cacheHit} />
- <span>{humanizeTokens(buckets.cacheRead)}</span>
+ <span className="flex items-center gap-1">
+ <GlyphIcon d={STAT_ICONS.cacheHit} />
+ {humanizeTokens(buckets.cacheRead)}
+ </span>
<span>)</span>
</span>
</span>
@@ -494,14 +499,14 @@ export function TraceFileView({
{/* Global summary: split into three groups by nature (count / Token
usage / duration·cost·TPS), separated by vertical rules — a dozen
metrics laid out in one row would read as a blur of digits; grouping lets you spot the kind you want at a glance. */}
- <div className="rounded-md border border-gray-200 p-3 dark:border-gray-800">
- <p className="mb-2 text-xs font-semibold text-gray-500">{S.traces.globalSummary}</p>
+ <Card>
+ <CardHeader title={S.traces.globalSummary} />
{/* Three groups side by side as columns, each item within a group
taking its own row (name on the left, value on the right): laid
out in one row it's a blur of digits, while giving each group a
full row only uses a small strip on the left and wastes the rest.
Splitting into columns fills the width and keeps it to three rows tall. */}
- <div className="grid grid-cols-1 gap-x-8 gap-y-4 sm:grid-cols-3">
+ <div className="grid grid-cols-1 gap-x-6 gap-y-4 sm:grid-cols-3">
{/* Counts */}
<div>
{/* Rounds = number of cards below (a compaction round counts as
@@ -549,7 +554,7 @@ export function TraceFileView({
/>
</div>
</div>
- </div>
+ </Card>
{/* Grouped by Task */}
{tasks.map((t) => {
@@ -563,12 +568,10 @@ export function TraceFileView({
const tokens = st?.tokens ?? zeroBuckets();
const compactionBadge = compactionBadgeLabel(st);
return (
- <div
- key={t.taskIndex}
- className="overflow-hidden rounded-md border border-gray-200 dark:border-gray-800"
- >
+ <Card key={t.taskIndex} padding="none">
<button
type="button"
+ data-slot="head"
onClick={() => toggle(t.taskIndex)}
aria-expanded={open}
className="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/60"
@@ -583,15 +586,17 @@ export function TraceFileView({
user, it's housekeeping" — naming which housekeeping, since a discard round
clears the context rather than compacting it. */}
{compactionBadge !== null && (
- <span className="shrink-0 rounded bg-gray-100 px-1.5 py-0.5 text-[10px] font-medium text-gray-500 dark:bg-gray-800 dark:text-gray-400">
- {compactionBadge}
+ <span className="shrink-0">
+ <Badge size="sm">{compactionBadge}</Badge>
</span>
)}
<span className="min-w-0 flex-1" />
{/* This round's stats: iconified in the top-right corner (hover gives a text explanation) */}
- <div className="flex flex-wrap items-center justify-end gap-x-3 gap-y-1">
+ <div
+ className={`flex flex-wrap items-center justify-end gap-x-3 gap-y-1 ${CHIP_ROW_CLASS}`}
+ >
<StatChip
- icon={STAT_ICONS.toolCalls}
+ glyph={STAT_ICONS.toolCalls}
value={String(t.toolCalls)}
label={S.traces.toolCalls}
/>
@@ -600,22 +605,22 @@ export function TraceFileView({
output. Uses the server's this-round throughput tokens (whole file, including compaction), not computed from truncated events. */}
<InputChip buckets={tokens} />
<StatChip
- icon={STAT_ICONS.output}
+ glyph={STAT_ICONS.output}
value={humanizeTokens(tokens.output)}
label={S.traces.taskOutput}
/>
<StatChip
- icon={STAT_ICONS.cost}
+ glyph={STAT_ICONS.cost}
value={formatMoney(st?.cost ?? null, currency)}
label={`${S.common.cost}(${currency})`}
/>
<StatChip
- icon={STAT_ICONS.elapsed}
+ glyph={STAT_ICONS.elapsed}
value={humanizeDuration(t.durationMs)}
label={`${S.chat.statElapsed}${durationSplit(st?.llmMs ?? 0, st?.toolMs ?? 0)}`}
/>
<StatChip
- icon={STAT_ICONS.tps}
+ glyph={STAT_ICONS.tps}
value={formatTps(computeTps(tokens.output, st?.llmMs ?? 0))}
label={S.chat.statTps}
/>
@@ -641,13 +646,11 @@ export function TraceFileView({
</button>
{open && (
- <div className="space-y-3 p-3">
+ <div data-slot="body" className="space-y-3 p-3">
{/* This round's timeline */}
{(t.segments.length > 0 || t.spans.length > 0 || t.otherSpans.length > 0) && (
<div className="rounded-md border border-gray-100 p-2 dark:border-gray-800/60">
- <p className="mb-1.5 text-[11px] font-medium text-gray-500">
- {S.traces.timeline}
- </p>
+ <p className="mb-1.5 text-xs font-medium text-gray-500">{S.traces.timeline}</p>
<TimelineChart
segments={t.segments}
toolSpans={t.spans}
@@ -662,7 +665,7 @@ export function TraceFileView({
{/* This round's messages */}
<div>
- <p className="mb-1.5 text-[11px] font-medium text-gray-500">
+ <p className="mb-1.5 text-xs font-medium text-gray-500">
{S.traces.messages}({t.messages.length})
</p>
{t.messages.length === 0 ? (
@@ -686,7 +689,7 @@ export function TraceFileView({
</div>
</div>
)}
- </div>
+ </Card>
);
})}
diff --git a/packages/web/src/features/usage/errors-panel.tsx b/packages/web/src/features/usage/errors-panel.tsx
index 7e13aae5..360bc4b9 100644
--- a/packages/web/src/features/usage/errors-panel.tsx
+++ b/packages/web/src/features/usage/errors-panel.tsx
@@ -11,7 +11,7 @@
*/
import { useEffect, useState } from "react";
import type { UsageErrorItem, UsageErrors } from "@prismshadow/penguin-server/api";
-import { Badge, ConfirmModal, toastError, toastSuccess } from "@prismshadow/penguin-ui";
+import { Badge, ConfirmModal, Pager, toastError, toastSuccess } from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
import { S } from "../../lib/strings";
import { apiErrorText } from "../../lib/api-error";
@@ -361,21 +361,17 @@ export function ErrorsPanel({
<span className="text-red-600 dark:text-red-400">{pageError}</span>
)}
{(pageCount > 1 || page > 0) && (
- <>
- <span className="ml-auto tabular-nums">
- {S.usage.errorsPageOf(page + 1, pageCount, pagedTotal)}
- </span>
- <PagerButton
- label={S.usage.errorsNewer}
- disabled={page === 0 || loading}
- onClick={() => setPage((p) => Math.max(0, p - 1))}
- />
- <PagerButton
- label={S.usage.errorsOlder}
- disabled={page + 1 >= pageCount || loading}
- onClick={() => setPage((p) => p + 1)}
- />
- </>
+ <Pager
+ variant="labelled"
+ className="ml-auto"
+ page={page}
+ pageCount={pageCount}
+ onChange={setPage}
+ previousLabel={S.usage.errorsNewer}
+ nextLabel={S.usage.errorsOlder}
+ readout={S.usage.errorsPageOf(page + 1, pageCount, pagedTotal)}
+ disabled={loading}
+ />
)}
</div>
)}
@@ -402,25 +398,3 @@ export function ErrorsPanel({
</div>
);
}
-
-/** Pager step button: same recessive treatment as the rest of the panel's chrome. */
-function PagerButton({
- label,
- disabled,
- onClick,
-}: {
- label: string;
- disabled: boolean;
- onClick: () => void;
-}) {
- return (
- <button
- type="button"
- disabled={disabled}
- onClick={onClick}
- className="rounded-md border border-gray-200 px-2 py-0.5 transition-colors duration-150 hover:bg-gray-100 disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:bg-transparent dark:border-gray-800 dark:hover:bg-gray-800/60 dark:disabled:hover:bg-transparent"
- >
- {label}
- </button>
- );
-}
diff --git a/packages/web/src/features/usage/usage-page.tsx b/packages/web/src/features/usage/usage-page.tsx
index 2942360b..af57a8f3 100644
--- a/packages/web/src/features/usage/usage-page.tsx
+++ b/packages/web/src/features/usage/usage-page.tsx
@@ -28,7 +28,7 @@
import { useCallback, useEffect, useMemo, useState } from "react";
import { useSearchParams } from "react-router";
import type { ModelRefDto, UsageBucket, UsageResponse } from "@prismshadow/penguin-server/api";
-import { Input, Select, Skeleton } from "@prismshadow/penguin-ui";
+import { Input, Select, Skeleton, TodoNotice } from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
import { S } from "../../lib/strings";
import { apiErrorText } from "../../lib/api-error";
@@ -36,7 +36,6 @@ import { useDocumentTitle } from "../../lib/use-document-title";
import { useUpdateBadges } from "../../lib/use-update-badges";
import { dismissTodo } from "../../lib/todo-dismissals";
import { refreshProjectTodos } from "../../lib/use-project-todos";
-import { TodoNotice } from "../../components/ui/todo-notice";
import { formatMoney, humanizeTokens } from "../../lib/format";
import { catalogEntryFor } from "@prismshadow/penguin-core/model-catalog";
import { useProject } from "../../state/project";
diff --git a/packages/web/src/lib/strings-en.ts b/packages/web/src/lib/strings-en.ts
index 7d33e6f4..e0ea94a4 100644
--- a/packages/web/src/lib/strings-en.ts
+++ b/packages/web/src/lib/strings-en.ts
@@ -731,7 +731,7 @@ export const en: Strings = {
/** The cost center's wording: nothing is being updated there, the errors are simply read. */
markRead: "Mark as read",
- // —— The page notice's own line and its bulk action (components/ui/todo-notice.tsx) ——
+ // —— The page notice's own line and its bulk action (the UI package's TodoNotice) ——
/** The notice line where the trail can separate genuinely new things from upgradable ones (Models only). */
changesWithAdded: (added: number, updated: number): string =>
@@ -802,6 +802,9 @@ export const en: Strings = {
notifications: "Notifications",
/** Read after a toast's text: pressing the toast dismisses it. */
dismiss: "Dismiss",
+ /** A pager's two steps, as their names and tooltips (the shared UI package's `Pager`). */
+ previousPage: "Previous page",
+ nextPage: "Next page",
name: "Name",
username: "Username",
role: "Role",
diff --git a/packages/web/src/lib/strings.ts b/packages/web/src/lib/strings.ts
index 4acbc2a8..4b0a18b0 100644
--- a/packages/web/src/lib/strings.ts
+++ b/packages/web/src/lib/strings.ts
@@ -785,7 +785,7 @@ export const zh = {
/** The cost center's wording: nothing is being updated there, the errors are simply read. */
markRead: "标记为已读",
- // —— The page notice's own line and its bulk action (components/ui/todo-notice.tsx) ——
+ // —— The page notice's own line and its bulk action (the UI package's TodoNotice) ——
/** The notice line where the trail can separate genuinely new things from upgradable ones (Models only). */
changesWithAdded: (added: number, updated: number): string =>
@@ -855,6 +855,9 @@ export const zh = {
notifications: "通知",
/** Read after a toast's text: pressing the toast dismisses it. */
dismiss: "关闭",
+ /** A pager's two steps, as their names and tooltips (the shared UI package's `Pager`). */
+ previousPage: "上一页",
+ nextPage: "下一页",
name: "名称",
username: "用户名",
role: "角色",
diff --git a/packages/web/src/lib/ui-strings.ts b/packages/web/src/lib/ui-strings.ts
index 4bf105b0..5b4b47aa 100644
--- a/packages/web/src/lib/ui-strings.ts
+++ b/packages/web/src/lib/ui-strings.ts
@@ -25,6 +25,13 @@ export function uiStringsOf(dict: Strings): UiStrings {
notifications: dict.common.notifications,
dismiss: dict.common.dismiss,
copyCode: dict.chat.copyCode,
+ expand: dict.nav.expandGroup,
+ collapse: dict.nav.collapseGroup,
+ more: dict.chat.loadMore,
+ fewer: dict.chat.showLess,
+ previous: dict.common.previousPage,
+ next: dict.common.nextPage,
+ pagePosition: dict.chat.groupPagePosition,
};
}
diff --git a/packages/web/src/pages/login.tsx b/packages/web/src/pages/login.tsx
index e62e48e3..89fa5668 100644
--- a/packages/web/src/pages/login.tsx
+++ b/packages/web/src/pages/login.tsx
@@ -14,6 +14,7 @@ import {
Button,
Input,
Modal,
+ Notice,
PasswordInput,
PenguinLogo,
Segmented,
@@ -148,11 +149,7 @@ export function LoginPage() {
error={errors.password}
autoComplete="current-password"
/>
- {errors.form && (
- <p className="rounded-md border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-700 dark:border-red-900 dark:bg-red-950/50 dark:text-red-300">
- {errors.form}
- </p>
- )}
+ {errors.form && <Notice tone="danger">{errors.form}</Notice>}
<Button
type="submit"
variant="primary"
diff --git a/packages/web/src/state/company.tsx b/packages/web/src/state/company.tsx
index 8c6e1e61..d5e80068 100644
--- a/packages/web/src/state/company.tsx
+++ b/packages/web/src/state/company.tsx
@@ -19,7 +19,7 @@
* entered only by the user: the mode switch, or an `/org` route.
*
* Entering company mode is also where the shell says the mode is a beta: the first switch
- * into it in a browser raises the notice once (features/company/beta-badge.tsx keeps the
+ * into it in a browser raises the notice once (features/company/company-beta.tsx keeps the
* flag), which is why `setWorkMode` is the single handler both mode switches call.
*
* The chosen mode and the organization last opened are user preferences (`workMode`,
@@ -63,7 +63,7 @@ import { toastAttention } from "@prismshadow/penguin-ui";
import * as api from "../api/endpoints";
import { apiErrorText } from "../lib/api-error";
import { S } from "../lib/strings";
-import { markBetaNoticeShown, shouldShowBetaNotice } from "../features/company/beta-badge";
+import { markBetaNoticeShown, shouldShowBetaNotice } from "../features/company/company-beta";
import { channelBadgeCounts } from "../features/company/channel-list";
import { orgKey, parseOrgKey } from "../features/company/company-nav";
import type { WorkMode } from "../features/company/company-nav";
diff --git a/packages/web/test/company-beta.test.ts b/packages/web/test/company-beta.test.ts
index f7e035dd..bebfb127 100644
--- a/packages/web/test/company-beta.test.ts
+++ b/packages/web/test/company-beta.test.ts
@@ -1,5 +1,6 @@
/**
- * Company mode's two beta marks (features/company/beta-badge.tsx).
+ * Company mode's two beta marks (features/company/company-beta.tsx, the tag drawn by the shared
+ * UI package's `BetaBadge`).
*
* The tag, on 「公司」 in the work-mode switch: it has to be legible, it has to reach a screen
* reader through the option's name, and it must not move the switch around — which is the whole
@@ -15,10 +16,10 @@ import { renderToStaticMarkup } from "react-dom/server";
import { Segmented } from "@prismshadow/penguin-ui";
import {
BETA_NOTICE_KEY,
- BetaBadge,
+ CompanyBetaBadge,
markBetaNoticeShown,
shouldShowBetaNotice,
-} from "../src/features/company/beta-badge";
+} from "../src/features/company/company-beta";
import { zh } from "../src/lib/strings";
import { expectEveryRootScanned, expectSingleHome, scanSources } from "./helpers/roots";
@@ -49,7 +50,8 @@ describe("the beta marks' sources", () => {
it("scan every source root, and find the badge and the switch in one place each", () => {
const scan = scanSources();
expectEveryRootScanned(scan);
- expectSingleHome(scan, "packages/web/src/features/company/beta-badge.tsx");
+ expectSingleHome(scan, "packages/web/src/features/company/company-beta.tsx");
+ expectSingleHome(scan, "packages/ui/src/components/feedback/beta-badge/beta-badge.tsx");
expectSingleHome(scan, "packages/ui/src/components/forms/segmented/segmented.tsx");
});
});
@@ -90,7 +92,7 @@ function workModeSwitch(withBadge: boolean): string {
value: "company",
label: zh.company.modeCompany,
...(withBadge
- ? { badge: { node: createElement(BetaBadge), name: zh.company.beta } }
+ ? { badge: { node: createElement(CompanyBetaBadge), name: zh.company.beta } }
: {}),
},
],
diff --git a/packages/web/test/company-work-mode.test.ts b/packages/web/test/company-work-mode.test.ts
index fe6c140b..3b2c77c3 100644
--- a/packages/web/test/company-work-mode.test.ts
+++ b/packages/web/test/company-work-mode.test.ts
@@ -17,7 +17,7 @@ vi.mock("../src/api/endpoints", async (importOriginal) => ({
}));
import * as api from "../src/api/endpoints";
-import { BETA_NOTICE_KEY } from "../src/features/company/beta-badge";
+import { BETA_NOTICE_KEY } from "../src/features/company/company-beta";
import { WORK_MODE_KEY } from "../src/lib/work-mode";
import { companyModeAvailable, createCompanyStore, effectiveWorkMode } from "../src/state/company";
diff --git a/packages/web/test/deslop.test.ts b/packages/web/test/deslop.test.ts
index c052f73f..485bc4ef 100644
--- a/packages/web/test/deslop.test.ts
+++ b/packages/web/test/deslop.test.ts
@@ -15,7 +15,8 @@
* component is de-slopped when it moves, and not after.
*
* Rule 20 (palette classes, `dark:`, hex) is the package's: the web app speaks the palette until
- * each wave moves it to tokens. Rule 22 waits for a `PageHeader` (W4).
+ * each wave moves it to tokens. Rule 22 reads a `PageHeader`, and the one the app renders is the
+ * package's (W4), whose suite runs the rule; here it runs only if the web app declares its own.
*/
import { describe, expect, it } from "vitest";
import {
@@ -56,36 +57,16 @@ const POLICY: DeslopPolicy = {
* `W10` is the follow-up sweep of the code that landed on main while the waves were in flight.
*/
const ALLOWLIST: DeslopAllowlist = {
- "components/account/update-modal.tsx": { 1: [1, "W4"], 3: [1, "W4"], 6: [1, "W4"] },
"components/layout/app-layout.tsx": { 1: [1, "W7"] },
- "components/layout/sidebar.tsx": {
- 1: [3, "W7"],
- 12: [5, "W7"],
- 13: [2, "W7"],
- 14: [2, "W7"],
- },
- "components/ui/group-list.tsx": { 12: [1, "W4"], 13: [3, "W4"], 14: [2, "W4"] },
- "features/agents/agent-settings-page.tsx": { 12: [3, "W4"] },
- "features/agents/hooks-tab.tsx": { 12: [1, "W4"], 13: [2, "W4"] },
- "features/agents/mcp-servers-section.tsx": { 13: [3, "W4"] },
- "features/agents/memory-tab.tsx": { 1: [1, "W4"], 4: [1, "W4"], 12: [8, "W4"], 13: [5, "W4"] },
- "features/agents/prompt-injection-controls.tsx": { 4: [1, "W4"], 12: [2, "W4"] },
- "features/agents/schedules-tab.tsx": { 12: [1, "W4"] },
- "features/agents/skills-tab.tsx": { 12: [1, "W4"], 13: [2, "W4"] },
- "features/ai-create/ai-create-panel.tsx": { 13: [1, "W4"] },
- "features/benchmark/benchmark-case-browser.tsx": { 13: [2, "W4"] },
- "features/benchmark/benchmark-detail.tsx": { 13: [2, "W4"] },
- "features/benchmark/benchmark-page.tsx": { 13: [1, "W4"], 18: [1, "W4"] },
+ "components/layout/sidebar.tsx": { 1: [3, "W7"], 12: [5, "W7"], 13: [2, "W7"], 14: [2, "W7"] },
"features/builtin-browser/browser-tab-strip.tsx": { 12: [2, "W10"] },
"features/chat/agent-topology-view.tsx": { 12: [1, "W6"], 13: [3, "W6"] },
"features/chat/chat-input.tsx": { 7: [1, "W6"], 12: [7, "W6"], 13: [5, "W6"] },
- "features/chat/chat-page.tsx": { 12: [2, "W6"], 13: [3, "W6"], 15: [1, "W4"] },
+ "features/chat/chat-page.tsx": { 12: [2, "W6"], 13: [3, "W6"] },
"features/chat/context-gauge.tsx": { 12: [5, "W8"] },
"features/chat/conversation-outline.tsx": { 12: [1, "W6"] },
- "features/chat/disclosure-row.tsx": { 13: [1, "W4"], 14: [2, "W4"] },
"features/chat/draft-view.tsx": { 12: [1, "W6"], 13: [1, "W6"] },
"features/chat/drop-zone.tsx": { 18: [1, "W7"] },
- "features/chat/live-duration.tsx": { 6: [1, "W4"] },
"features/chat/memory-view.tsx": { 13: [2, "W6"] },
"features/chat/message-item.tsx": { 4: [2, "W6"], 13: [3, "W6"] },
"features/chat/model-picker-modal.tsx": { 12: [1, "W10"] },
@@ -93,7 +74,7 @@ const ALLOWLIST: DeslopAllowlist = {
"features/chat/step-banner.tsx": { 13: [1, "W6"], 14: [2, "W6"] },
"features/chat/subagent-chip.tsx": { 13: [1, "W6"] },
"features/chat/subagents-view.tsx": { 13: [2, "W6"], 14: [2, "W6"] },
- "features/chat/task-stats-line.tsx": { 13: [1, "W6"], 15: [1, "W4"] },
+ "features/chat/task-stats-line.tsx": { 13: [1, "W6"] },
"features/chat/tool-call-card.tsx": { 6: [2, "W6"] },
"features/chat/work-group.tsx": { 13: [1, "W6"] },
"features/chat/workspace-browser.tsx": {
@@ -104,52 +85,21 @@ const ALLOWLIST: DeslopAllowlist = {
},
"features/chat/workspace-finder.tsx": { 12: [6, "W10"] },
"features/chat/workspace-tree-view.tsx": { 13: [1, "W7"] },
- "features/company/beta-badge.tsx": { 13: [1, "W4"] },
- "features/company/calendar-page.tsx": { 12: [3, "W4"], 13: [10, "W4"] },
"features/company/channel-composer.tsx": { 13: [2, "W6"] },
"features/company/channel-header.tsx": { 13: [3, "W6"] },
- "features/company/channel-sidebar.tsx": { 12: [2, "W4"], 13: [6, "W4"], 14: [2, "W4"] },
"features/company/channel-view.tsx": { 12: [1, "W6"], 13: [6, "W6"] },
"features/company/chart-card.tsx": { 12: [1, "W8"], 13: [5, "W8"] },
- "features/company/employee-dialogs.tsx": { 12: [1, "W4"] },
"features/company/finance-gauge.tsx": { 13: [1, "W8"] },
- "features/company/finance-page.tsx": { 12: [3, "W4"], 13: [6, "W4"] },
- "features/company/handbook-explorer.tsx": { 13: [1, "W4"] },
- "features/company/handbook-page.tsx": { 12: [2, "W4"], 13: [3, "W4"] },
- "features/company/org-chart-page.tsx": { 13: [2, "W4"] },
- "features/company/org-dialogs.tsx": { 13: [1, "W4"] },
- "features/company/org-layout.tsx": { 12: [1, "W4"], 13: [2, "W4"], 14: [2, "W4"] },
- "features/company/org-session-groups.tsx": { 12: [2, "W4+W10"], 13: [1, "W10"] },
- "features/company/org-switcher.tsx": { 13: [2, "W4"] },
- "features/company/overview-page.tsx": { 12: [2, "W4"], 13: [2, "W4"], 14: [4, "W4"] },
- "features/company/shared.tsx": { 13: [3, "W4"] },
- "features/company/ticket-dialog.tsx": { 12: [6, "W4"], 13: [3, "W4"], 14: [2, "W4"] },
- "features/company/tickets-page.tsx": { 12: [4, "W4"], 13: [6, "W4"] },
"features/dock/dock-drag.tsx": { 3: [1, "W7"], 12: [1, "W7"] },
"features/dock/dock-launcher.tsx": { 13: [1, "W7"], 18: [3, "W7"], 19: [4, "W7"] },
"features/dock/dock-panel.tsx": { 1: [2, "W7"], 12: [2, "W7"] },
- "features/models/model-tags.ts": { 13: [1, "W10"] },
- "features/models/models-page.tsx": { 1: [1, "W4"], 12: [7, "W4"], 13: [8, "W4"] },
- "features/plugins/plugin-detail-page.tsx": { 13: [2, "W4"] },
- "features/plugins/plugin-detail.tsx": { 13: [1, "W4"] },
- "features/plugins/plugins-page.tsx": {
- 1: [1, "W4"],
- 12: [6, "W4"],
- 13: [11, "W4"],
- 14: [2, "W4"],
- },
- "features/schedules/schedule-panel.tsx": { 12: [1, "W4"] },
- "features/schedules/schedule-suggestions.tsx": { 12: [1, "W4"], 13: [1, "W4"] },
"features/settings/shortcut-recorder.tsx": { 12: [1, "W10"], 13: [1, "W10"] },
"features/settings/shortcuts-section.tsx": { 13: [1, "W10"] },
"features/terminal/terminal-appearance.ts": { 9: [1, "W10"] },
"features/terminal/terminal-keybar.tsx": { 12: [1, "W10"] },
"features/traces/timeline-chart.tsx": { 6: [2, "W8"], 13: [10, "W8"] },
- "features/traces/trace-event-row.tsx": { 12: [2, "W4"], 13: [1, "W4"] },
- "features/traces/trace-file-view.tsx": { 12: [2, "W4"], 13: [5, "W4"], 15: [1, "W4"] },
"features/usage/usage-charts.tsx": { 13: [3, "W8"] },
"features/usage/usage-page.tsx": { 12: [1, "W8"] },
- "pages/login.tsx": { 9: [1, "W4"] },
};
const WAVES = /^W(?:1a?|1b|10|[2-9])(?:\+W(?:1a?|1b|10|[2-9]))*$/;
@@ -187,7 +137,7 @@ describe("de-slop rules over packages/web/src", () => {
analyzeFile(file).components.some((c) => PAGE_HEADER_COMPONENTS.includes(c.name)),
)
) {
- it.skip(`${title} — PENDING: the web app has no PageHeader (W4 adds it to the package)`, () => {});
+ it.skip(`${title} — the PageHeader is the package's, whose suite runs this rule`, () => {});
continue;
}
it(title, () => {
diff --git a/packages/web/test/disclosure-body.test.ts b/packages/web/test/disclosure-body.test.ts
index a0441975..f512e043 100644
--- a/packages/web/test/disclosure-body.test.ts
+++ b/packages/web/test/disclosure-body.test.ts
@@ -1,6 +1,6 @@
/**
* The expanded Markdown body the thinking block and the compaction sections share
- * (features/chat/disclosure-row.tsx). vitest is node-only here (`environment: "node"`, no
+ * (the shared UI package's disclosure-row.tsx). vitest is node-only here (`environment: "node"`, no
* jsdom), so this pins the contract against the source text and the stylesheets — the
* title-reveal.test.ts convention.
*
@@ -16,10 +16,7 @@
* rounded box the transcript uses for a quotation.
*/
import { describe, expect, it } from "vitest";
-import {
- DISCLOSURE_BODY_MD_CLASS,
- DISCLOSURE_OUTPUT_PRE_CLASS,
-} from "../src/features/chat/disclosure-row";
+import { DISCLOSURE_BODY_MD_CLASS, DISCLOSURE_OUTPUT_PRE_CLASS } from "@prismshadow/penguin-ui";
import { expectEveryRootScanned, expectSingleHome, scanSources, sourceFile } from "./helpers/roots";
const SCAN = scanSources();
@@ -61,7 +58,7 @@ const unlayered = SCAN.files
describe("the disclosure body's sources", () => {
it("scan every source root, and find the shared classes in one place", () => {
expectEveryRootScanned(SCAN);
- expectSingleHome(SCAN, "packages/web/src/features/chat/disclosure-row.tsx");
+ expectSingleHome(SCAN, "packages/ui/src/components/layout/disclosure-row/disclosure-row.tsx");
});
});
@@ -86,15 +83,7 @@ describe("the disclosure body's relation to the output block", () => {
it("wears the same divider, inset and ink", () => {
const body = classes(DISCLOSURE_BODY_MD_CLASS);
const output = classes(DISCLOSURE_OUTPUT_PRE_CLASS);
- for (const shared of [
- "border-t",
- "border-gray-100",
- "dark:border-gray-800",
- "px-3",
- "py-2",
- "text-gray-600",
- "dark:text-gray-300",
- ]) {
+ for (const shared of ["border-t", "border-line-muted", "px-3", "py-2", "text-fg-muted"]) {
expect(output).toContain(shared);
expect(body).toContain(shared);
}
diff --git a/packages/web/test/todo-notice.test.ts b/packages/web/test/todo-notice.test.ts
index b7fd955c..7dd3af77 100644
--- a/packages/web/test/todo-notice.test.ts
+++ b/packages/web/test/todo-notice.test.ts
@@ -1,6 +1,6 @@
/**
- * The shared page notice (src/components/ui/todo-notice.tsx) and the decisions behind its
- * bulk-update button (src/lib/bulk-update.ts).
+ * The shared page notice (the UI package's `TodoNotice`, todo-notice.tsx) and the decisions
+ * behind its bulk-update button (src/lib/bulk-update.ts).
*
* Three rules are defended here, and each is a rule rather than a preference because breaking it
* produces a screen the user cannot reason about:
@@ -24,7 +24,7 @@ import { expectEveryRootScanned, expectSingleHome, scanSources } from "./helpers
/** Web and the shared UI package: the notice's call sites are counted wherever they live. */
const SCAN = scanSources();
-const TODO_NOTICE = "packages/web/src/components/ui/todo-notice.tsx";
+const TODO_NOTICE = "packages/ui/src/components/feedback/todo-notice/todo-notice.tsx";
/** Every `<TodoNotice …>` in the scanned roots, as its file's repo-relative id plus its attributes by name. */
function noticeSites(): { file: string; attrs: Map<string, string>; source: string }[] {
diff --git a/scripts/ui-migrate.json b/scripts/ui-migrate.json
index 8f6f9a5c..f3a8a0ce 100644
--- a/scripts/ui-migrate.json
+++ b/scripts/ui-migrate.json
@@ -588,6 +588,108 @@
}
]
},
+ "W4": {
+ "packages/web/src/components/ui/tabs": [
+ {
+ "owner": "W4-A",
+ "target": "@prismshadow/penguin-ui",
+ "dest": "packages/ui/src/components/navigation/tabs/tabs.tsx",
+ "names": ["Tabs", "TabItem"]
+ }
+ ],
+ "packages/web/src/components/ui/group-list": [
+ {
+ "owner": "W4-A",
+ "target": "@prismshadow/penguin-ui",
+ "dest": "packages/ui/src/components/navigation/group-header/group-header.tsx",
+ "names": ["GroupHeader", "FolderSection", "MoreRow"]
+ }
+ ],
+ "packages/web/src/features/ai-create/create-buttons": [
+ {
+ "owner": "W4-A",
+ "target": "@prismshadow/penguin-ui",
+ "dest": "packages/ui/src/components/actions/create-buttons/create-buttons.tsx",
+ "names": ["CreateButtons", "CreateButtonsProps"]
+ }
+ ],
+ "packages/web/src/features/ai-create": [
+ {
+ "owner": "W4-A",
+ "target": "packages/web/src/features/ai-create/ai-create-buttons",
+ "dest": "packages/web/src/features/ai-create/ai-create-buttons.tsx",
+ "names": ["CreateButtons→AiCreateButtons", "CreateButtonsProps→AiCreateButtonsProps"]
+ }
+ ],
+ "packages/web/src/components/ui/todo-notice": [
+ {
+ "owner": "W4-A",
+ "target": "@prismshadow/penguin-ui",
+ "dest": "packages/ui/src/components/feedback/todo-notice/todo-notice.tsx",
+ "names": ["TodoNotice"]
+ }
+ ],
+ "packages/web/src/features/company/beta-badge": [
+ {
+ "owner": "W4-A",
+ "target": "packages/web/src/features/company/company-beta",
+ "dest": "packages/web/src/features/company/company-beta.tsx",
+ "names": [
+ "BetaBadge→CompanyBetaBadge",
+ "BETA_NOTICE_KEY",
+ "BetaNoticeStorage",
+ "shouldShowBetaNotice",
+ "markBetaNoticeShown"
+ ]
+ }
+ ],
+ "packages/web/src/features/chat/disclosure-row": [
+ {
+ "owner": "W4-A",
+ "target": "@prismshadow/penguin-ui",
+ "dest": "packages/ui/src/components/layout/disclosure-row/disclosure-row.tsx",
+ "names": [
+ "DisclosureRow",
+ "ActivityMark",
+ "ActivityProgress",
+ "activityState",
+ "DISCLOSURE_ROW_CLASS",
+ "DISCLOSURE_ROW_STICKY_CLASS",
+ "DISCLOSURE_LABEL_CLASS",
+ "DISCLOSURE_HEADER_ROW_CLASS",
+ "DISCLOSURE_HEADER_STICKY_CLASS",
+ "DISCLOSURE_HEADER_TITLE_CLASS",
+ "DISCLOSURE_OUTPUT_PRE_CLASS",
+ "DISCLOSURE_BODY_MD_CLASS",
+ "DISCLOSURE_CARD_CLASS"
+ ]
+ }
+ ],
+ "packages/web/src/features/chat/live-duration": [
+ {
+ "owner": "W4-A",
+ "target": "@prismshadow/penguin-ui",
+ "dest": "packages/ui/src/components/feedback/duration-slot/duration-slot.tsx",
+ "names": ["LiveDuration", "useElapsedPast"]
+ }
+ ],
+ "packages/web/src/features/company/shared": [
+ {
+ "owner": "W4-A",
+ "target": "@prismshadow/penguin-ui",
+ "dest": "packages/ui/src/components/data/stat-tile/stat-tile.tsx",
+ "names": ["StatTile"]
+ }
+ ],
+ "packages/web/src/features/company/org-layout": [
+ {
+ "owner": "W4-B",
+ "target": "@prismshadow/penguin-ui",
+ "dest": "packages/ui/src/components/layout/ruled-section/ruled-section.tsx",
+ "names": ["OrgSection→RuledSection"]
+ }
+ ]
+ },
"W5": {
"packages/web/src/features/chat/md": [
{