Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(desktop): 修复会话引用 chip 与范围摘要挤成竖排 (#385)
Dash6ada4a871e63
diff --git a/apps/desktop/src/renderer/components/chat/SessionLinkChip.tsx b/apps/desktop/src/renderer/components/chat/SessionLinkChip.tsxindex 661e9ea2e9..1abca5c260 100644--- a/apps/desktop/src/renderer/components/chat/SessionLinkChip.tsx+++ b/apps/desktop/src/renderer/components/chat/SessionLinkChip.tsx@@ -150,13 +150,25 @@ export function SessionLinkChip({ href, label, referenceMetadata }: SessionLinkC// A Markdown label is explicit author intent and must survive anchored// links even when no persisted reference metadata is available yet.const visibleMessageLabel = explicitLabel ?? messageLabel;- const messageContent = <QuoteChip quote={{ text: visibleMessageLabel }} />;+ // 宽度上限只能加在 pill 这一侧:pill 和 summary 是同一 flex 行的两个 item,+ // 把 240px 加在外层会让两者抢同一份宽度——summary 没有 nowrap,会被压到+ // min-content(中文逐字换行)竖成一列,再把 pill 沿 stretch 拉成大椭圆。+ const messageContent = (+ <span className="inline-flex min-w-0 max-w-[min(240px,55vw)]">+ <QuoteChip quote={{ text: visibleMessageLabel }} />+ </span>+ );+ // summary 单行截断:窄气泡里退化成省略号,完整内容仍在 title / aria-label。const referenceSummary = referenceDetails.length > 0 ? (- <span data-session-reference-summary="" className="ml-1 text-[11px] text-[var(--text-tertiary)]">+ <span+ data-session-reference-summary=""+ className="ml-1 min-w-0 truncate text-[11px] text-[var(--text-tertiary)]"+ >{referenceDetails.join(' · ')}</span>) : null;- const messageClass = 'inline-flex max-w-[min(240px,55vw)] align-middle';+ // items-center 保证 pill 保持自身高度(不被 align-items: stretch 撑成椭圆)。+ const messageClass = 'inline-flex max-w-full items-center align-middle';if (navigationMode === 'sidebar-embedded') {return (<span data-session-message-link="" title={tooltip} className={cn(messageClass, 'cursor-default')}>diff --git a/apps/desktop/src/renderer/components/chat/__tests__/embeddedSessionNavigation.test.tsx b/apps/desktop/src/renderer/components/chat/__tests__/embeddedSessionNavigation.test.tsxindex 9382cfd656..984096b6c9 100644--- a/apps/desktop/src/renderer/components/chat/__tests__/embeddedSessionNavigation.test.tsx+++ b/apps/desktop/src/renderer/components/chat/__tests__/embeddedSessionNavigation.test.tsx@@ -113,6 +113,35 @@ describe('sidebar-embedded session navigation boundary', () => {).toBeTruthy();});+ it('keeps the anchored pill and its range summary on a single line', () => {+ const { container } = render(+ <SessionLinkChip+ href="cindy://session/session-a?message=message-1"+ label="Session A"+ referenceMetadata={{+ sessionId: 'session-a',+ messageClientId: 'message-1',+ range: 'around-anchor',+ messageCount: 11,+ truncated: true,+ }}+ />,+ );++ // 宽度上限必须留在 pill 一侧:加回外层会让 pill 与 summary 抢同一份 240px,+ // summary 被压成逐字竖排、pill 被 stretch 拉成大椭圆。+ const link = container.querySelector('button[data-session-message-link]');+ expect(link?.className).toContain('items-center');+ expect(link?.className).not.toContain('max-w-[min(240px,55vw)]');+ expect(+ container.querySelector('[data-inline-reference-chip]')?.parentElement?.className,+ ).toContain('max-w-[min(240px,55vw)]');+ // summary 单行截断,不参与换行。+ expect(container.querySelector('[data-session-reference-summary]')?.className).toContain(+ 'truncate',+ );+ });+it('renders handoff cards as static content without resolving or navigating', () => {render(embedded(