A local-first multi-agent app development platform, built on PenguinHarness
fix(ui,web): 被截断的文字悬停时显示完整值(#1069 移植)
lmliheng23522eabf2fe
diff --git a/changelog/unreleased/2026-10-16-truncated-text-hover.md b/changelog/unreleased/2026-10-16-truncated-text-hover.mdnew file mode 100644index 00000000..94afa5b5--- /dev/null+++ b/changelog/unreleased/2026-10-16-truncated-text-hover.md@@ -0,0 +1,43 @@+# Truncated text shows its whole value on hover++- **Date:** 2026-10-16+- **Type:** fix+- **Scope:** `ui`, `web`++[中文版](2026-10-16-truncated-text-hover.zh.md)++Ported from upstream PenguinHarness (#1069, commit `24a2eb38`).++A line the page cuts off with an ellipsis, a path shortened to its last segments and a workspace+named by nothing but its folder could keep their whole value out of reach. All three now show it+on hover or focus.++## Details++- **Any ellipsized line, with no hint written for it.** The shared tooltip layer reacts only to+ elements carrying `data-tooltip`, so a line the page shortens itself had no way in. It now falls+ back to the shortened line under the pointer or focus: the node or one of its nearest ancestors+ that sets an ellipsis or `-webkit-line-clamp`, and — for a control, which is asked about as a+ whole — every such line inside it, in document order, of which the first actually cut off when+ the hint would open is shown. A monospace line (a path) opens in the code panel, anything else in+ the text panel; a blank line asks for nothing, and a panel that merely contains shortened rows is+ not itself one line.+- **An opt-out for subtrees that decide their own hint.** `data-tooltip-owned` stops the fallback+ inside it: the `<Tooltip>` wrapper's measuring span sets it, and so does `Truncated` while its+ title scrolls its own tail into view, so the hover that slides the text into place is not joined+ by a panel repeating it.+- **Workspace group headers.** The full path behind a folder-only label was already attached, but+ the rule that drops hints repeating visible text hid it whenever the basename fit. It is now+ marked as adding to what is visible (`data-tooltip-extra`) and drawn in the text panel, so it+ shows either way.+- **File tool cards.** A `read_file` / `edit_file` / `write_file` subtitle shortened to+ `…/parent/file` keeps its whole path one hover away: the card takes a new `subtitleFull` prop and+ the app passes `headerSubtitlePath(...)`, which answers with the full path only when the subtitle+ is the shortened path.++## What this fork left out++- `.agents/skills/penguin-harness-frontend/SKILL.md` — upstream's own developer skill notes, kept+ untouched here (the 2.1c / 2.5 line).+- The Archived chats group heading — that page (`web/src/features/settings/archived-sessions-section.tsx`)+ does not exist in this tree; the sidebar keeps the archived rows in its own folder.diff --git a/changelog/unreleased/2026-10-16-truncated-text-hover.zh.md b/changelog/unreleased/2026-10-16-truncated-text-hover.zh.mdnew file mode 100644index 00000000..0c641234--- /dev/null+++ b/changelog/unreleased/2026-10-16-truncated-text-hover.zh.md@@ -0,0 +1,35 @@+# 被截断的文字悬停即可看到全文++- **Date:** 2026-10-16+- **Type:** fix+- **Scope:** `ui`, `web`++[English](2026-10-16-truncated-text-hover.md)++移植自上游 PenguinHarness(#1069,提交 `24a2eb38`)。++页面用省略号截断的一行、只留末尾几段的路径、只显示文件夹名的工作区,原先都可能看不到完整的值。+现在悬停或聚焦即可看到。++## 细节++- **所有省略号截断的文字,且它自己没有提示。** 共享的悬停提示层只对带 `data-tooltip` 的元素起反应,+ 所以页面自己截断的一行原先无路可走。现在它会退回指针(或焦点)所在的**被截断的那一行**:该节点,+ 或它最近的一个设置了省略号 / `-webkit-line-clamp` 的祖先;对**控件**(整行一起问)则问它内部的+ 每一行、按文档顺序,取提示要弹出那一刻**确实被截断**的第一行。等宽字体的一行(路径)用代码面板,+ 其余用文字面板;空白行不弹;只是**装着**若干被截断行的面板不算作一行。+- **给「自己决定提示」的子树一个开关。** `data-tooltip-owned` 让兜底在该子树内不再生效:`<Tooltip>`+ 的测量 span 会设它,`Truncated` 在标题滚动展示自己尾部时也会设它 —— 于是「悬停把文字滑出来」这个+ 动作不会被一个复述它的面板跟着。+- **工作区分组的表头。** 文件夹名背后那条完整路径本来就有,但「重复可见文字的提示不显示」这条规则在+ 名称没被截断时把它藏了起来。现在它被标记为「补充可见文字之外的信息」(`data-tooltip-extra`)并用+ 文字面板显示,两种情况都能看到。+- **文件类工具的卡片。** `read_file` / `edit_file` / `write_file` 的副标题缩短成+ `…/上级目录/文件` 后,完整路径只差一次悬停:卡片新增 `subtitleFull`,应用侧传+ `headerSubtitlePath(...)`——只有当副标题确实是那条缩短路径时才给出完整路径。++## 本 fork 有意没落的++- `.agents/skills/penguin-harness-frontend/SKILL.md`:上游自己的开发技能说明,按 2.1c / 2.5 的口径不动。+- 「已归档的对话」页的分组标题:本树没有那个页面(`web/src/features/settings/archived-sessions-section.tsx`),+ 归档行由侧栏自己的折叠夹呈现。diff --git a/packages/ui/src/components/chat/tool-call-card/tool-call-card.tsx b/packages/ui/src/components/chat/tool-call-card/tool-call-card.tsxindex 331532b9..43da41a9 100644--- a/packages/ui/src/components/chat/tool-call-card/tool-call-card.tsx+++ b/packages/ui/src/components/chat/tool-call-card/tool-call-card.tsx@@ -60,6 +60,11 @@ export interface ToolCallCardProps {nameTooltip?: string;/** The human-readable line beside the name (the call's description, a file path). */subtitle?: string | null;+ /**+ * The whole value behind a subtitle the caller shortened (a file path shown as+ * `…/parent/file`): the subtitle's hover hint, shown even while the short form fits.+ */+ subtitleFull?: string | null;duration?: ToolCallDuration;/** A word at the row's right end saying where the call's work went. */marker?: string;@@ -89,6 +94,7 @@ export function ToolCallCard({name,nameTooltip,subtitle,+ subtitleFull,duration,marker,action,@@ -140,7 +146,17 @@ export function ToolCallCard({{name}</span>{subtitle && (- <span data-slot="detail" className="min-w-0 shrink truncate text-xs text-fg-muted">+ <span+ data-slot="detail"+ {...(subtitleFull && subtitleFull !== subtitle+ ? {+ "data-tooltip": subtitleFull,+ "data-tooltip-content": "code",+ "data-tooltip-extra": true,+ }+ : {})}+ className="min-w-0 shrink truncate text-xs text-fg-muted"+ >{subtitle}</span>)}diff --git a/packages/ui/src/components/navigation/group-header/group-header.tsx b/packages/ui/src/components/navigation/group-header/group-header.tsxindex 46859726..60437234 100644--- a/packages/ui/src/components/navigation/group-header/group-header.tsx+++ b/packages/ui/src/components/navigation/group-header/group-header.tsx@@ -192,7 +192,11 @@ export function GroupHeader({muted?: boolean;/** An optional trailing count (a workspace group's active total). */count?: number;- /** An optional tooltip (a workspace group's full path). */+ /**+ * A hint that says what the label does not (a workspace group's full path behind its+ * basename, an employee's organizations): marked as adding to the visible text, so it shows+ * on hover even when the label fits.+ */title?: string;/** Trailing header actions (pin, new chat, settings, import). */actions?: ReactNode;@@ -224,7 +228,10 @@ export function GroupHeader({onClick={onToggle}aria-expanded={open}aria-label={open ? strings.collapse : strings.expand}- {...(title !== undefined ? { "data-tooltip": title } : {})}+ // The text panel: a full path is wider than a label and wraps at its separators.+ {...(title !== undefined+ ? { "data-tooltip": title, "data-tooltip-content": "text", "data-tooltip-extra": true }+ : {})}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">{glyph !== undefined ? (diff --git a/packages/ui/src/components/overlays/tooltip/tooltip.tsx b/packages/ui/src/components/overlays/tooltip/tooltip.tsxindex 420990dd..a0d814d0 100644--- a/packages/ui/src/components/overlays/tooltip/tooltip.tsx+++ b/packages/ui/src/components/overlays/tooltip/tooltip.tsx@@ -17,7 +17,7 @@* means: `data-tooltip-extra`, or `<Tooltip extra>`, opens it over fully visible text. A hint* that only repeats the visible words is never marked, and never shows.*- * Two ways in, one panel:+ * Three ways in, one panel:* - `<Tooltip label>` wraps its trigger in a measuring span — for a trigger that needs the* wrapper's extras (`suppressed`, a placement beside a rail).* - `data-tooltip="…"` on any element, read by the one `<TooltipLayer />` mounted at the app@@ -27,6 +27,11 @@* (default `bottom`), `data-tooltip-extra` marks the hint as adding to the visible text.* Unlike `title`, it names nothing to assistive technology, so an element whose only name* was its title carries an `aria-label` with the same words.+ * - Nothing at all, for a line the page shortens with an ellipsis or a line clamp: hovered or+ * focused while it is actually cut off, and with no hint of its own around it, it shows its+ * whole text, so no shortened text is out of reach. A subtree whose hint someone else decides+ * — a `<Tooltip>` wrapper, a title that scrolls its own tail into view — carries+ * `data-tooltip-owned` and gets none.** Portaled to document.body at fixed viewport coordinates, like every other overlay here* (see use-portal-panel.ts): an in-place absolute panel is a descendant of its trigger, so a@@ -104,6 +109,12 @@ export const TOOLTIP_ATTR = "data-tooltip";*/export const TOOLTIP_EXTRA_ATTR = "data-tooltip-extra";+/**+ * Marks a subtree whose hover hint someone else decides (a `<Tooltip>` wrapper, a title that+ * scrolls its own tail into view), so the layer shows no full-text hint for a line inside it.+ */+export const TOOLTIP_OWNED_ATTR = "data-tooltip-owned";+/** A box that may clip its content: the four numbers a truncation check reads. */export interface ClipBox {scrollWidth: number;@@ -207,6 +218,111 @@ export function hintAllowedFor(el: Element, extra = false): boolean {return hintAllowed(readingText(el), clipBoxes(el), extra);}+/** The computed styles that say how an element sets its text: the part of a CSSStyleDeclaration read here. */+export interface LineStyle {+ textOverflow: string;+ /** `-webkit-line-clamp`: `none`, or the number of lines kept. */+ lineClamp: string;+ fontFamily: string;+}++/** Whether an element shortens its own text: an ellipsis (`truncate`) or a line clamp. */+export function shortensText(style: LineStyle): boolean {+ return (+ style.textOverflow === "ellipsis" || (style.lineClamp !== "" && style.lineClamp !== "none")+ );+}++/** The part of a DOM element the search for a shortened line walks; structural, so a hand-built tree serves too. */+export interface LineNode {+ parentElement: LineNode | null;+ hasAttribute(name: string): boolean;+ matches(selector: string): boolean;+ querySelectorAll(selector: string): ArrayLike<LineNode>;+}++/** How far up from the hovered node a shortened line is looked for. */+const LINE_SEARCH_DEPTH = 4;++/**+ * How many of a control's descendants are looked through for its shortened line: a row button+ * holds a title, a description and a few marks, never a whole panel.+ */+const LINE_SEARCH_WITHIN = 40;++/** A control a pointer or focus rests on as a whole, so the line inside it is what is asked about. */+const CONTROL_SELECTOR =+ "button, a[href], [role='button'], [role='menuitem'], [role='option'], [role='tab'], summary";++/** What a hovered or focused node asks about when it carries no hint: where it rests, and the lines that may be cut off there. */+export interface LineSubject<T> {+ /** The element the pointer or focus rests on as far as the hint goes: the line, or the control holding the lines. */+ at: T;+ /** The shortened lines, in document order; the first one cut off when the hint would open is shown. */+ lines: T[];+}++/**+ * The shortened lines a hovered or focused node stands for, or null: the node or one of its+ * nearest ancestors when that one shortens its text, else — for a control, which is asked about+ * as a whole — every line inside it that does (a row's title and its description). Nothing+ * inside a subtree marked `data-tooltip-owned` counts. Whether a line is actually cut off is+ * measured later, when the hint would open, since a resize can cut it off or give it back.+ */+export function shortenedLines<T extends LineNode>(+ start: T,+ styleOf: (node: T) => LineStyle,+): LineSubject<T> | null {+ let node: T | null = start;+ for (let depth = 0; node !== null && depth <= LINE_SEARCH_DEPTH; depth++) {+ if (node.hasAttribute(TOOLTIP_OWNED_ATTR)) return null;+ if (shortensText(styleOf(node))) return { at: node, lines: [node] };+ node = node.parentElement as T | null;+ }+ if (!start.matches(CONTROL_SELECTOR)) return null;+ const inside = start.querySelectorAll("*");+ const lines: T[] = [];+ for (let i = 0; i < inside.length && i < LINE_SEARCH_WITHIN; i++) {+ const candidate = inside[i] as T;+ if (shortensText(styleOf(candidate)) && !ownedWithin(candidate, start)) lines.push(candidate);+ }+ return lines.length === 0 ? null : { at: start, lines };+}++/** Whether `node`, or an ancestor of it up to and including `root`, is marked `data-tooltip-owned`. */+function ownedWithin(node: LineNode, root: LineNode): boolean {+ for (let at: LineNode | null = node; at !== null; at = at.parentElement) {+ if (at.hasAttribute(TOOLTIP_OWNED_ATTR)) return true;+ if (at === root) return false;+ }+ return false;+}++/** The computed `LineStyle` of a DOM element. */+function lineStyleOf(el: Element): LineStyle {+ const style = getComputedStyle(el);+ return {+ textOverflow: style.textOverflow,+ lineClamp: style.getPropertyValue("-webkit-line-clamp"),+ fontFamily: style.fontFamily,+ };+}++/**+ * The request for a shortened line's whole text: its reading text, in the code panel when the+ * line is set in a monospace face (a path, a command), in the text panel otherwise.+ */+export function lineRequest(text: string, style: LineStyle): TooltipRequest | null {+ const label = text.trim();+ if (label === "") return null;+ return {+ label,+ content: /mono/i.test(style.fontFamily) ? "code" : "text",+ placement: "bottom",+ extra: false,+ };+}+/** The trigger's viewport box — the part of a DOMRect the geometry reads. */export type TriggerRect = Pick<DOMRect, "top" | "bottom" | "left" | "right" | "width" | "height">;@@ -359,6 +475,7 @@ export function Tooltip({return (<spanref={anchorRef}+ {...{ [TOOLTIP_OWNED_ATTR]: "" }}className={`flex ${className ?? ""}`}onPointerEnter={show}onPointerLeave={hide}@@ -455,12 +572,17 @@ export function tooltipRequest(el: Pick<Element, "getAttribute">): TooltipReques* of handlers per element. The innermost element carrying the attribute wins, the delay is* `<Tooltip>`'s, and the panel closes on leave, blur, Escape, any scroll, a resize and a press* — a press because the element is being used now, not asked about.+ *+ * Where no element carries a hint, a shortened line (`shortenedLines`) that is cut off when the+ * hint would open shows its whole text: a hint nobody wrote, so that no ellipsis hides text+ * for good.*/export function TooltipLayer() {const [open, setOpen] = useState<(TooltipRequest & { anchor: TriggerRect }) | null>(null);useEffect(() => {- let current: Element | null = null;+ /** What the pointer or focus rests on: an element carrying a hint (no lines), or a line subject. */+ let current: LineSubject<Element> | null = null;let timer: ReturnType<typeof setTimeout> | null = null;const close = () => {if (timer !== null) clearTimeout(timer);@@ -470,28 +592,54 @@ export function TooltipLayer() {};const holder = (node: EventTarget | null): Element | null =>node instanceof Element ? node.closest(`[${TOOLTIP_ATTR}]`) : null;- const start = (el: Element | null) => {- if (el === current) return;+ /** What a node asks about: the element carrying a hint around it, else its shortened lines. */+ const subject = (node: EventTarget | null): LineSubject<Element> | null => {+ if (!(node instanceof Element)) return null;+ const hinted = holder(node);+ return hinted !== null ? { at: hinted, lines: [] } : shortenedLines(node, lineStyleOf);+ };+ /**+ * The hint the subject shows now, and the element it hangs under: its own request where it+ * carries one, else the whole text of its first line that is cut off at this moment.+ */+ const requestFor = (+ subject: LineSubject<Element>,+ ): { request: TooltipRequest; under: Element } | null => {+ const own = tooltipRequest(subject.at);+ if (own !== null) {+ return hintAllowedFor(subject.at, own.extra) ? { request: own, under: subject.at } : null;+ }+ for (const line of subject.lines) {+ if (!(line instanceof HTMLElement) || !isCutOff(line)) continue;+ const request = lineRequest(readingText(line), lineStyleOf(line));+ if (request !== null) return { request, under: line };+ }+ return null;+ };+ const start = (next: LineSubject<Element> | null) => {+ if (next !== null && next.at === current?.at) return;close();- if (el === null || tooltipRequest(el) === null) return;- current = el;+ if (next === null) return;+ current = next;timer = setTimeout(() => {timer = null;- const el = current;- const request = el === null ? null : tooltipRequest(el);- if (el === null || request === null || !el.isConnected) return;- if (!hintAllowedFor(el, request.extra)) return;- setOpen({ ...request, anchor: el.getBoundingClientRect() });+ const resting = current;+ if (resting === null || !resting.at.isConnected) return;+ const found = requestFor(resting);+ if (found === null) return;+ // The panel measures its own height against the room below, so it is given the trigger+ // rather than a ready position (see belowTrigger).+ setOpen({ ...found.request, anchor: found.under.getBoundingClientRect() });}, OPEN_DELAY_MS);};- const onOver = (e: PointerEvent) => start(holder(e.target));+ const onOver = (e: PointerEvent) => start(subject(e.target));const onOut = (e: PointerEvent) => {if (current === null) return;const next = e.relatedTarget;- if (next instanceof Node && current.contains(next)) return;+ if (next instanceof Node && current.at.contains(next)) return;close();};- const onFocusIn = (e: FocusEvent) => start(holder(e.target));+ const onFocusIn = (e: FocusEvent) => start(subject(e.target));const onKey = (e: KeyboardEvent) => {// Heard, not stopped: the panel is not a dismissible layer, so the same press still// reaches the dialog or menu behind it.diff --git a/packages/ui/test/group-header.test.ts b/packages/ui/test/group-header.test.tsindex e9ac55e4..63de6e4b 100644--- a/packages/ui/test/group-header.test.ts+++ b/packages/ui/test/group-header.test.ts@@ -42,6 +42,22 @@ describe("GroupHeader", () => {}),);+ it("shows the full value behind its label on hover, marked as adding to the visible text", () => {+ // A workspace group is labelled by its directory's basename; the path is nowhere else on+ // screen, so its hint must open even when the basename fits.+ const html = inZh(+ createElement(GroupHeader, {+ open: true,+ onToggle: () => {},+ label: "penguin-harness",+ title: "/home/me/dev/penguin-harness",+ }),+ );+ expect(html).toContain('data-tooltip="/home/me/dev/penguin-harness"');+ expect(html).toContain('data-tooltip-content="text" data-tooltip-extra="true"');+ expect(header(true, false)).not.toContain("data-tooltip");+ });+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="展开"');diff --git a/packages/ui/test/tool-call-card.test.ts b/packages/ui/test/tool-call-card.test.tsindex b68ecf68..619b1363 100644--- a/packages/ui/test/tool-call-card.test.ts+++ b/packages/ui/test/tool-call-card.test.ts@@ -37,6 +37,18 @@ describe("ToolCallCard", () => {expect(html).toContain('data-slot="progress"');});+ it("hangs the whole path behind a shortened subtitle on it, and nothing on a subtitle shown whole", () => {+ const shortened = card({+ subtitle: "…/state/config.ts",+ subtitleFull: "/repo/src/state/config.ts",+ });+ expect(shortened).toMatch(+ /data-slot="detail" data-tooltip="\/repo\/src\/state\/config.ts" data-tooltip-content="code" data-tooltip-extra="true"[^>]*>…\/state\/config.ts</,+ );+ const whole = card({ subtitle: "List the files" });+ expect(whole).toMatch(/<span data-slot="detail" class="[^"]*">List the files</);+ });+it("starts collapsed, its chevron named for what pressing it does", () => {const html = card({});expect(html).toContain('aria-expanded="false" aria-label="展开"');diff --git a/packages/ui/test/tooltip.test.ts b/packages/ui/test/tooltip.test.tsindex c7112d47..0c1f72e5 100644--- a/packages/ui/test/tooltip.test.ts+++ b/packages/ui/test/tooltip.test.ts@@ -20,6 +20,18 @@* anything `aria-hidden` are not read as words; a hint marked as carrying what the screen does* not show (`data-tooltip-extra`) opens over visible text all the same.*+ * A shortened line nobody wrote a hint for still shows its whole text:+ * - Given a line shortened by an ellipsis or a line clamp, when the pointer rests on it (or on+ * an ancestor-held span inside it), then it is the line asked about.+ * - Given a row control holding a title and a description, when the pointer rests anywhere on+ * the row, then both lines are candidates, in order, so whichever is cut off can show.+ * - Given a panel that merely contains shortened rows, when the pointer rests on its padding,+ * then nothing is asked about: a panel is not one line.+ * - Given a `<Tooltip>` wrapper or a title that scrolls its own tail into view+ * (`data-tooltip-owned`), then no full-text hint is added inside it.+ * - The whole text shows in the code panel for a monospace line (a path), the text panel+ * otherwise, and a blank line asks for nothing.+ ** The panel itself mounts only while hovered and through a portal, which a static render cannot* reach; what it may be drawn with (the overlay surface, token inks, the glass hook) is pinned* against the source. Where the app may still use a native `title` is the web app's@@ -30,14 +42,20 @@ import { join } from "node:path";import { createElement } from "react";import { describe, expect, it } from "vitest";import {+ TOOLTIP_OWNED_ATTR,Tooltip,belowTrigger,besideTrigger,hintAllowed,isCutOff,+ lineRequest,namedHint,readingText,+ shortenedLines,+ shortensText,tooltipRequest,+ type LineNode,+ type LineStyle,type ReadingNode,} from "../src/components/overlays/tooltip/tooltip";import { renderStatic } from "../src/testing";@@ -216,6 +234,87 @@ describe("a data-tooltip request", () => {});});+describe("a shortened line with no hint of its own", () => {+ const plain: LineStyle = { textOverflow: "clip", lineClamp: "none", fontFamily: "Inter" };+ const ellipsis: LineStyle = { ...plain, textOverflow: "ellipsis" };++ /** A hand-built element: a tag, its attributes, how it sets its text, and its children. */+ interface FakeNode extends LineNode {+ name: string;+ style: LineStyle;+ children: FakeNode[];+ }+ const node = (+ name: string,+ style: LineStyle,+ children: FakeNode[] = [],+ attrs: string[] = [],+ ): FakeNode => {+ const self: FakeNode = {+ name,+ style,+ children,+ parentElement: null,+ hasAttribute: (attr) => attrs.includes(attr),+ matches: (selector) => selector.split(",").some((s) => s.trim().split(/[[.]/)[0] === name),+ querySelectorAll: () => descendants(self),+ };+ for (const child of children) child.parentElement = self;+ return self;+ };+ const descendants = (n: FakeNode): FakeNode[] =>+ n.children.flatMap((child) => [child, ...descendants(child)]);+ const styleOf = (n: FakeNode) => n.style;++ it("counts an ellipsis or a line clamp as shortening, plain clipping as not", () => {+ expect(shortensText(ellipsis)).toBe(true);+ expect(shortensText({ ...plain, lineClamp: "2" })).toBe(true);+ expect(shortensText(plain)).toBe(false);+ expect(shortensText({ ...plain, lineClamp: "" })).toBe(false);+ });++ it("asks about the line the pointer rests on, or the shortened line around it", () => {+ const text = node("span", plain);+ const line = node("p", ellipsis, [text]);+ node("div", plain, [line]);+ expect(shortenedLines(line, styleOf)).toEqual({ at: line, lines: [line] });+ expect(shortenedLines(text, styleOf)).toEqual({ at: line, lines: [line] });+ });++ it("offers every line of a row control, title and description in order", () => {+ const title = node("span", ellipsis);+ const description = node("p", ellipsis);+ const row = node("button", plain, [node("div", plain, [title, description])]);+ expect(shortenedLines(row, styleOf)).toEqual({ at: row, lines: [title, description] });+ });++ it("asks about nothing on a panel that merely holds shortened rows", () => {+ const panel = node("div", plain, [node("button", plain, [node("span", ellipsis)])]);+ expect(shortenedLines(panel, styleOf)).toBeNull();+ });++ it("adds nothing inside a subtree whose hint someone else decides", () => {+ const scrolling = node("span", ellipsis, [node("span", plain)], [TOOLTIP_OWNED_ATTR]);+ expect(shortenedLines(scrolling, styleOf)).toBeNull();+ expect(shortenedLines(scrolling.children[0]!, styleOf)).toBeNull();+ const wrapped = node("span", plain, [node("span", ellipsis)], [TOOLTIP_OWNED_ATTR]);+ const row = node("button", plain, [wrapped, node("span", ellipsis)]);+ expect(shortenedLines(row, styleOf)?.lines).toEqual([row.children[1]]);+ });++ it("shows the whole text in the code panel for a monospace line, the text panel otherwise", () => {+ const mono = { ...ellipsis, fontFamily: 'ui-monospace, "JetBrains Mono", monospace' };+ expect(lineRequest(" feedback/review-style.md ", mono)).toEqual({+ label: "feedback/review-style.md",+ content: "code",+ placement: "bottom",+ extra: false,+ });+ expect(lineRequest("A long memory description", ellipsis)?.content).toBe("text");+ expect(lineRequest(" ", ellipsis)).toBeNull();+ });+});+describe("namedHint", () => {it("names a wordless mark with the words its hint shows", () => {expect(namedHint("Bar 3")).toEqual({@@ -227,11 +326,11 @@ describe("namedHint", () => {});describe("Tooltip", () => {- it("wraps its trigger in the measuring span and renders no panel until hovered", () => {+ it("wraps its trigger in the measuring span, which owns the hints inside, and renders no panel until hovered", () => {const html = renderStatic(createElement(Tooltip, { label: "Settings", className: "mt-auto", children: "gear" }),);- expect(html).toBe('<span class="flex mt-auto">gear</span>');+ expect(html).toBe('<span data-tooltip-owned="" class="flex mt-auto">gear</span>');// Deliberately no tooltip role or description: the trigger's own name is the one name.expect(html).not.toContain('role="tooltip"');expect(html).not.toContain("aria-describedby");diff --git a/packages/web/src/components/ui/truncated.tsx b/packages/web/src/components/ui/truncated.tsxindex ee94a188..81dd358b 100644--- a/packages/web/src/components/ui/truncated.tsx+++ b/packages/web/src/components/ui/truncated.tsx@@ -100,6 +100,9 @@ export function Truncated({{...(disclosure === "tooltip" && !codeTooltip? { "data-tooltip": text, "data-tooltip-content": "text" }: {})}+ // While the tail scrolls into view, the scroll is the disclosure: the app-wide full-text+ // hint for a cut-off line must not sit over the very text sliding past underneath it.+ {...(disclosure === "scroll" ? { "data-tooltip-owned": "" } : {})}>{/* The scroll needs a child the keyframes can turn into an inline-block andtransform; at rest it renders inline, i.e. exactly like the bare text nodediff --git a/packages/web/src/features/chat/tool-call-card.tsx b/packages/web/src/features/chat/tool-call-card.tsxindex efc62a29..6bbfa2a3 100644--- a/packages/web/src/features/chat/tool-call-card.tsx+++ b/packages/web/src/features/chat/tool-call-card.tsx@@ -135,6 +135,18 @@ export function headerSubtitle(name: string, argsJson: string, settled = true):return null;}+/**+ * The whole path behind a subtitle `headerSubtitle` shortened (`…/parent/file`), for its hover+ * hint; null when the subtitle is a description, or a path short enough to show whole.+ */+export function headerSubtitlePath(name: string, argsJson: string, settled = true): string | null {+ const shown = headerSubtitle(name, argsJson, settled);+ const pathArg = pathArgument(name);+ if (shown === null || pathArg === null) return null;+ const full = extractStringField(argsJson, pathArg)?.value.replace(/\s+/g, " ").trim() ?? "";+ return full !== "" && full !== shown && shortenPath(full) === shown ? full : null;+}+/*** Whether this call was launched with `run_in_background: true` — the argument `exec_command`* and `run_subagent` share, and the one that leaves work running after the tool has returned.@@ -384,6 +396,8 @@ export function SessionToolCall({ item, ctx }: { item: ToolCallItem; ctx: Stream// Settled once argument streaming stopped (or the complete call arrived): the subtitle's// completeness gate is lifted — whatever is there is final.subtitle={headerSubtitle(item.name, item.argumentsText, !item.callStreaming)}+ // A file path the subtitle shortened keeps its whole form one hover away.+ subtitleFull={headerSubtitlePath(item.name, item.argumentsText, !item.callStreaming)}duration={duration}// A call made with run_in_background, or moved there: the row says where its work went.marker={diff --git a/packages/web/test/tool-call-preview.test.ts b/packages/web/test/tool-call-preview.test.tsindex c1b99b3d..7086359f 100644--- a/packages/web/test/tool-call-preview.test.ts+++ b/packages/web/test/tool-call-preview.test.ts@@ -9,6 +9,8 @@* - The header subtitle shows the model's description for command and subagent tools and the* file path for file tools, on one line, holding a still-streaming field back until it* closes (#137) and showing whatever is there once the arguments settle.+ * - A file path the subtitle shortened keeps its whole form for the hover hint; a description,+ * or a path short enough to show whole, has none.* - A pending file-tool approval decodes the rewrite, the content or the read window.* - A call launched with the background flag is marked; one moved to the background later is* marked from the note its output carries.@@ -18,6 +20,7 @@import { describe, expect, it } from "vitest";import {headerSubtitle,+ headerSubtitlePath,isBackgroundCall,isDetachedCall,pendingFilePayload,@@ -81,6 +84,25 @@ describe("shortenPath", () => {});});+describe("headerSubtitlePath", () => {+ it("gives the whole path behind a shortened file-tool subtitle", () => {+ const args = '{"file_path":"packages/core/src/state/default-config.ts"}';+ expect(headerSubtitle("read_file", args)).toBe("…/state/default-config.ts");+ expect(headerSubtitlePath("read_file", args)).toBe("packages/core/src/state/default-config.ts");+ });++ it("gives nothing for a path shown whole, a description, or a path still streaming", () => {+ expect(headerSubtitlePath("read_file", '{"file_path":"src/app.py"}')).toBeNull();+ expect(+ headerSubtitlePath("read_file", '{"description":"Check the config","file_path":"/a/b/c.ts"}'),+ ).toBeNull();+ expect(+ headerSubtitlePath("exec_command", '{"cmd":"ls","description":"List files"}'),+ ).toBeNull();+ expect(headerSubtitlePath("read_file", '{"file_path":"/home/us', false)).toBeNull();+ });+});+describe("headerSubtitle", () => {it("shows the description for the command/subagent tools when present", () => {expect(