Skip to content

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

feat(web): copy a session's id from its row menu (#550)

Myriad-Dreaminddb1fddf5f2b
diff --git a/changelog/unreleased/2026-08-30-copy-session-id.md b/changelog/unreleased/2026-08-30-copy-session-id.md
new file mode 100644
index 00000000..63ebdfc7
--- /dev/null
+++ b/changelog/unreleased/2026-08-30-copy-session-id.md
@@ -0,0 +1,17 @@
+# Copy a Session's id from its row menu
+
+- **Date:** 2026-08-30
+- **Type:** feature
+- **Scope:** `web`
+- **PR:** [#550](https://github.com/Prism-Shadow/penguin-harness/pull/550)
+
+[中文版](2026-08-30-copy-session-id.zh.md)
+
+A Session's id was reachable only from the chat header's details card. It is now also an action on the Session row itself, in the same menu as pin, rename, archive and delete — reached by the row's ellipsis button or by right-clicking it.
+
+## Details
+
+- The action carries the details card's label and glyph, so one value has one mark wherever it is met.
+- It sits next to rename, the other action about which Session this is rather than what happens to it, and is offered on folder rows (archived, subagent, scheduled) too — those are exactly when an id is wanted.
+- The hover affordance is unchanged: archive alone, plus the ellipsis that opens the menu.
+- Copying confirms with a toast rather than the usual at-the-button check, because acting on a menu row closes the panel the button lives in.
diff --git a/changelog/unreleased/2026-08-30-copy-session-id.zh.md b/changelog/unreleased/2026-08-30-copy-session-id.zh.md
new file mode 100644
index 00000000..7a01e72a
--- /dev/null
+++ b/changelog/unreleased/2026-08-30-copy-session-id.zh.md
@@ -0,0 +1,17 @@
+# 从 Session 行的菜单复制它的 id
+
+- **Date:** 2026-08-30
+- **Type:** feature
+- **Scope:** `web`
+- **PR:** [#550](https://github.com/Prism-Shadow/penguin-harness/pull/550)
+
+[English](2026-08-30-copy-session-id.md)
+
+Session 的 id 此前只能从对话头部的详情卡片取得。现在它也是 Session 行自身的一个动作,与置顶、重命名、归档、删除同处一个菜单——点行上的省略号按钮或右键该行即可打开。
+
+## 细节
+
+- 该动作沿用详情卡片的标签与图标,同一个值在任何地方都是同一个标记。
+- 它紧挨重命名——两者都关乎"这是哪个 Session",而非"对它做什么";归档、子 Agent、定时这些文件夹行同样提供该动作,那正是需要 id 的场合。
+- 悬停时的直接动作不变:只有归档,以及打开菜单的省略号。
+- 复制以 toast 确认,而不是惯常的按钮上打勾——在菜单行上执行动作会关掉承载该按钮的面板。
diff --git a/packages/web/src/components/layout/sidebar.tsx b/packages/web/src/components/layout/sidebar.tsx
index 9cafe37d..9b053e45 100644
--- a/packages/web/src/components/layout/sidebar.tsx
+++ b/packages/web/src/components/layout/sidebar.tsx
@@ -137,6 +137,7 @@ import {
} from "../ui/group-list";
import type { GroupMode } from "../ui/group-list";
import { toastError, toastInfo, toastSuccess } from "../ui/toast";
+import { writeClipboard } from "../ui/copy-button";
import { Truncated } from "../ui/truncated";
import { Badge } from "../ui/badge";
import { SessionActivityIcon } from "../ui/session-activity-icon";
@@ -2641,6 +2642,13 @@ function SessionRow({
const handler: Record<SessionRowAction, (x: SessionInfo) => void> = {
pin: onTogglePin,
rename: onRename,
+ // The copy affordance's feedback normally rides on the button itself (copy-button.tsx),
+ // which a menu row cannot do: the row acts and the panel closes under it. A toast is
+ // the confirmation that survives that, and it says the same word.
+ copy: (x) => {
+ writeClipboard(x.sessionId);
+ toastSuccess(S.common.copied);
+ },
messaging: onMessaging,
archive: onToggleArchive,
delete: onDelete,
diff --git a/packages/web/src/components/ui/session-row-menu.tsx b/packages/web/src/components/ui/session-row-menu.tsx
index 11554a7f..3f4f2e3c 100644
--- a/packages/web/src/components/ui/session-row-menu.tsx
+++ b/packages/web/src/components/ui/session-row-menu.tsx
@@ -23,6 +23,7 @@ import { S } from "../../lib/strings";
import { GlyphIcon } from "./glyph-icon";
import { Icon } from "./group-list";
import { MESSAGING_RELAY_ICON } from "./icons";
+import { STAT_ICONS } from "../../lib/stat-icons";
/** Pushpin (lucide pin: head + body + stem), the group-header pin toggle / pinned indicator. */
export const PIN_ICON =
@@ -61,7 +62,7 @@ export const overflowMenuGlyph = (d: string) => (
);
/** One thing a Session row can do to its Session. */
-export type SessionRowAction = "pin" | "rename" | "messaging" | "archive" | "delete";
+export type SessionRowAction = "pin" | "rename" | "copy" | "messaging" | "archive" | "delete";
/** Row state the labels and glyphs read (both of the toggles flip on it). */
export interface SessionRowState {
@@ -79,13 +80,14 @@ export const HOVER_ROW_ACTIONS: readonly SessionRowAction[] = ["archive"];
/**
* The context menu's actions. Pin only reorders rows in the active list, so folder rows
* (archived / subagent / scheduled) offer the rest without it — the same gate the
- * ellipsis menu applied before this moved. The messaging binding sits with the other
- * configuration actions, before the archive/delete pair.
+ * ellipsis menu applied before this moved. Copying the id sits next to rename, the other
+ * action about which Session this is rather than what happens to it, and the messaging
+ * binding sits with them, before the archive/delete pair.
*/
export function contextMenuActions(canPin: boolean): readonly SessionRowAction[] {
return canPin
- ? ["pin", "rename", "messaging", "archive", "delete"]
- : ["rename", "messaging", "archive", "delete"];
+ ? ["pin", "rename", "copy", "messaging", "archive", "delete"]
+ : ["rename", "copy", "messaging", "archive", "delete"];
}
export interface SessionRowMenuItem {
@@ -110,6 +112,10 @@ export function sessionRowMenuItem(
};
case "rename":
return { label: S.chat.renameSession, icon: PENCIL_ICON, danger: false };
+ case "copy":
+ // The same glyph and label the details card's Session id row carries: one copy
+ // affordance for one value, wherever the reader meets it.
+ return { label: S.chat.copySessionId, icon: STAT_ICONS.copy, danger: false };
case "messaging":
// Same paper plane the session row flies when it is actually relaying: the menu entry
// and the mark it produces are one feature, and a reader should not have to learn two
diff --git a/packages/web/test/session-row-menu.test.ts b/packages/web/test/session-row-menu.test.ts
index 0aa0c732..72abdd19 100644
--- a/packages/web/test/session-row-menu.test.ts
+++ b/packages/web/test/session-row-menu.test.ts
@@ -30,6 +30,7 @@ import {
} from "../src/components/ui/session-row-menu";
import type { SessionRowAction } from "../src/components/ui/session-row-menu";
import { MESSAGING_RELAY_ICON } from "../src/components/ui/icons";
+import { STAT_ICONS } from "../src/lib/stat-icons";
import { setActiveStrings, zh } from "../src/lib/strings";
import { en } from "../src/lib/strings-en";
@@ -44,7 +45,7 @@ describe("HOVER_ROW_ACTIONS", () => {
});
it("does not carry rename, pin, delete or the messaging binding — those live in the menu", () => {
- for (const action of ["rename", "pin", "delete", "messaging"]) {
+ for (const action of ["rename", "pin", "delete", "messaging", "copy"]) {
expect(HOVER_ROW_ACTIONS as readonly string[]).not.toContain(action);
}
});
@@ -55,6 +56,7 @@ describe("contextMenuActions", () => {
expect([...contextMenuActions(true)]).toEqual([
"pin",
"rename",
+ "copy",
"messaging",
"archive",
"delete",
@@ -62,7 +64,13 @@ describe("contextMenuActions", () => {
});
it("drops only pin on rows where pinning cannot reorder anything (folder rows)", () => {
- expect([...contextMenuActions(false)]).toEqual(["rename", "messaging", "archive", "delete"]);
+ expect([...contextMenuActions(false)]).toEqual([
+ "rename",
+ "copy",
+ "messaging",
+ "archive",
+ "delete",
+ ]);
});
it("is a superset of the hover actions, so nothing is reachable by hover alone", () => {
@@ -77,6 +85,13 @@ describe("contextMenuActions", () => {
expect(contextMenuActions(true)).toContain("rename");
expect(contextMenuActions(false)).toContain("rename");
});
+
+ it("offers the id copy on every row, including the folder rows that cannot pin", () => {
+ // The id is what a person carries out of the app — into the CLI, a bug report, a
+ // trace lookup — and an archived or scheduled Session is exactly when it is wanted.
+ expect(contextMenuActions(true)).toContain("copy");
+ expect(contextMenuActions(false)).toContain("copy");
+ });
});
describe("the hover buttons' CSS contract", () => {
@@ -113,7 +128,7 @@ describe("the hover buttons' CSS contract", () => {
describe("sessionRowMenuItem", () => {
it("gives every action a label, a glyph, and only delete the destructive treatment", () => {
- const all: SessionRowAction[] = ["pin", "rename", "messaging", "archive", "delete"];
+ const all: SessionRowAction[] = ["pin", "rename", "copy", "messaging", "archive", "delete"];
for (const action of all) {
const item = sessionRowMenuItem(action, RESTING);
expect(item.label).toBeTruthy();
@@ -123,13 +138,21 @@ describe("sessionRowMenuItem", () => {
});
it("gives the actions distinct glyphs, so a row is not read by its label alone", () => {
- const icons = (["pin", "rename", "messaging", "archive", "delete"] as SessionRowAction[]).map(
- (a) => sessionRowMenuItem(a, RESTING).icon,
- );
+ const icons = (
+ ["pin", "rename", "copy", "messaging", "archive", "delete"] as SessionRowAction[]
+ ).map((a) => sessionRowMenuItem(a, RESTING).icon);
expect(new Set(icons).size).toBe(icons.length);
// Remote control wears the same paper plane the session row flies while it is relaying:
// the action and the mark it produces are one feature.
- expect(icons).toEqual([PIN_ICON, PENCIL_ICON, MESSAGING_RELAY_ICON, ARCHIVE_ICON, TRASH_ICON]);
+ expect(icons).toEqual([
+ PIN_ICON,
+ PENCIL_ICON,
+ // The same glyph the details card's copy button shows, so one value has one mark.
+ STAT_ICONS.copy,
+ MESSAGING_RELAY_ICON,
+ ARCHIVE_ICON,
+ TRASH_ICON,
+ ]);
});
it("flips archive's label and glyph on an archived row", () => {
@@ -158,6 +181,7 @@ describe("sessionRowMenuItem", () => {
expect(sessionRowMenuItem("archive", RESTING).label).toBe(en.chat.archiveSession);
expect(sessionRowMenuItem("delete", RESTING).label).toBe(en.chat.deleteSession);
expect(sessionRowMenuItem("rename", RESTING).label).toBe(en.chat.renameSession);
+ expect(sessionRowMenuItem("copy", RESTING).label).toBe(en.chat.copySessionId);
expect(sessionRowMenuItem("messaging", RESTING).label).toBe(en.messaging.bindAction);
// The hover buttons are icon-only, so their label IS their accessible name: an English
// row must not fall back to the zh catalog and leave a Chinese name on the button.