Skip to content

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

fix(web): card-style agent overview with copyable state path (#261)

Yaowei Zheng099c5c69f196
diff --git a/packages/web/src/features/agents/agent-settings-page.tsx b/packages/web/src/features/agents/agent-settings-page.tsx
index 31845c6b..16e84624 100644
--- a/packages/web/src/features/agents/agent-settings-page.tsx
+++ b/packages/web/src/features/agents/agent-settings-page.tsx
@@ -1,8 +1,9 @@
/**
* Agent settings page: eight tabs —
- * Overview (name/description/State path/active count/State version + a kernel card grouping
- * the defaults generation with its update / restore-defaults actions + snapshot
- * export-import), Prompt (AGENTS.md and system_prompt editors + placeholder
+ * Overview (name/description form + two ruled sections in the skills import modal's
+ * family: Agent State — State version, snapshot export-import and the copyable State
+ * path — and Kernel — the defaults generation with its update / restore-defaults
+ * actions), Prompt (AGENTS.md and system_prompt editors + placeholder
* reference), Memory (memory-tab.tsx), Runtime (max_turns, model.*, compaction.*), Tools (editable built-in
* tools table + the MCP Server form, mcp-servers-section.tsx), Skills (skills-tab.tsx),
* Vault (vault-tab.tsx), Schedule (schedules-tab.tsx).
@@ -34,6 +35,7 @@ import { Input, Textarea } from "../../components/ui/input";
import { OptionMenu, type OptionMenuChoice } from "../../components/ui/option-menu";
import { Switch } from "../../components/ui/switch";
import { ConfirmModal, useSaveConfirm } from "../../components/ui/confirm-modal";
+import { CopyButton } from "../../components/ui/copy-button";
import { Skeleton } from "../../components/ui/skeleton";
import { GlyphIcon } from "../../components/ui/glyph-icon";
import { SkillsTab } from "./skills-tab";
@@ -426,54 +428,85 @@ function OverviewTab({
value={description}
onChange={(e) => setDescription(e.target.value)}
/>
- <div>
- <p className="mb-1 text-xs font-medium text-gray-500">{S.agent.stateDir}</p>
- <p className="break-all font-mono text-xs text-gray-500 dark:text-gray-400">
- {data.stateDir}
- </p>
- </div>
- <div>
- <p className="mb-1 text-xs font-medium text-gray-500">{S.agent.activeSessions}</p>
- <p className="text-sm">{data.activeSessionCount}</p>
- </div>
- <div>
- <p className="mb-1 text-xs font-medium text-gray-500">{S.agent.stateVersion}</p>
- <p className="font-mono text-sm">v{data.config.version}</p>
- </div>
- {/* Kernel card (the injection-toggle cards' visual family): the defaults generation the
- config is based on, with its two maintenance actions grouped beside it — update
- (smart merge, enabled only when outdated) and restore defaults (destructive, danger
- tone). Both keep their confirm-first modals below. */}
- <section className="rounded-lg border border-gray-200 px-4 py-3 dark:border-gray-800">
+ <Button size="sm" variant="primary" onClick={submit}>
+ {S.common.save}
+ </Button>
+ {saveConfirm}
+
+ {/* Agent State section (ruled, the skills import modal's section family — no card
+ boxes; per user feedback the sections separate with a top rule and the values
+ carry the visual weight): title row with the snapshot transfer actions on the
+ right (export is available to any member; import overwrites the entire Agent
+ State, so it is visible only to owners), labeled value rows below — light
+ text-xs labels over dark font-semibold values. */}
+ <section className="border-t border-gray-200 pt-4 dark:border-gray-800">
<div className="flex flex-wrap items-center justify-between gap-x-4 gap-y-2">
- <div className="min-w-0">
- <p className="text-sm font-medium">{S.agent.kernelTitle}</p>
- <p className="mt-0.5 flex items-center gap-1.5 text-xs text-gray-500 dark:text-gray-400">
- {data.config.kernelOutdated ? (
- <>
- <span>
- {S.agent.kernelVersions(
- data.config.kernelVersion ?? S.agent.kernelLegacy,
- data.config.kernelLatest,
- )}
- </span>
- {/* Minimal outdated hint: icon + tooltip only (no textual alarm). */}
- <span
- role="img"
- title={S.agent.kernelOutdatedHint}
- aria-label={S.agent.kernelOutdatedHint}
- >
- <GlyphIcon d={KERNEL_UPDATE_ICON} size={12} />
- </span>
- </>
- ) : (
- <>
- <span className="font-mono">{data.config.kernelVersion}</span>
- <span>· {S.agent.kernelUpToDate}</span>
- </>
- )}
+ <p className="text-sm font-medium">{S.agent.stateTitle}</p>
+ <div className="flex shrink-0 items-center gap-2">
+ {projectId && (
+ <a
+ href={api.agentExportUrl(projectId, agentId)}
+ download
+ className={TRANSFER_BUTTON_CLASS}
+ >
+ {S.agent.exportSnapshot}
+ </a>
+ )}
+ {isOwner && (
+ <label
+ className={`${TRANSFER_BUTTON_CLASS} ${importing ? "pointer-events-none opacity-60" : ""}`}
+ >
+ <HiddenFileInput accept=".tar.gz,.tgz" disabled={importing} onChange={onPickFile} />
+ {importing ? S.agent.importing : S.agent.importSnapshot}
+ </label>
+ )}
+ </div>
+ </div>
+ <p className="mt-1 text-xs text-gray-500 dark:text-gray-400">{S.agent.transferDesc}</p>
+ <div className="mt-3 space-y-2.5">
+ <div>
+ <p className="text-xs font-medium text-gray-500 dark:text-gray-400">
+ {S.agent.stateVersion}
</p>
+ <p className="mt-0.5 font-mono text-sm font-semibold">v{data.config.version}</p>
</div>
+ {/* State path row (the chat details card's Session id convention): selectable mono
+ text with the shared CopyButton beside it; the title attribute carries the full
+ path for hover. */}
+ <div>
+ <p className="text-xs font-medium text-gray-500 dark:text-gray-400">
+ {S.agent.stateDir}
+ </p>
+ <div className="flex items-start gap-1.5">
+ <span
+ title={data.stateDir}
+ className="min-w-0 flex-1 break-all font-mono text-xs leading-5"
+ >
+ {data.stateDir}
+ </span>
+ <CopyButton
+ text={data.stateDir}
+ label={S.agent.copyStateDir}
+ showCopiedText
+ className="flex shrink-0 items-center gap-1 rounded p-0.5 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"
+ />
+ </div>
+ </div>
+ </div>
+ {importError && (
+ <p className="mt-1.5 text-xs text-red-600 dark:text-red-400">{importError}</p>
+ )}
+ </section>
+
+ {/* Kernel section (same ruled family as Agent State — no lone card): the defaults
+ generation the config is based on, with its two maintenance actions in the title
+ row — update (smart merge, enabled only when outdated) and restore defaults
+ (destructive, danger tone). Both keep their confirm-first modals below. The value
+ line renders the generation dates dark and semibold with the connector words kept
+ light, mirroring the State rows' label/value contrast. */}
+ <section className="border-t border-gray-200 pt-4 dark:border-gray-800">
+ <div className="flex flex-wrap items-center justify-between gap-x-4 gap-y-2">
+ <p className="text-sm font-medium">{S.agent.kernelTitle}</p>
<div className="flex shrink-0 items-center gap-2">
<Button
size="sm"
@@ -492,6 +525,38 @@ 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">
+ {data.config.kernelOutdated ? (
+ <>
+ <span className="text-xs text-gray-500 dark:text-gray-400">
+ {S.agent.kernelCurrent}
+ </span>
+ <span className="font-mono font-semibold">
+ {data.config.kernelVersion ?? S.agent.kernelLegacy}
+ </span>
+ <span className="text-xs text-gray-500 dark:text-gray-400">
+ · {S.agent.kernelLatest}
+ </span>
+ <span className="font-mono font-semibold">{data.config.kernelLatest}</span>
+ {/* Minimal outdated hint: icon + tooltip only (no textual alarm). */}
+ <span
+ role="img"
+ title={S.agent.kernelOutdatedHint}
+ aria-label={S.agent.kernelOutdatedHint}
+ className="self-center text-gray-500 dark:text-gray-400"
+ >
+ <GlyphIcon d={KERNEL_UPDATE_ICON} size={12} />
+ </span>
+ </>
+ ) : (
+ <>
+ <span className="font-mono font-semibold">{data.config.kernelVersion}</span>
+ <span className="text-xs text-gray-500 dark:text-gray-400">
+ · {S.agent.kernelUpToDate}
+ </span>
+ </>
+ )}
+ </p>
{/* Merge report: which fields the last update kept because customized (lightweight inline note). */}
{kernelResult !== null && kernelResult.kept.length > 0 && (
<p className="mt-2 text-xs text-gray-500 dark:text-gray-400">
@@ -501,39 +566,6 @@ function OverviewTab({
)}
</section>
- {/* Snapshot export / import: export is available to any member; import overwrites the entire Agent State, visible only to owners. */}
- <div>
- <p className="mb-1 text-xs font-medium text-gray-500">{S.agent.transferTitle}</p>
- <p className="mb-2 text-xs text-gray-500 dark:text-gray-400">{S.agent.transferDesc}</p>
- <div className="flex flex-wrap items-center gap-2">
- {projectId && (
- <a
- href={api.agentExportUrl(projectId, agentId)}
- download
- className={TRANSFER_BUTTON_CLASS}
- >
- {S.agent.exportSnapshot}
- </a>
- )}
- {isOwner && (
- <label
- className={`${TRANSFER_BUTTON_CLASS} ${importing ? "pointer-events-none opacity-60" : ""}`}
- >
- <HiddenFileInput accept=".tar.gz,.tgz" disabled={importing} onChange={onPickFile} />
- {importing ? S.agent.importing : S.agent.importSnapshot}
- </label>
- )}
- </div>
- {importError && (
- <p className="mt-1.5 text-xs text-red-600 dark:text-red-400">{importError}</p>
- )}
- </div>
-
- <Button size="sm" variant="primary" onClick={submit}>
- {S.common.save}
- </Button>
- {saveConfirm}
-
{/* Version conflict confirmation: resend the same package with confirm: true after confirming. */}
<ConfirmModal
open={conflict !== null}
diff --git a/packages/web/src/lib/strings-en.ts b/packages/web/src/lib/strings-en.ts
index f3830724..2e5172ea 100644
--- a/packages/web/src/lib/strings-en.ts
+++ b/packages/web/src/lib/strings-en.ts
@@ -229,7 +229,6 @@ export const en: Strings = {
"2–64 chars: starts with a lowercase letter; lowercase letters, digits and underscores only. Cannot be changed later.",
nameHint: "Leave empty to use the agent id as the name",
description: "Description",
- activeSessions: "Active Sessions",
sessionCount: (n: number): string => `${n} session${n === 1 ? "" : "s"}`,
toolCount: (n: number): string => `${n} tool${n === 1 ? "" : "s"}`,
vaultKeyCount: (n: number): string => `${n} vault key${n === 1 ? "" : "s"}`,
@@ -248,6 +247,7 @@ export const en: Strings = {
tabVault: "Vault",
tabSchedules: "Schedules",
stateDir: "State path",
+ copyStateDir: "Copy State path",
agentsMd: "AGENTS.md",
systemPrompt: "system_prompt template",
placeholdersTitle: "Available placeholders (click to insert)",
@@ -394,8 +394,8 @@ export const en: Strings = {
builtinUndeletable: "Built-in agents cannot be deleted",
deleteConfirm: (name: string): string =>
`Delete agent "${name}"? Its directory (including all Traces) will be removed recursively and cannot be recovered.`,
+ stateTitle: "Agent State",
stateVersion: "Agent State version",
- transferTitle: "Export / import",
transferDesc:
"Export the current Agent State snapshot (tar.gz); importing overwrites the whole directory and adopts the version inside the package.",
exportSnapshot: "Export snapshot",
@@ -415,8 +415,8 @@ export const en: Strings = {
kernelOutdatedHint: "Kernel update available",
kernelUpToDate: "Up to date",
kernelUpdateTitle: "Update kernel",
- kernelVersions: (current: string, latest: string): string =>
- `current ${current} · latest ${latest}`,
+ kernelCurrent: "current",
+ kernelLatest: "latest",
kernelUpdateAction: "Update kernel",
kernelUpdateConfirmBody:
"Fields you have not customized will be updated to the current built-in defaults; customized fields stay unchanged and are listed in the result. Name, description, the State version and MCP servers are unaffected. Continue?",
diff --git a/packages/web/src/lib/strings.ts b/packages/web/src/lib/strings.ts
index 50ee9a76..2e29e04f 100644
--- a/packages/web/src/lib/strings.ts
+++ b/packages/web/src/lib/strings.ts
@@ -220,7 +220,6 @@ export const zh = {
idHint: "2~64 位:小写字母开头,仅小写字母、数字与下划线;创建后不可修改",
nameHint: "留空则使用 Agent id 作为名称",
description: "描述",
- activeSessions: "活跃 Session",
sessionCount: (n: number): string => `${n} 个 Session`,
toolCount: (n: number): string => `${n} 个工具`,
vaultKeyCount: (n: number): string => `${n} 个密钥`,
@@ -239,6 +238,7 @@ export const zh = {
tabVault: "密钥保险柜",
tabSchedules: "定时任务",
stateDir: "State 路径",
+ copyStateDir: "复制 State 路径",
agentsMd: "AGENTS.md",
systemPrompt: "system_prompt 模板",
placeholdersTitle: "可用占位符(点击插入)",
@@ -364,8 +364,9 @@ export const zh = {
builtinUndeletable: "内置 Agent 不可被删除",
deleteConfirm: (name: string): string =>
`确认删除 Agent「${name}」?其目录(含全部 Trace)将被递归删除,不可恢复。`,
+ /** Agent State section: the State version with the snapshot transfer actions, plus the copyable State path. */
+ stateTitle: "Agent State",
stateVersion: "Agent State 版本",
- transferTitle: "导出 / 导入",
transferDesc: "导出当前 Agent State 快照包(tar.gz);导入整目录覆盖,并以包内版本为准。",
exportSnapshot: "导出快照",
importSnapshot: "导入快照",
@@ -378,13 +379,15 @@ export const zh = {
resetConfigConfirmBody:
"此操作会用当前默认值覆盖该 Agent 的现有配置:自定义系统提示词、工具列表、模型/压缩参数与 MCP Server 全部被替换,仅保留名称与描述。与 Skill 更新一样不可撤销,确认继续?",
resetConfigDone: "配置已还原为当前默认值",
- /** Kernel card: which defaults generation the config is based on (dates; unrelated to the optimization counter shown as stateVersion), with the update / restore actions. */
+ /** Kernel section: which defaults generation the config is based on (dates; unrelated to the optimization counter shown as stateVersion), with the update / restore actions. */
kernelTitle: "内核",
kernelLegacy: "早于内核版本机制",
kernelOutdatedHint: "内核有更新",
kernelUpToDate: "已是最新",
kernelUpdateTitle: "更新内核",
- kernelVersions: (current: string, latest: string): string => `当前 ${current} · 最新 ${latest}`,
+ /** Inline labels around the outdated line's two generation values (the values themselves render dark and semibold). */
+ kernelCurrent: "当前",
+ kernelLatest: "最新",
kernelUpdateAction: "更新内核",
kernelUpdateConfirmBody:
"将把未自定义的字段更新为当前内置默认值;自定义过的字段保持不变并在结果中列出。名称、描述、版本号与 MCP Server 不受影响。确认继续?",