Skip to content

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

refactor(web): settings explanatory text follows the disclosure convention (#392)

Yaowei Zhengd3356022e996
diff --git a/changelog/unreleased/2026-08-21-settings-disclosure.md b/changelog/unreleased/2026-08-21-settings-disclosure.md
new file mode 100644
index 00000000..b17b1aa7
--- /dev/null
+++ b/changelog/unreleased/2026-08-21-settings-disclosure.md
@@ -0,0 +1,38 @@
+# Settings explanations moved behind the circled "?"
+
+- **Date:** 2026-08-21
+- **Type:** refactor
+- **Scope:** `web`
+- **PR:** [#392](https://github.com/Prism-Shadow/penguin-harness/pull/392)
+
+[中文版](2026-08-21-settings-disclosure.zh.md)
+
+The settings surfaces carried their explanations as gray paragraphs and sub-labels that
+every visit had to scroll past. They were moved onto the rule the rest of the Web App
+follows: what a page or a row *means* is disclosed by the circled "?" beside its title,
+and only what shapes a value stays on screen.
+
+## Project settings
+
+- The security-policy page opened with a five-sentence paragraph covering both shell entry
+ points, the fixed denial text the model receives, the matching algorithm and the evasion
+ caveat. It was cut to two sentences behind a "?" on the page heading; the rule editor
+ keeps its visible "Regular expression" placeholder.
+- The dialog's pane heading gained an optional explanation slot, so any of its pages can
+ carry one.
+- On the same page, adding a rule opened its form below every existing rule. The factory
+ set alone makes the list taller than the dialog's scroll box, so the form landed
+ off-screen and the click read as inert. It now opens directly under the Add button that
+ asked for it, with the caret in the first field; the rule it applies stays at the head of
+ the list, where it was typed.
+
+## System settings
+
+- Every preference row — language, currency, CLI sessions, theme, terminal theme, font
+ size, accent, change password — moved its sub-label to a "?" beside the row title.
+- Proxy options moved its page-level paragraph to a "?" on the pane heading, which the
+ paged-dialog shell now draws; the shared page frame lost its explanatory-line slot with
+ it.
+- Upload limits split its single paragraph in two: the accepted MB range moved under each
+ of the two fields, where it is read while typing, and the fixed per-message attachment
+ count and the separate inline-image cap moved to a "?" on the pane heading.
diff --git a/changelog/unreleased/2026-08-21-settings-disclosure.zh.md b/changelog/unreleased/2026-08-21-settings-disclosure.zh.md
new file mode 100644
index 00000000..88dbc102
--- /dev/null
+++ b/changelog/unreleased/2026-08-21-settings-disclosure.zh.md
@@ -0,0 +1,30 @@
+# 设置页的解释文字收进圆圈问号
+
+- **Date:** 2026-08-21
+- **Type:** refactor
+- **Scope:** `web`
+- **PR:** [#392](https://github.com/Prism-Shadow/penguin-harness/pull/392)
+
+[English](2026-08-21-settings-disclosure.md)
+
+设置页此前把解释写成灰色段落与副标签,每次进入都要先滚过一遍。现改为遵循 Web App 其余部分的
+同一条规则:页面或行的**含义**由标题旁的圆圈问号按需展开,只有决定取值形态的文字留在屏幕上。
+
+## Project 设置
+
+- 安全策略页开头是一段五句话的说明,涵盖模型接触 shell 的两条路径、模型收到的固定拒绝文案、
+ 匹配算法以及绕过的边界。该段被压缩为两句并收进页面标题旁的问号;规则编辑器仍保留可见的
+ 「正则表达式」占位符。
+- 该对话框的页面标题新增可选说明位,其余页面也可以挂载说明。
+- 同一页面上,新增规则时表单开在所有已有规则之下。仅出厂规则就已让列表高过对话框的滚动区,
+ 表单因此落在可视范围之外,点击看起来毫无反应。现在表单直接开在「新增规则」按钮下方,光标
+ 落在第一个输入框;应用后的规则也留在列表首位,即它被写下的位置。
+
+## 系统设置
+
+- 每一行偏好设置——语言、币种、CLI 会话、主题、终端主题、字号、主题色、修改密码——的副标签
+ 都移到了行标题旁的问号里。
+- 代理选项的页级段落移到页面标题旁的问号,由分页对话框外壳统一绘制;共享的页面框架随之去掉
+ 了说明行的插槽。
+- 上传限制的整段说明一分为二:可填的 MB 区间移到两个输入框各自下方,供填写时随读;单条消息
+ 的固定附件数量与内嵌图片的独立上限移到页面标题旁的问号。
diff --git a/packages/web/src/components/layout/project-dialogs.tsx b/packages/web/src/components/layout/project-dialogs.tsx
index 23689581..afd9cb92 100644
--- a/packages/web/src/components/layout/project-dialogs.tsx
+++ b/packages/web/src/components/layout/project-dialogs.tsx
@@ -251,11 +251,17 @@ export function ProjectSettingsDialog({ open, onClose }: { open: boolean; onClos
const isOwner = currentProject?.role === "owner";
if (!currentProject || !projectId) return null;
- const tabs: { key: SettingsTab; label: string }[] = [
+ // `info` is the page's semantic explanation, disclosed by a "?" beside the pane heading —
+ // the only title these pages have, since each section renders its rows without repeating it.
+ const tabs: { key: SettingsTab; label: string; info?: string }[] = [
{ key: "general", label: S.project.settingsTabGeneral },
...(!desktopMode ? [{ key: "members" as const, label: S.project.settingsTabMembers }] : []),
{ key: "defaults", label: S.project.settingsTabDefaults },
- { key: "security", label: S.project.settingsTabSecurity },
+ {
+ key: "security",
+ label: S.project.settingsTabSecurity,
+ info: S.project.commandPolicyInfo,
+ },
];
const active = tabs.find((t) => t.key === tab) ?? tabs[0]!;
@@ -284,7 +290,12 @@ export function ProjectSettingsDialog({ open, onClose }: { open: boolean; onClos
))}
</nav>
<section className="min-w-0 flex-1 sm:pl-5">
- <h3 className="text-base font-semibold">{active.label}</h3>
+ <h3 className="flex items-center gap-1.5 text-base font-semibold">
+ {active.label}
+ {active.info !== undefined && (
+ <InfoPopover label={active.label}>{active.info}</InfoPopover>
+ )}
+ </h3>
<div className="mt-2">
{active.key === "general" && (
<GeneralSection projectId={projectId} isOwner={isOwner} onClose={onClose} />
@@ -830,8 +841,9 @@ function sameRule(a: CommandPolicyRuleDto, b: CommandPolicyRuleDto): boolean {
/**
* Buffered rule editor, shared by add and edit: local field state, the pattern validated
* as a compilable regex on apply (the server re-checks — "saved" must equal "enforced").
+ * Exported for test/command-policy-add-rule.test.ts, which renders it on its own.
*/
-function RuleEditor({
+export function RuleEditor({
initial,
onApply,
onCancel,
@@ -872,6 +884,10 @@ function RuleEditor({
placeholder={S.project.commandPolicyRuleName}
value={name}
maxLength={64}
+ // The editor mounts only on an explicit Add / Edit click, so taking focus is what
+ // that click asked for: it puts the caret in the first field for a keyboard user,
+ // and the browser's scroll-on-focus keeps the form in view on a short viewport.
+ autoFocus
onChange={(e) => setName(e.target.value)}
/>
<Input
@@ -976,14 +992,13 @@ function SecurityPolicySection({ projectId, isOwner }: { projectId: string; isOw
return (
<div>
- <p className="text-xs leading-relaxed text-gray-400">{S.project.commandPolicyIntro}</p>
{loadError !== null ? (
- <p className="mt-3 text-xs text-red-600 dark:text-red-400">{loadError}</p>
+ <p className="text-xs text-red-600 dark:text-red-400">{loadError}</p>
) : saved === null ? (
- <p className="mt-3 text-xs text-gray-400">{S.common.loading}</p>
+ <p className="text-xs text-gray-400">{S.common.loading}</p>
) : (
<>
- <div className="mt-1 divide-y divide-gray-100 dark:divide-gray-800/60">
+ <div className="divide-y divide-gray-100 dark:divide-gray-800/60">
<SettingRow
title={S.project.commandPolicyEnable}
description={S.project.commandPolicyEnableDesc}
@@ -1027,6 +1042,23 @@ function SecurityPolicySection({ projectId, isOwner }: { projectId: string; isOw
)}
</div>
<div className="divide-y divide-gray-100 dark:divide-gray-800/60">
+ {/* The add form opens at the TOP of the list, right under the Add button that
+ asked for it: the factory rules alone make the list taller than the dialog's
+ scroll box, so a form appended after them would open below the fold and the
+ click would look like it did nothing. The rule it applies stays where it was
+ typed for the same reason. Deny rules are order-independent — every enabled
+ match refuses, and list order only picks which rule name the refusal
+ reports — so the head of the list is as good a home as the tail. */}
+ {editing === "new" && (
+ <RuleEditor
+ initial={null}
+ onApply={(nr) => {
+ setRules([nr, ...rules]);
+ setEditing(null);
+ }}
+ onCancel={() => setEditing(null)}
+ />
+ )}
{rules.map((r, i) =>
editing === i ? (
<RuleEditor
@@ -1089,16 +1121,6 @@ function SecurityPolicySection({ projectId, isOwner }: { projectId: string; isOw
</div>
),
)}
- {editing === "new" && (
- <RuleEditor
- initial={null}
- onApply={(nr) => {
- setRules([...rules, nr]);
- setEditing(null);
- }}
- onCancel={() => setEditing(null)}
- />
- )}
{rules.length === 0 && editing !== "new" && (
<p className="py-3 text-xs text-gray-400">{S.project.commandPolicyEmpty}</p>
)}
diff --git a/packages/web/src/components/ui/paged-dialog.tsx b/packages/web/src/components/ui/paged-dialog.tsx
index 4346fdc7..12ef030f 100644
--- a/packages/web/src/components/ui/paged-dialog.tsx
+++ b/packages/web/src/components/ui/paged-dialog.tsx
@@ -12,14 +12,23 @@
* along with the second dimension (Tabs' convention).
*/
import type { ReactNode } from "react";
+import { ICON_GAP } from "../../lib/icon-scale";
import { Modal } from "./modal";
import { CloseButton } from "./icons";
+import { InfoPopover } from "./info-popover";
export interface PagedDialogItem<K extends string> {
key: K;
label: string;
/** Small leading glyph in the rail; sized by the caller (16px reads well). */
icon?: ReactNode;
+ /**
+ * The page's semantic explanation, disclosed by a "?" beside the pane heading. It belongs
+ * here rather than at the top of the page body because the heading is the only title a page
+ * has — a "?" inside the body would be a mark modifying nothing, and a paragraph there would
+ * be re-read on every visit.
+ */
+ info?: ReactNode;
}
export interface PagedDialogGroup<K extends string> {
@@ -57,8 +66,8 @@ export function PagedDialog<K extends string>({
children: ReactNode;
}) {
const showGroupHeadings = groups.length > 1;
- const activeLabel =
- groups.flatMap((g) => g.items).find((item) => item.key === active)?.label ?? title;
+ const activeItem = groups.flatMap((g) => g.items).find((item) => item.key === active);
+ const activeLabel = activeItem?.label ?? title;
return (
<Modal open={open} onClose={onClose} title={title} headerless bare widthClass="sm:max-w-3xl">
@@ -97,7 +106,12 @@ export function PagedDialog<K extends string>({
<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">
- <h2 className="text-lg font-semibold">{activeLabel}</h2>
+ <h2 className={`flex min-w-0 items-center ${ICON_GAP.row} text-lg font-semibold`}>
+ {activeLabel}
+ {activeItem?.info !== undefined && (
+ <InfoPopover label={activeLabel}>{activeItem.info}</InfoPopover>
+ )}
+ </h2>
<CloseButton onClose={onClose} />
</div>
<div className="min-h-0 flex-1 overflow-y-auto px-4 pb-4 pt-3 sm:px-6 sm:pb-6">
diff --git a/packages/web/src/features/settings/account-section.tsx b/packages/web/src/features/settings/account-section.tsx
index df5f8cf0..8642b2c6 100644
--- a/packages/web/src/features/settings/account-section.tsx
+++ b/packages/web/src/features/settings/account-section.tsx
@@ -14,7 +14,7 @@ export function AccountSection() {
const [changePasswordOpen, setChangePasswordOpen] = useState(false);
return (
<div className="divide-y divide-gray-100 dark:divide-gray-800/60">
- <PrefRow label={S.account.changePassword} hint={S.settings.changePasswordHint}>
+ <PrefRow label={S.account.changePassword} info={S.settings.changePasswordInfo}>
<Button variant="secondary" onClick={() => setChangePasswordOpen(true)}>
{S.account.changePassword}
</Button>
diff --git a/packages/web/src/features/settings/appearance-section.tsx b/packages/web/src/features/settings/appearance-section.tsx
index bf4ad1ce..fae4c677 100644
--- a/packages/web/src/features/settings/appearance-section.tsx
+++ b/packages/web/src/features/settings/appearance-section.tsx
@@ -42,16 +42,16 @@ export function AppearanceSection() {
return (
<div className="divide-y divide-gray-100 dark:divide-gray-800/60">
- <PrefRow label={S.settings.theme} hint={S.settings.themeHint}>
+ <PrefRow label={S.settings.theme} info={S.settings.themeInfo}>
<Segmented options={themeOptions} value={mode} onChange={setMode} />
</PrefRow>
- <PrefRow label={S.settings.terminalTheme} hint={S.settings.terminalThemeHint}>
+ <PrefRow label={S.settings.terminalTheme} info={S.settings.terminalThemeInfo}>
<Segmented options={terminalThemeOptions} value={terminalMode} onChange={setTerminalMode} />
</PrefRow>
- <PrefRow label={S.settings.fontSize} hint={S.settings.fontSizeHint}>
+ <PrefRow label={S.settings.fontSize} info={S.settings.fontSizeInfo}>
<Segmented options={fontOptions} value={fontScale} onChange={setFontScale} />
</PrefRow>
- <PrefRow label={S.settings.accent} hint={S.settings.accentHint}>
+ <PrefRow label={S.settings.accent} info={S.settings.accentInfo}>
<AccentPicker value={accent} onChange={setAccent} />
</PrefRow>
</div>
diff --git a/packages/web/src/features/settings/general-section.tsx b/packages/web/src/features/settings/general-section.tsx
index 9ba22dcd..86fe428e 100644
--- a/packages/web/src/features/settings/general-section.tsx
+++ b/packages/web/src/features/settings/general-section.tsx
@@ -31,15 +31,15 @@ export function GeneralSection() {
return (
<div className="divide-y divide-gray-100 dark:divide-gray-800/60">
- <PrefRow label={S.settings.language} hint={S.settings.languageHint}>
+ <PrefRow label={S.settings.language} info={S.settings.languageInfo}>
<Segmented options={langOptions} value={lang} onChange={setLang} />
</PrefRow>
- <PrefRow label={S.models.currency} hint={S.settings.currencyHint}>
+ <PrefRow label={S.models.currency} info={S.settings.currencyInfo}>
<Segmented options={currencyOptions} value={currency} onChange={setCurrency} cols={2} />
</PrefRow>
{/* Flipping this refetches the whole conversation list under the new filter, so the
sidebar behind the dialog updates without a reload. */}
- <PrefRow label={S.settings.showCliSessions} hint={S.settings.showCliSessionsHint}>
+ <PrefRow label={S.settings.showCliSessions} info={S.settings.showCliSessionsInfo}>
<Switch checked={showCliSessions} onChange={setShowCliSessions} />
</PrefRow>
</div>
diff --git a/packages/web/src/features/settings/proxy-section.tsx b/packages/web/src/features/settings/proxy-section.tsx
index 7f1e4714..5854a2c3 100644
--- a/packages/web/src/features/settings/proxy-section.tsx
+++ b/packages/web/src/features/settings/proxy-section.tsx
@@ -92,7 +92,6 @@ export function ProxySection() {
const hydrated = settings !== null;
return (
<SectionShell
- description={S.settings.proxyHint}
actions={
<Button variant="primary" disabled={!hydrated || busy} onClick={() => void save()}>
{S.common.save}
diff --git a/packages/web/src/features/settings/section-shell.tsx b/packages/web/src/features/settings/section-shell.tsx
index fb0cd784..7fe73c23 100644
--- a/packages/web/src/features/settings/section-shell.tsx
+++ b/packages/web/src/features/settings/section-shell.tsx
@@ -1,27 +1,16 @@
/**
- * Shared frame for a System settings page that saves explicitly: optional explanatory
- * line, body, and a trailing action row. The dialog pane already draws the page heading,
- * so the shell adds no title and no box of its own. Pages that apply on the spot pass no
- * actions and the row is not drawn, so nothing on screen suggests an unsaved edit is
- * waiting.
+ * Shared frame for a System settings page that saves explicitly: body, and a trailing
+ * action row. The dialog pane already draws the page heading and the "?" that discloses
+ * what the page is, so the shell adds no title, no explanatory line and no box of its own.
+ * Pages that apply on the spot pass no actions and the row is not drawn, so nothing on
+ * screen suggests an unsaved edit is waiting.
*/
import type { ReactNode } from "react";
-export function SectionShell({
- description,
- actions,
- children,
-}: {
- description?: string;
- actions?: ReactNode;
- children: ReactNode;
-}) {
+export function SectionShell({ actions, children }: { actions?: ReactNode; children: ReactNode }) {
return (
<section>
- {description !== undefined && (
- <p className="text-xs text-gray-500 dark:text-gray-400">{description}</p>
- )}
- <div className="mt-4 space-y-4">{children}</div>
+ <div className="space-y-4">{children}</div>
{actions !== undefined && (
<div className="mt-5 flex justify-end gap-2 border-t border-gray-100 pt-4 dark:border-gray-800/60">
{actions}
diff --git a/packages/web/src/features/settings/setting-row.tsx b/packages/web/src/features/settings/setting-row.tsx
index 76550444..8de3c310 100644
--- a/packages/web/src/features/settings/setting-row.tsx
+++ b/packages/web/src/features/settings/setting-row.tsx
@@ -1,28 +1,41 @@
/**
* Row primitives for the System settings dialog's pages: a labelled preference row —
- * title with an optional one-line hint on the left, the control on the right — meant to
- * be stacked inside a `divide-y` container so rows separate with rules rather than boxes.
- * AccentPicker lives here too: the accent swatches moved out of the sidebar user menu
- * together with the rows that used them.
+ * title on the left, the control on the right — meant to be stacked inside a `divide-y`
+ * container so rows separate with rules rather than boxes. AccentPicker lives here too:
+ * the accent swatches moved out of the sidebar user menu together with the rows that used
+ * them.
*/
import type { ReactNode } from "react";
import { S } from "../../lib/strings";
+import { ICON_GAP } from "../../lib/icon-scale";
+import { InfoPopover } from "../../components/ui/info-popover";
import { ACCENT_SWATCHES } from "../../state/theme";
import type { Accent } from "../../state/theme";
export function PrefRow({
label,
hint,
+ info,
children,
}: {
label: string;
+ /**
+ * A line that stays on screen. For what the value must look like, and for a fact about the
+ * current state (the running build's date) — never for what the row means, which goes in
+ * `info` so a reader who already knows is not made to scroll past it again.
+ */
hint?: string;
+ /** Semantic explanation, disclosed by a "?" beside the label. */
+ info?: ReactNode;
children: ReactNode;
}) {
return (
<div className="flex items-center justify-between gap-4 py-3.5 first:pt-0 last:pb-0">
<div className="min-w-0">
- <p className="text-sm font-medium">{label}</p>
+ <p className={`flex items-center ${ICON_GAP.row} text-sm font-medium`}>
+ {label}
+ {info !== undefined && <InfoPopover label={label}>{info}</InfoPopover>}
+ </p>
{hint !== undefined && (
<p className="mt-0.5 text-xs text-gray-500 dark:text-gray-400">{hint}</p>
)}
diff --git a/packages/web/src/features/settings/settings-dialog.tsx b/packages/web/src/features/settings/settings-dialog.tsx
index a4f3aeee..a766c73c 100644
--- a/packages/web/src/features/settings/settings-dialog.tsx
+++ b/packages/web/src/features/settings/settings-dialog.tsx
@@ -46,7 +46,8 @@ const SECTION_ICONS: Record<SettingsSectionKey, string> = {
};
export function SettingsDialog({ open, onClose }: { open: boolean; onClose: () => void }) {
- const { user, desktopMode, sessionVia } = useAuth();
+ // uploadLimits feeds the Upload limits page's "?" (sectionInfo below); the rest pick pages.
+ const { user, desktopMode, sessionVia, uploadLimits } = useAuth();
const sections = visibleSettingsSections({
isAdmin: user?.isAdmin === true,
desktopMode,
@@ -77,6 +78,12 @@ export function SettingsDialog({ open, onClose }: { open: boolean; onClose: () =
personal: S.settings.groupPersonal,
server: S.settings.groupServer,
};
+ // Page-level explanations, disclosed by the "?" the shell draws beside the pane heading.
+ // Pages whose rows explain themselves one by one carry none.
+ const sectionInfo: Partial<Record<SettingsSectionKey, string>> = {
+ proxy: S.settings.proxyInfo,
+ uploads: S.settings.uploadLimitsInfo(uploadLimits.attachmentMaxCount, uploadLimits.imageMaxMb),
+ };
const groups: Array<PagedDialogGroup<SettingsSectionKey>> = settingsGroups(sections).map(
(group) => ({
@@ -88,6 +95,7 @@ export function SettingsDialog({ open, onClose }: { open: boolean; onClose: () =
key: s.key,
label: sectionLabel[s.key],
icon: <Icon d={SECTION_ICONS[s.key]} size={16} />,
+ ...(sectionInfo[s.key] !== undefined ? { info: sectionInfo[s.key] } : {}),
})),
}),
);
diff --git a/packages/web/src/features/settings/uploads-section.tsx b/packages/web/src/features/settings/uploads-section.tsx
index f16a48b9..5876d836 100644
--- a/packages/web/src/features/settings/uploads-section.tsx
+++ b/packages/web/src/features/settings/uploads-section.tsx
@@ -3,11 +3,11 @@
* whole-MB numbers — the per-file attachment cap and the per-message total — written together
* by a single PUT to /api/admin/settings, so a rejected value writes nothing.
*
- * The bounds and the fixed limits quoted in the hint come from the server (`/api/me`
- * uploadLimits) rather than from constants here: the range is a statement about what the
- * server can survive, and a second copy of it in the browser would be a copy that goes stale.
- * A value outside it is refused by the server with `invalid_attachment_limit` and rendered
- * inline under the field, the same way the proxy section handles a bad address.
+ * The bounds quoted under each field, and the fixed limits the page's "?" names, come from the
+ * server (`/api/me` uploadLimits) rather than from constants here: the range is a statement
+ * about what the server can survive, and a second copy of it in the browser would be a copy
+ * that goes stale. A value outside it is refused by the server with `invalid_attachment_limit`
+ * and rendered inline under the field, the same way the proxy section handles a bad address.
*
* Saving takes effect immediately — the attachment validators and the request body cap both
* read the setting per request — so there is nothing to restart and nothing to warn about.
@@ -117,6 +117,10 @@ export function UploadsSection() {
inputMode="numeric"
min={uploadLimits.attachmentLimitMinMb}
max={uploadLimits.attachmentLimitMaxMb}
+ hint={S.settings.attachmentMaxMbHint(
+ uploadLimits.attachmentLimitMinMb,
+ uploadLimits.attachmentLimitMaxMb,
+ )}
value={maxMb}
disabled={!hydrated}
onChange={(e) => {
@@ -131,6 +135,10 @@ export function UploadsSection() {
inputMode="numeric"
min={uploadLimits.attachmentLimitMinMb}
max={uploadLimits.attachmentLimitMaxMb}
+ hint={S.settings.attachmentTotalMbHint(
+ uploadLimits.attachmentLimitMinMb,
+ uploadLimits.attachmentLimitMaxMb,
+ )}
value={totalMb}
disabled={!hydrated}
{...(limitError !== null ? { error: limitError } : {})}
@@ -139,14 +147,6 @@ export function UploadsSection() {
if (limitError !== null) setLimitError(null);
}}
/>
- <p className="text-xs text-gray-500 dark:text-gray-400">
- {S.settings.uploadLimitsHint(
- uploadLimits.attachmentLimitMinMb,
- uploadLimits.attachmentLimitMaxMb,
- uploadLimits.attachmentMaxCount,
- uploadLimits.imageMaxMb,
- )}
- </p>
</SectionShell>
);
}
diff --git a/packages/web/src/lib/strings-en.ts b/packages/web/src/lib/strings-en.ts
index f59ad268..a90470ed 100644
--- a/packages/web/src/lib/strings-en.ts
+++ b/packages/web/src/lib/strings-en.ts
@@ -59,7 +59,7 @@ export const en: Strings = {
settings: {
language: "Language",
- languageHint: "Interface language; can follow the browser",
+ languageInfo: "Interface language; can follow the browser.",
/** Sidebar user-menu row opening the System settings dialog. */
systemSettings: "System settings",
/** Rail headings: the viewer's own preferences vs. the whole server's. */
@@ -71,11 +71,11 @@ export const en: Strings = {
accountTitle: "Account",
/** Sidebar Session list: also show CLI-created Sessions (default off — the list then never scans the Trace directories). */
showCliSessions: "Show CLI sessions",
- showCliSessionsHint:
+ showCliSessionsInfo:
"Off, the conversation list holds only Sessions created in the Web App and is served straight from the database. On, the Trace directories are scanned too and CLI-created Sessions are listed alongside them. Applies to this account only.",
- /** Admin-only sub-page (server-global). */
+ /** Admin-only sub-page (server-global); its explanation is disclosed at the pane heading. */
proxyTitle: "Proxy options",
- proxyHint:
+ proxyInfo:
"Server-global, and in force the moment it is saved — nothing to restart. Loopback addresses always go direct.",
/** The two switches: the server's own outbound traffic / agent command subprocess environments. */
proxyForApp: "Application uses the proxy",
@@ -88,31 +88,35 @@ export const en: Strings = {
/** Its two number fields, both in whole MB. */
attachmentMaxMb: "Max attachment size (MB)",
attachmentTotalMb: "Max total per message (MB)",
- /** Explains what the numbers govern and what stays fixed, so the form needs no separate docs trip. */
- uploadLimitsHint: (min: number, max: number, count: number, imageMb: number): string =>
- `${min}–${max} MB; the total may not be below the per-file limit. A message may carry at ` +
- `most ${count} attachments. Images placed inline in the conversation keep a separate ` +
- `${imageMb}MB limit that this setting does not raise — an inline image enters the ` +
- `conversation and the Trace, where its size is paid again on every history page and resume.`,
+ /** Accepted range for each field: read while typing, so it stays under the field. */
+ attachmentMaxMbHint: (min: number, max: number): string => `${min}–${max} MB`,
+ attachmentTotalMbHint: (min: number, max: number): string =>
+ `${min}–${max} MB, and not below the per-file limit`,
+ /** What these two numbers do NOT govern — disclosed at the pane heading. */
+ uploadLimitsInfo: (count: number, imageMb: number): string =>
+ `A message may carry at most ${count} attachments. Images placed inline in the ` +
+ `conversation keep a separate ${imageMb}MB limit that this setting does not raise — an ` +
+ `inline image enters the conversation and the Trace, where its size is paid again on ` +
+ `every history page and resume.`,
theme: "Theme",
- themeHint: "Light or dark look of the app",
+ themeInfo: "Light or dark look of the app.",
themeLight: "Light",
themeDark: "Dark",
followSystem: "System",
terminalTheme: "Terminal theme",
- terminalThemeHint: "Colors of the terminal panel; follows the app theme by default",
+ terminalThemeInfo: "Colors of the terminal panel; follows the app theme by default.",
followAppTheme: "App",
langZh: "中文",
langEn: "English",
fontSize: "Font size",
- fontSizeHint: "Overall interface font size",
+ fontSizeInfo: "Overall interface font size.",
fontSmall: "S",
fontMedium: "M",
fontLarge: "L",
accent: "Accent",
- accentHint: "Interface accent color",
- currencyHint: "Display currency for prices; storage is always USD",
- changePasswordHint: "Change this account's sign-in password",
+ accentInfo: "Interface accent color.",
+ currencyInfo: "Display currency for prices; storage is always USD.",
+ changePasswordInfo: "Change this account's sign-in password.",
accentNames: {
neutral: "Neutral",
blue: "Blue",
@@ -315,9 +319,9 @@ export const en: Strings = {
settingsTabSecurity: "Security policy",
projectIdLabel: "Project ID",
deleteProjectDesc: "The project directory is removed recursively and cannot be recovered.",
- /** Security-policy page (Project settings): deny rules enforced ahead of the approval mode. */
- commandPolicyIntro:
- 'Both ways the model reaches a shell pass through the policy before approval — the command exec_command launches, and what input_command types into an already-running one. A hit on any enabled rule is rejected outright, even when the approval mode is allow-all; the model receives the fixed denial "Tool call denied by policy." and moves to another approach. Matching runs each rule\'s regular expression against the command text, normalized for whitespace and quoting. This is an accident guardrail, not a defense against deliberate evasion: a command assembled at run time (from a variable, eval, or a decoded string) is not something patterns can read, and is not covered.',
+ /** Security-policy page (Project settings): disclosed by the "?" beside the tab heading. */
+ commandPolicyInfo:
+ "The command text is normalized for whitespace and quoting, then matched against each enabled rule's regular expression; a hit is refused outright whatever the approval mode allows. It is an accident guardrail: a command assembled at run time is not covered.",
commandPolicyEnable: "Enable policy",
commandPolicyEnableDesc: "When off, no rule blocks anything.",
commandPolicyRules: "Rules",
diff --git a/packages/web/src/lib/strings.ts b/packages/web/src/lib/strings.ts
index 8a25df63..d75321d9 100644
--- a/packages/web/src/lib/strings.ts
+++ b/packages/web/src/lib/strings.ts
@@ -61,7 +61,7 @@ export const zh = {
settings: {
language: "语言",
- languageHint: "界面语言,可跟随浏览器设置",
+ languageInfo: "界面语言,可跟随浏览器设置。",
/** Sidebar user-menu row opening the System settings dialog. */
systemSettings: "系统设置",
/** Rail headings: the viewer's own preferences vs. the whole server's. */
@@ -73,11 +73,11 @@ export const zh = {
accountTitle: "账户",
/** Sidebar Session list: also show CLI-created Sessions (default off — the list then never scans the Trace directories). */
showCliSessions: "显示 CLI 会话",
- showCliSessionsHint:
+ showCliSessionsInfo:
"关闭时会话列表只列出在 Web 端创建的会话,直接由数据库返回;开启后会额外扫描轨迹目录,把 CLI 创建的会话一并列出。仅影响当前账号。",
- /** Admin-only sub-page (server-global). */
+ /** Admin-only sub-page (server-global); its explanation is disclosed at the pane heading. */
proxyTitle: "代理选项",
- proxyHint: "服务器全局设置,保存后立即生效,无需重启。回环地址始终直连。",
+ proxyInfo: "服务器全局设置,保存后立即生效,无需重启。回环地址始终直连。",
/** The two switches: the server's own outbound traffic / agent command subprocess environments. */
proxyForApp: "应用程序使用代理",
proxyForAgent: "Agent 环境使用代理",
@@ -89,29 +89,33 @@ export const zh = {
/** Its two number fields, both in whole MB. */
attachmentMaxMb: "单个附件上限(MB)",
attachmentTotalMb: "单条消息附件合计上限(MB)",
- /** Explains what the numbers govern and what stays fixed, so the form needs no separate docs trip. */
- uploadLimitsHint: (min: number, max: number, count: number, imageMb: number): string =>
- `取值 ${min}–${max} MB,合计不得低于单个上限。一条消息最多 ${count} 个附件;` +
- `对话内嵌图片另有 ${imageMb}MB 上限,不随此设置变化——图片会进入对话与轨迹,每次翻阅历史与恢复会话都要重新付出它的体积。`,
+ /** Accepted range for each field: read while typing, so it stays under the field. */
+ attachmentMaxMbHint: (min: number, max: number): string => `取值 ${min}–${max} MB`,
+ attachmentTotalMbHint: (min: number, max: number): string =>
+ `取值 ${min}–${max} MB,且不得低于单个附件上限`,
+ /** What these two numbers do NOT govern — disclosed at the pane heading. */
+ uploadLimitsInfo: (count: number, imageMb: number): string =>
+ `一条消息最多 ${count} 个附件;对话内嵌图片另有 ${imageMb}MB 上限,不随此设置变化——` +
+ `图片会进入对话与轨迹,每次翻阅历史与恢复会话都要重新付出它的体积。`,
theme: "主题",
- themeHint: "应用的明暗外观",
+ themeInfo: "应用的明暗外观。",
themeLight: "浅色",
themeDark: "深色",
followSystem: "跟随系统",
terminalTheme: "终端主题",
- terminalThemeHint: "终端面板的配色,默认跟随应用主题",
+ terminalThemeInfo: "终端面板的配色,默认跟随应用主题。",
followAppTheme: "跟随主题",
langZh: "中文",
langEn: "English",
fontSize: "字号",
- fontSizeHint: "界面整体字号",
+ fontSizeInfo: "界面整体字号。",
fontSmall: "小",
fontMedium: "中",
fontLarge: "大",
accent: "主题色",
- accentHint: "界面强调色",
- currencyHint: "价格显示币种;存储始终为美元",
- changePasswordHint: "更改当前账号的登录密码",
+ accentInfo: "界面强调色。",
+ currencyInfo: "价格显示币种;存储始终为美元。",
+ changePasswordInfo: "更改当前账号的登录密码。",
accentNames: {
neutral: "灰白",
blue: "蓝",
@@ -301,9 +305,9 @@ export const zh = {
settingsTabSecurity: "安全策略",
projectIdLabel: "Project ID",
deleteProjectDesc: "项目目录将被递归删除,不可恢复。",
- /** Security-policy page (Project settings): deny rules enforced ahead of the approval mode. */
- commandPolicyIntro:
- '模型碰到 shell 的两条路都会先经过安全策略——exec_command 启动的命令,以及 input_command 敲进已运行命令的内容。命中任一启用的规则即被直接拒绝,即使审批模式为全部放行;模型会收到固定的拒绝文案 "Tool call denied by policy." 并改用其他方式。匹配方式为对命令文本做空白与引号归一化后执行各规则的正则表达式。这是防事故的护栏,不能对抗刻意绕过:运行期才拼出来的命令(来自变量、eval 或解码出的字符串)不是模式能读懂的东西,也不在覆盖范围内。',
+ /** Security-policy page (Project settings): disclosed by the "?" beside the tab heading. */
+ commandPolicyInfo:
+ "命令文本经空白与引号归一化后逐条匹配已启用规则的正则表达式,命中即拒绝执行,不受审批模式影响。这是防事故的护栏:运行期才拼出的命令不在覆盖范围内。",
commandPolicyEnable: "启用策略",
commandPolicyEnableDesc: "关闭后所有规则都不再拦截。",
commandPolicyRules: "规则",
diff --git a/packages/web/test/command-policy-add-rule.test.ts b/packages/web/test/command-policy-add-rule.test.ts
new file mode 100644
index 00000000..d967816c
--- /dev/null
+++ b/packages/web/test/command-policy-add-rule.test.ts
@@ -0,0 +1,69 @@
+/**
+ * Adding a rule on the Project settings security page.
+ *
+ * The Add button lives in the rule list's header row, above the rules. The form it opens used
+ * to render after every rule — and with the factory set seeded the list is already taller than
+ * the dialog's 70vh scroll box, so the form opened below the fold and the click looked inert.
+ *
+ * Where a form opens relative to the control that opens it is a fact about JSX child order, so
+ * it is checked with the TypeScript parser the way test/disclosure-anchor.test.ts checks
+ * disclosure anchoring — a regex cannot see siblings. The focus half is checked by rendering.
+ */
+import { describe, expect, it } from "vitest";
+import { createElement } from "react";
+import { renderToStaticMarkup } from "react-dom/server";
+import { readFileSync } from "node:fs";
+import { fileURLToPath } from "node:url";
+import ts from "typescript";
+import { RuleEditor } from "../src/components/layout/project-dialogs";
+
+const SOURCE = fileURLToPath(
+ new URL("../src/components/layout/project-dialogs.tsx", import.meta.url),
+);
+
+/**
+ * Child slots of the rule list: the `editing === "new"` add form and the `rules.map(…)` rows.
+ * Only the list container holds them as two DIFFERENT children — in every ancestor both markers
+ * fall inside one and the same child — which is what identifies it without naming it.
+ */
+function listSlots(): { addForm: number; rows: number } | null {
+ const source = ts.createSourceFile(
+ SOURCE,
+ readFileSync(SOURCE, "utf8"),
+ ts.ScriptTarget.Latest,
+ /* setParentNodes */ true,
+ ts.ScriptKind.TSX,
+ );
+ const found: { addForm: number; rows: number }[] = [];
+ const visit = (node: ts.Node): void => {
+ if (ts.isJsxElement(node)) {
+ const holds = (needle: string) => (c: ts.Node) => c.getText(source).includes(needle);
+ const addForm = node.children.findIndex(holds('editing === "new"'));
+ const rows = node.children.findIndex(holds("rules.map("));
+ if (addForm !== -1 && rows !== -1 && addForm !== rows) found.push({ addForm, rows });
+ }
+ ts.forEachChild(node, visit);
+ };
+ visit(source);
+ return found.at(-1) ?? null;
+}
+
+describe("command policy: adding a rule", () => {
+ it("opens the add form above the rules, beside the Add button that opened it", () => {
+ const slots = listSlots();
+ if (slots === null) throw new Error("add form and rule rows are no longer siblings in a list");
+ expect(
+ slots.addForm,
+ "the add form renders before the rules — appended after them it opens off-screen",
+ ).toBeLessThan(slots.rows);
+ });
+
+ it("puts the caret in the first field, so the form is not silently opened", () => {
+ const html = renderToStaticMarkup(
+ createElement(RuleEditor, { initial: null, onApply: () => {}, onCancel: () => {} }),
+ );
+ // Exactly one field takes focus on mount, and it is the first one — the rule's name.
+ expect(html.match(/autofocus/g) ?? []).toHaveLength(1);
+ expect(/<input\b[^>]*>/.exec(html)?.[0] ?? "").toContain("autofocus");
+ });
+});
diff --git a/packages/web/test/info-popover.test.ts b/packages/web/test/info-popover.test.ts
index bdd9e206..d641af40 100644
--- a/packages/web/test/info-popover.test.ts
+++ b/packages/web/test/info-popover.test.ts
@@ -12,6 +12,8 @@ import { renderToStaticMarkup } from "react-dom/server";
import { InfoPopover } from "../src/components/ui/info-popover";
import { Field } from "../src/components/ui/field";
import { Input } from "../src/components/ui/input";
+import { Switch } from "../src/components/ui/switch";
+import { PrefRow } from "../src/features/settings/setting-row";
import { S } from "../src/lib/strings";
describe("InfoPopover", () => {
@@ -83,3 +85,27 @@ describe("Field with an info popover", () => {
expect(plain).not.toContain("<label for=");
});
});
+
+describe("PrefRow with an info popover", () => {
+ // A System settings row titles a control it does not own, so its title is a <p> and the "?"
+ // is safe beside it. An edit that made that title a <label> for the sake of click-to-toggle
+ // would hand the row to the trigger instead — the same trap Field carries two layouts to
+ // avoid, on the one row primitive that has no Field between it and the control.
+ const row = renderToStaticMarkup(
+ createElement(PrefRow, {
+ label: "Theme",
+ info: "Light or dark look of the app.",
+ children: createElement(Switch, { checked: true, onChange: () => {} }),
+ }),
+ );
+
+ it('keeps the row out of a label, so the "?" cannot toggle its control', () => {
+ expect(row).not.toContain("<label");
+ expect(row).toContain('role="switch"');
+ });
+
+ it("anchors the trigger to the row title", () => {
+ expect(row).toContain(`aria-label="${S.common.moreInfoAbout("Theme")}"`);
+ expect(row).not.toContain("Light or dark look of the app.");
+ });
+});