diff --git a/apps/web/tests/agent-team-panel.e2e.ts b/apps/web/tests/agent-team-panel.e2e.ts index 608e6d060a..bc6fafa6ac 100644 --- a/apps/web/tests/agent-team-panel.e2e.ts +++ b/apps/web/tests/agent-team-panel.e2e.ts @@ -589,7 +589,7 @@ describe('web e2e: agent teamwork panel', () => { expect(await row.getByText('team-panel-researcher', { exact: true }).count()).toBe(0) expect(await panel.evaluate(element => element.scrollWidth <= element.clientWidth)).toBe(true) await primary.hover() - const card = page.locator('[data-hover-details]') + const card = page.locator('[data-session-panel-details]') await card.waitFor() expect(await card.evaluate(element => [...element.children].slice(0, 2).map(child => child.textContent))) .toEqual([RESEARCHER_DESCRIPTION, 'Owner: team-panel-researcher']) diff --git a/apps/web/tests/subagent-conversation.e2e.ts b/apps/web/tests/subagent-conversation.e2e.ts index 703c4ff272..e32f0fd38d 100644 --- a/apps/web/tests/subagent-conversation.e2e.ts +++ b/apps/web/tests/subagent-conversation.e2e.ts @@ -498,7 +498,7 @@ describe('web e2e: persisted subagent conversation and human continuation', () = await row.getByRole('button', { name: `Expand ${LABEL} descendants`, exact: true }).waitFor() expect(await row.getByRole('button', { name: `Open ${LABEL} in sidebar`, exact: true }).count()).toBe(1) await primary.hover() - const card = page.locator('[data-hover-details]') + const card = page.locator('[data-session-panel-details]') await card.waitFor() expect(await card.evaluate(element => [...element.children].map(child => child.textContent).slice(0, 3))) .toEqual([LABEL, `Owner: ${CHILD_NAME}`, 'completed · continuable']) diff --git a/packages/client/ui-agent-team/src/client/TeamBoard.tsx b/packages/client/ui-agent-team/src/client/TeamBoard.tsx index 022ec21d76..a3aa0b60b2 100644 --- a/packages/client/ui-agent-team/src/client/TeamBoard.tsx +++ b/packages/client/ui-agent-team/src/client/TeamBoard.tsx @@ -4,7 +4,7 @@ import type { SessionId } from '@deepseek-ai/dsh-session/types' import type { TeamProjection, TeamTaskView, TeamTaskId } from '@deepseek-ai/dsh-agent-team/client' import type {} from '@deepseek-ai/dsh-api-session-controller/client' import { - HoverCard, HoverCardGroup, HoverDetails, IconChevronDownOutlineRegular, + HoverCard, HoverCardGroup, IconChevronDownOutlineRegular, StateDot, Tooltip, type StateDotState, } from '@deepseek-ai/dsh-client-ui-primitives' import type { PropsLocale, PropsRenderFactories, PropsRuntime, PropsStore } from '@deepseek-ai/dsh-client-ui-slots' @@ -71,7 +71,7 @@ function progressLabel(tasks: readonly VisibleTask[], t: TeamBoardProps['t']): s ].join('\u2002·\u2002') } -function TaskRow({ task, rootId, expanded, onToggle, t }: Pick & { +function TaskRow({ task, rootId, expanded, onToggle, renderFactorySlot, t }: Pick & { task: VisibleTask rootId: SessionId expanded: boolean @@ -103,13 +103,11 @@ function TaskRow({ task, rootId, expanded, onToggle, t }: Pick )} - content={( - - )} + content={renderFactorySlot('conversation.session.panel.details', { + title: task.subject, + lines: [t('hover.owner', { name: owner }), ...task.description ? [task.description] : []], + status: { state, label: status }, + })} /> {expanded && (
@@ -160,6 +158,7 @@ export function TeamBoard({ sessionId, useProjection, useStore, actions, renderF key={task.id} task={task} rootId={sessionId} expanded={expandedTaskId === task.id} onToggle={() => { setExpandedTaskId(current => current === task.id ? null : task.id) }} + renderFactorySlot={renderFactorySlot} t={t} /> ))} diff --git a/packages/client/ui-agent-team/tests/team-board.client.spec.tsx b/packages/client/ui-agent-team/tests/team-board.client.spec.tsx index b2eaeed7ce..7f81bcc470 100644 --- a/packages/client/ui-agent-team/tests/team-board.client.spec.tsx +++ b/packages/client/ui-agent-team/tests/team-board.client.spec.tsx @@ -11,6 +11,7 @@ import { zh as commonZh } from '@deepseek-ai/dsh-client-locale/src/locales/zh.ts import { TeamBoard, TeamProgress, type TeamBoardProps, type TeamProgressProps } from '../src/client/TeamBoard.tsx' import { createTeamBoardStore } from '../src/client/team-board-store.ts' import { en, zh } from '../src/client/locales.ts' +import type { PanelDetailsProps, PanelFoldProps } from '@deepseek-ai/dsh-client-ui-session-panel/client' afterEach(() => { cleanup() @@ -51,11 +52,23 @@ function summary(id: SessionId, title?: string): SessionSummary { type BoardStore = ReturnType['create']> /** - * The Session panel's fold control Factory as this suite renders it: a button with its state, name, and label. - * ui-session-panel's own suite owns the control's markup. + * The Session panel's Factories as this suite renders them: the fold control as a button with its state, name, and + * label, and a row's details as one element per part in order. ui-session-panel's own suite owns their markup. */ -function renderFold(_name: string, input: { expanded: boolean; label: string; name: string; onToggle: () => void }) { - return +function renderPanelFactory(name: string, input: object) { + if (name === 'conversation.session.panel.details') { + const { title, lines = [], status, facts = [] } = input as PanelDetailsProps + return ( +
+ {title !== undefined &&
{title}
} + {lines.map(line =>
{line}
)} + {status !== undefined &&
{status.label}
} + {facts.length > 0 &&
{facts.map(fact => {fact.label})}
} +
+ ) + } + const fold = input as PanelFoldProps + return } function bench(options: { @@ -80,7 +93,7 @@ function bench(options: { const props = { sessionId, useProjection, useSessions: bindSnapshotSelector(sessions), - useStore: bindSnapshotSelector(store), actions: store.actions, renderFactorySlot: renderFold, + useStore: bindSnapshotSelector(store), actions: store.actions, renderFactorySlot: renderPanelFactory, t: makeTranslate(zh, commonZh), } as TeamBoardProps return { props, sessions, store } @@ -458,7 +471,7 @@ describe('TeamBoard', () => { const button = row() const anchor = button.parentElement as HTMLElement const details = (): string[] | null => { - const card = document.querySelector('[data-hover-details]') + const card = document.querySelector('[data-session-panel-details]') return card === null ? null : [...card.children].map(child => child.textContent ?? '') } fireEvent.pointerEnter(anchor, { pointerType: 'mouse' }) diff --git a/packages/client/ui-jobs/src/client/JobsSection.tsx b/packages/client/ui-jobs/src/client/JobsSection.tsx index 9a967523b7..e74086af07 100644 --- a/packages/client/ui-jobs/src/client/JobsSection.tsx +++ b/packages/client/ui-jobs/src/client/JobsSection.tsx @@ -2,7 +2,7 @@ import { useEffect, useId, useMemo, useRef, useState } from 'react' import type { JobsSnapshot, JobView, ObservedJob } from '@deepseek-ai/dsh-api-job-controller/client' import type { SessionId } from '@deepseek-ai/dsh-session/types' import { - HoverCard, HoverCardGroup, HoverDetails, IconChevronDownOutlineRegular, IconClockOutlineRegular, IconStopFillRegular, MarqueeText, + HoverCard, HoverCardGroup, IconChevronDownOutlineRegular, IconStopFillRegular, MarqueeText, StateDot, type StateDotState, TerminalBlock, type TerminalBlockLabels, Tooltip, useHoverMarquee, } from '@deepseek-ai/dsh-client-ui-primitives' import type { InjectFace, PropsLocale, PropsRenderFactories, PropsRuntime, PropsStore, TranslateNS } from '@deepseek-ai/dsh-client-ui-slots' @@ -190,7 +190,7 @@ function ordered(jobs: readonly JobView[]): JobView[] { type KillState = 'idle' | 'armed' | 'pending' | 'failed' /** One job row plus, when observable and expanded, its live output panel. */ -function JobItem({ job, view, expanded, now, onToggle, kill, t }: { +function JobItem({ job, view, expanded, now, onToggle, kill, renderFactorySlot, t }: Pick & { job: JobView view: ObservedJob | undefined expanded: boolean @@ -233,13 +233,11 @@ function JobItem({ job, view, expanded, now, onToggle, kill, t }: { , label: duration }]} - /> - )} + content={renderFactorySlot('conversation.session.panel.details', { + lines: [job.kind], + status: { state: dotState(job), label: state }, + facts: [{ kind: 'duration', label: duration }], + })} anchor={( // A command its cell clips crawls into view while the pointer rests on the row.
{ setExpandedKey(current => current === String(job.id) ? undefined : String(job.id)) }} + renderFactorySlot={renderFactorySlot} {...job.status === 'running' && mayKill ? { kill: { diff --git a/packages/client/ui-jobs/tests/jobs-section.client.spec.tsx b/packages/client/ui-jobs/tests/jobs-section.client.spec.tsx index c566387769..149709378e 100644 --- a/packages/client/ui-jobs/tests/jobs-section.client.spec.tsx +++ b/packages/client/ui-jobs/tests/jobs-section.client.spec.tsx @@ -8,6 +8,7 @@ import type { SessionId } from '@deepseek-ai/dsh-session/types' import { JobsRunningIndicator, JobsSection, type JobsRunningIndicatorProps, type JobsSectionProps } from '../src/client/JobsSection.tsx' import { createJobsSectionStore } from '../src/client/jobs-store.ts' import { en, zh, ru } from '../src/client/locales.ts' +import type { PanelDetailsProps, PanelFoldProps } from '@deepseek-ai/dsh-client-ui-session-panel/client' beforeEach(() => { class TooltipObserver implements ResizeObserver { @@ -61,11 +62,23 @@ function outputJob(over: Partial = {}): JobView { type SectionStore = ReturnType['create']> /** - * The Session panel's fold control Factory as this suite renders it: a button with its state, name, and label. - * ui-session-panel's own suite owns the control's markup. + * The Session panel's Factories as this suite renders them: the fold control as a button with its state, name, and + * label, and a row's details as one element per part in order. ui-session-panel's own suite owns their markup. */ -function renderFold(_name: string, input: { expanded: boolean; label: string; name: string; onToggle: () => void }) { - return +function renderPanelFactory(name: string, input: object) { + if (name === 'conversation.session.panel.details') { + const { title, lines = [], status, facts = [] } = input as PanelDetailsProps + return ( +
+ {title !== undefined &&
{title}
} + {lines.map(line =>
{line}
)} + {status !== undefined &&
{status.label}
} + {facts.length > 0 &&
{facts.map(fact => {fact.label})}
} +
+ ) + } + const fold = input as PanelFoldProps + return } /** Test-local selector hook over a framework-neutral store instance. */ @@ -90,7 +103,7 @@ function props( } return { sessionId: SESSION, useJobs, watchRows, observe, killJob, useStore: hookOf(store), actions: store.actions, t, - useAccess: () => mayKill, renderFactorySlot: renderFold, + useAccess: () => mayKill, renderFactorySlot: renderPanelFactory, } as Pick as JobsSectionProps } @@ -683,9 +696,9 @@ describe('JobsSection hover', () => { const anchor = row.parentElement as HTMLElement fireEvent.pointerEnter(anchor, { pointerType: 'mouse' }) act(() => { vi.advanceTimersByTime(499) }) - expect(document.querySelector('[data-hover-details]')).toBeNull() + expect(document.querySelector('[data-session-panel-details]')).toBeNull() act(() => { vi.advanceTimersByTime(1) }) - const card = document.querySelector('[data-hover-details]') as HTMLElement + const card = document.querySelector('[data-session-panel-details]') as HTMLElement expect([...card.children].map(child => child.textContent)).toEqual(['bash', '运行中', '10秒']) } finally { vi.useRealTimers() @@ -703,7 +716,7 @@ describe('JobsSection hover', () => { fireEvent.pointerEnter(anchor, { pointerType: 'mouse' }) fireEvent.pointerEnter(stop, { pointerType: 'mouse' }) act(() => { vi.advanceTimersByTime(1000) }) - expect(document.querySelector('[data-hover-details]')).toBeNull() + expect(document.querySelector('[data-session-panel-details]')).toBeNull() expect(screen.getByRole('tooltip', { hidden: true }).textContent).toBe(zh['kill.stop']) fireEvent.pointerLeave(stop, { pointerType: 'mouse' }) fireEvent.pointerLeave(anchor, { pointerType: 'mouse' }) @@ -711,10 +724,10 @@ describe('JobsSection hover', () => { // A card the row opened closes once the pointer reaches the stop control. fireEvent.pointerEnter(anchor, { pointerType: 'mouse' }) act(() => { vi.advanceTimersByTime(500) }) - expect(document.querySelector('[data-hover-details]')).not.toBeNull() + expect(document.querySelector('[data-session-panel-details]')).not.toBeNull() fireEvent.pointerEnter(stop, { pointerType: 'mouse' }) act(() => { vi.advanceTimersByTime(1000) }) - expect(document.querySelector('[data-hover-details]')).toBeNull() + expect(document.querySelector('[data-session-panel-details]')).toBeNull() } finally { vi.useRealTimers() } diff --git a/packages/client/ui-primitives/README.i18n.yaml b/packages/client/ui-primitives/README.i18n.yaml index 40781b5850..e5ac472a3f 100644 --- a/packages/client/ui-primitives/README.i18n.yaml +++ b/packages/client/ui-primitives/README.i18n.yaml @@ -18,8 +18,8 @@ en: 33a5b39959a595c6 zh: efd1088e9f13ed67 /deepseek-ai-dsh-client-ui-primitives/use-this-package/component-catalog: - en: fd5a93dfbab3c456 - zh: b246d0ca77f063fb + en: bd746373375bcd7a + zh: f37e43b679c06229 /deepseek-ai-dsh-client-ui-primitives/use-this-package/controls-and-icons: en: fd3499ef403a0594 zh: 3a17727316d3c666 diff --git a/packages/client/ui-primitives/README.md b/packages/client/ui-primitives/README.md index 5b2184e93e..b3a50d5006 100644 --- a/packages/client/ui-primitives/README.md +++ b/packages/client/ui-primitives/README.md @@ -66,7 +66,6 @@ Check this table before writing a control in a feature package. A plugin cannot | `RiskConfirmation` | Sensitive action gated behind an explicit checkbox, using the shared warning-title layout. | | `Tooltip` | Hover and keyboard-focus text anchored to a cloned child; optional `delayMs` controls hover delay and `focusDelayMs` controls keyboard-focus delay, both defaulting to 0 ms. Optional `portal` rendering escapes clipping containers and ancestor stacking contexts that cap the bubble's z-index. | | `HoverCard`, `HoverCardGroup` | Readable, optionally copyable hover preview; a physical list can opt cards into shared first-display dwell and exclusive display. A compact card opens beside the anchor's end edge, or beside its start edge when it would cross the viewport's end and fits there, as for rows of a panel at the window's end; with room on neither side it keeps to the viewport's end margin over the anchor. | -| `HoverDetails` | Body of a HoverCard that details a summary-panel row on the card's dark surface: an optional title, which wraps, secondary lines such as the owner, the state after its dot, and measures such as tokens and duration after 14px icons. | | `DraggableImage` | Original-image gestures with explicit transfer and feedback callbacks. | | `ImageLightbox` | Shared image modal with focus restoration and Escape dismissal. | | `usePointerGrace` | Cancelable dismissal delay that lets the pointer cross the gap between a trigger and its card; pending timers are cleared on unmount. | diff --git a/packages/client/ui-primitives/README.zh.md b/packages/client/ui-primitives/README.zh.md index 4e435ea26b..3351452fd5 100644 --- a/packages/client/ui-primitives/README.zh.md +++ b/packages/client/ui-primitives/README.zh.md @@ -66,7 +66,6 @@ kind: "package-library" | `RiskConfirmation` | 以显式复选框把关的敏感操作确认,采用共用的警告标题布局。 | | `Tooltip` | 锚定在克隆子元素上的悬停与键盘聚焦提示;可选的 `delayMs` 控制悬停延迟,`focusDelayMs` 控制键盘聚焦延迟,均默认为 0 毫秒。可通过 `portal` 渲染到外层,避免被容器裁剪,或受祖先层叠上下文限制其 z-index。 | | `HoverCard`、`HoverCardGroup` | 可阅读、可选带复制按钮的悬停预览;物理列表可选择让卡片共享首次显示等待,并互斥显示。紧凑卡片出现在锚点结束一侧;会超出视口结束边缘、而开始一侧放得下时出现在开始一侧,例如窗口末端面板中的行;两侧都放不下时贴着视口结束边缘的留白,盖在锚点上。 | -| `HoverDetails` | 在 HoverCard 深色底面上说明摘要面板某一行的卡片内容:可选且可换行的标题、负责人等次要文字行、状态点及状态,以及带 14px 图标的 token、用时等度量。 | | `DraggableImage` | 通过显式传递与反馈回调提供原图拖放。 | | `ImageLightbox` | 共享图片浮层,支持焦点恢复与 Esc 关闭。 | | `usePointerGrace` | 可取消的延迟关闭,让指针能够跨越触发控件与卡片间的空隙;卸载时清除待执行定时器。 | diff --git a/packages/client/ui-primitives/src/HoverDetails.tsx b/packages/client/ui-primitives/src/HoverDetails.tsx deleted file mode 100644 index ba14c5591f..0000000000 --- a/packages/client/ui-primitives/src/HoverDetails.tsx +++ /dev/null @@ -1,53 +0,0 @@ -/** Body of a HoverCard that details one row of a summary panel. */ - -import type { ReactNode } from 'react' -import { StateDot, type StateDotState } from './StateDot.tsx' -import css from './HoverDetails.module.css' - -/** What a row's hover card says about it. */ -export interface HoverDetailsProps { - /** - * The full name of what the row shows; it wraps instead of clipping. Omit it - * when the name can run long, such as a command, and the row's own view - * shows it in full. - */ - readonly title?: ReactNode - /** Lines in secondary type under the title, such as the owner; each stops after six lines. */ - readonly lines?: readonly ReactNode[] - /** The state, after its dot. */ - readonly status?: { readonly state: StateDotState; readonly label: string } | undefined - /** Measures on one line, each after its 14px icon, such as tokens and duration. */ - readonly facts?: readonly { readonly icon: ReactNode; readonly label: string }[] -} - -/** - * Render the details of one summary-panel row for its HoverCard, on the card's - * dark surface in both themes: the title, secondary lines, the state, and the - * measures. Absent or empty parts render nothing. - * @param props - title, lines, state, and measures. - * @returns the card body. - */ -export function HoverDetails({ title, lines = [], status, facts = [] }: HoverDetailsProps): ReactNode { - return ( -
- {title !== undefined &&
{title}
} - {lines.map((line, index) =>
{line}
)} - {status !== undefined && ( -
- - {status.label} -
- )} - {facts.length > 0 && ( -
- {facts.map(fact => ( - - - {fact.label} - - ))} -
- )} -
- ) -} diff --git a/packages/client/ui-primitives/src/index.ts b/packages/client/ui-primitives/src/index.ts index 0c79f4838a..5e65c50774 100644 --- a/packages/client/ui-primitives/src/index.ts +++ b/packages/client/ui-primitives/src/index.ts @@ -27,8 +27,6 @@ export { Tag } from './Tag.tsx' export type { TagTone } from './Tag.tsx' export { PathLabel } from './PathLabel.tsx' export { MarqueeText, useHoverMarquee } from './Marquee.tsx' -export { HoverDetails } from './HoverDetails.tsx' -export type { HoverDetailsProps } from './HoverDetails.tsx' export type { HoverMarquee, MarqueeTextProps } from './Marquee.tsx' export { Switch } from './Switch.tsx' export { SegmentedControl } from './SegmentedControl.tsx' diff --git a/packages/client/ui-primitives/tests/hover-details.client.spec.tsx b/packages/client/ui-primitives/tests/hover-details.client.spec.tsx deleted file mode 100644 index 01d57183d4..0000000000 --- a/packages/client/ui-primitives/tests/hover-details.client.spec.tsx +++ /dev/null @@ -1,35 +0,0 @@ -// @vitest-environment jsdom -import { cleanup, render, screen } from '@testing-library/react' -import { afterEach, describe, expect, it } from 'vitest' -import { HoverDetails } from '@deepseek-ai/dsh-client-ui-primitives' - -afterEach(cleanup) - -describe('HoverDetails', () => { - it('stacks the title, lines, state, and measures in order', () => { - const view = render( - , label: '3.3M tok' }, { icon: , label: '6m 56s' }]} - />, - ) - const root = view.container.querySelector('[data-hover-details]') as HTMLElement - expect([...root.children].map(child => child.textContent)) - .toEqual(['Survey open-source harnesses', 'Owner: open-source-arch', 'Completed', '3.3M tok6m 56s']) - expect(root.children[2]?.querySelector('[data-state="done"]')).not.toBeNull() - expect(screen.getByTestId('tokens').parentElement?.getAttribute('aria-hidden')).toBe('true') - }) - - it('renders only the title when nothing else is given', () => { - const view = render() - expect((view.container.querySelector('[data-hover-details]') as HTMLElement).children).toHaveLength(1) - }) - - it('starts with the lines when the title is omitted', () => { - const view = render() - expect([...(view.container.querySelector('[data-hover-details]') as HTMLElement).children].map(child => child.textContent)) - .toEqual(['bash', 'running']) - }) -}) diff --git a/packages/client/ui-session-panel/README.i18n.yaml b/packages/client/ui-session-panel/README.i18n.yaml index fb39002e37..b2577faa28 100644 --- a/packages/client/ui-session-panel/README.i18n.yaml +++ b/packages/client/ui-session-panel/README.i18n.yaml @@ -21,11 +21,11 @@ en: 67b33b9f412a687d zh: 2a9b8c89c8bb22e4 /deepseek-ai-dsh-client-ui-session-panel/use-this-package/contribute-a-section: - en: d3ac82caeb26cf10 - zh: 58e56d35f6f9c8da + en: b76852d8740aee0f + zh: ccfeb7774e1b0e27 /deepseek-ai-dsh-client-ui-session-panel/understand-the-implementation: - en: c07801d6f61a5868 - zh: d04b6cdff989018a + en: ede595ecc4aab24a + zh: 5a30a4042ab7483a /deepseek-ai-dsh-client-ui-session-panel/further-exploration: en: 09b403af819bd155 zh: e949998de4794393 diff --git a/packages/client/ui-session-panel/README.md b/packages/client/ui-session-panel/README.md index 32954197d7..43ba71d18e 100644 --- a/packages/client/ui-session-panel/README.md +++ b/packages/client/ui-session-panel/README.md @@ -61,6 +61,8 @@ Leave out a part the row does not have: a `
) - const details = ( - value !== undefined).join(' · ') }} - facts={[ - ...tokenMetric === undefined ? [] : [{ icon: , label: tokenMetric }], - ...durationMetric === undefined ? [] : [{ icon: , label: durationMetric.exact }], - ]} - /> - ) + const details = panelDetails?.({ + title: primaryLabel, + lines: secondaryLabel === undefined ? [] : [t('hover.owner', { name: secondaryLabel })], + status: { state: dotState, label: [activity, mode].filter(value => value !== undefined).join(' · ') }, + facts: [ + ...tokenMetric === undefined ? [] : [{ kind: 'tokens' as const, label: tokenMetric }], + ...durationMetric === undefined ? [] : [{ kind: 'duration' as const, label: durationMetric.exact }], + ], + }) return (
@@ -438,7 +436,7 @@ function CatalogRows({ refreshProjection={refreshProjection} toggleBranch={toggleBranch} closeCatalog={closeCatalog} - dense={dense} + panelDetails={panelDetails} t={t} />
@@ -521,8 +519,12 @@ export interface CatalogTreeProps { onOpened: () => void /** Focus the first row on mount, as a keyboard-opened popover does. */ focusFirst?: boolean - /** One-line rows whose name, owner, state, and measures show in a hover card, as the Session panel lists them. */ - dense?: boolean + /** + * Renders the Session panel's row details. With it the tree lists one-line + * rows, as the Session panel does, and each row shows its name, owner, + * state, and measures in a hover card. + */ + panelDetails?: ((details: PanelDetailsProps) => ReactNode) | undefined t: TranslateNS } @@ -535,7 +537,7 @@ export interface CatalogTreeProps { */ export function CatalogTree({ rootSessionId, currentSessionId, catalog, catalogs, summaries, - openChild, openChildAside, prepareLevel, onOpened, focusFirst = false, dense = false, t, + openChild, openChildAside, prepareLevel, onOpened, focusFirst = false, panelDetails, t, }: CatalogTreeProps) { const [expanded, setExpanded] = useState>(() => new Set()) const treeRef = useRef(null) @@ -592,7 +594,7 @@ export function CatalogTree({ refreshProjection={prepareLevel} toggleBranch={toggleBranch} closeCatalog={onOpened} - dense={dense} + panelDetails={panelDetails} t={t} /> diff --git a/packages/client/ui-subagent/src/client/SubagentsSection.tsx b/packages/client/ui-subagent/src/client/SubagentsSection.tsx index ddf3f8866a..deb1492470 100644 --- a/packages/client/ui-subagent/src/client/SubagentsSection.tsx +++ b/packages/client/ui-subagent/src/client/SubagentsSection.tsx @@ -1,9 +1,9 @@ /** Session panel section listing the current Session's subagents. */ -import { useMemo } from 'react' +import { useCallback, useMemo } from 'react' import { HoverCardGroup } from '@deepseek-ai/dsh-client-ui-primitives' import type { InjectFace, PropsLocale, PropsRenderFactories, PropsRuntime, PropsStore } from '@deepseek-ai/dsh-client-ui-slots' import type { NS } from './locales.ts' -import type {} from '@deepseek-ai/dsh-client-ui-session-panel/client' +import type { PanelDetailsProps } from '@deepseek-ai/dsh-client-ui-session-panel/client' import { CatalogTree, deriveCatalogs, levelPreparer, progressOf, type Catalogs, type SubagentCatalogInjected, type SubagentCatalogSnapshot, } from './SubagentCatalog.tsx' @@ -100,6 +100,9 @@ export function SubagentsSection({ const catalog = catalogs[sessionId] const unfolded = useStore(state => state.unfolded) const prepareLevel = useMemo(() => levelPreparer(prepareCatalog), [prepareCatalog]) + const panelDetails = useCallback( + (details: PanelDetailsProps) => renderFactorySlot('conversation.session.panel.details', details), [renderFactorySlot], + ) const ordered = useMemo(() => catalog === undefined ? NO_ENTRIES : sectionOrder(catalog.entries, summaries), [catalog, summaries]) // Folding holds back two rows or more, since the fold control takes a row itself. const foldable = ordered.length > FOLD_LIMIT + 1 @@ -122,7 +125,7 @@ export function SubagentsSection({ openChildAside={openChildAside} prepareLevel={prepareLevel} onOpened={dismissOverlay} - dense + panelDetails={panelDetails} t={t} /> diff --git a/packages/client/ui-subagent/tests/conversation-ui.client.spec.tsx b/packages/client/ui-subagent/tests/conversation-ui.client.spec.tsx index f342284d62..a13821a1c8 100644 --- a/packages/client/ui-subagent/tests/conversation-ui.client.spec.tsx +++ b/packages/client/ui-subagent/tests/conversation-ui.client.spec.tsx @@ -18,6 +18,7 @@ import { import { SubagentReadOnlyComposer } from '../src/client/SubagentReadOnlyComposer.tsx' import { createSubagentsSectionStore } from '../src/client/subagents-store.ts' import { en, zh } from '../src/client/locales.ts' +import type { PanelDetailsProps, PanelFoldProps } from '@deepseek-ai/dsh-client-ui-session-panel/client' afterEach(() => { cleanup() @@ -188,7 +189,7 @@ async function hoverDetailsOf(row: HTMLElement): Promise { const anchor = row.parentElement as HTMLElement fireEvent.pointerEnter(anchor, { pointerType: 'mouse' }) await act(async () => { await vi.advanceTimersByTimeAsync(500) }) - const card = document.querySelector('[data-hover-details]') + const card = document.querySelector('[data-session-panel-details]') const lines = card === null ? null : [...card.children].map(child => child.textContent ?? '') fireEvent.pointerLeave(anchor, { pointerType: 'mouse' }) await act(async () => { await vi.advanceTimersByTimeAsync(400) }) @@ -210,11 +211,23 @@ function HeaderCatalog({ store, ...props }: HeaderCatalogProps) { } /** - * The Session panel's fold control Factory as these suites render it: a button with its state, name, and label. - * ui-session-panel's own suite owns the control's markup. + * The Session panel's Factories as these suites render them: the fold control as a button with its state, name, and + * label, and a row's details as one element per part in order. ui-session-panel's own suite owns their markup. */ -function renderFold(_name: string, input: { expanded: boolean; label: string; name: string; onToggle: () => void }) { - return +function renderPanelFactory(name: string, input: object) { + if (name === 'conversation.session.panel.details') { + const { title, lines = [], status, facts = [] } = input as PanelDetailsProps + return ( +
+ {title !== undefined &&
{title}
} + {lines.map(line =>
{line}
)} + {status !== undefined &&
{status.label}
} + {facts.length > 0 &&
{facts.map(fact => {fact.label})}
} +
+ ) + } + const fold = input as PanelFoldProps + return } /** The section with the panel owner values, its Session's store (a fresh one unless given), and the fold control. */ @@ -222,7 +235,7 @@ function Section({ store, dismissOverlay, ...props }: Omit store ?? createSubagentsSectionStore().create()) const [useStore] = useState(() => bindSnapshotSelector(own)) const sectionProps = { - ...props, presentation: 'docked', dismissOverlay: dismissOverlay ?? vi.fn(), useStore, actions: own.actions, renderFactorySlot: renderFold, + ...props, presentation: 'docked', dismissOverlay: dismissOverlay ?? vi.fn(), useStore, actions: own.actions, renderFactorySlot: renderPanelFactory, } as SubagentsSectionProps return } diff --git a/packages/extensions/cordis-client-runner/src/client/slot-catalog.ts b/packages/extensions/cordis-client-runner/src/client/slot-catalog.ts index 48f709755a..c878484faf 100644 --- a/packages/extensions/cordis-client-runner/src/client/slot-catalog.ts +++ b/packages/extensions/cordis-client-runner/src/client/slot-catalog.ts @@ -2465,7 +2465,7 @@ export const CLIENT_SLOT_API: readonly ClientSlotEntry[] = [ ], replaceRisk: 'none', example: 'return {\n inject: [\'slots\'],\n apply(ctx) {\n ctx.slots.inject(\'conversation.session.panel.environment.row\', () => ctx.slots.register(\n { name: \'conversation.session.panel.environment.row\', id: \'my-entry\', order: 100, label: \'My entry\' },\n () => React.createElement(\'div\', null, \'hello\'),\n ))\n },\n}', - source: 'packages/client/ui-session-panel/src/client/slots.ts:44', + source: 'packages/client/ui-session-panel/src/client/slots.ts:45', }, { key: 'conversation.session.panel.indicator', @@ -2529,7 +2529,7 @@ export const CLIENT_SLOT_API: readonly ClientSlotEntry[] = [ ], replaceRisk: 'none', example: 'return {\n inject: [\'slots\'],\n apply(ctx) {\n ctx.slots.inject(\'conversation.session.panel.indicator\', () => ctx.slots.register(\n { name: \'conversation.session.panel.indicator\', id: \'my-entry\', order: 100, label: \'My entry\' },\n () => React.createElement(\'div\', null, \'hello\'),\n ))\n },\n}', - source: 'packages/client/ui-session-panel/src/client/slots.ts:37', + source: 'packages/client/ui-session-panel/src/client/slots.ts:38', }, { key: 'conversation.session.panel.section', @@ -2597,7 +2597,7 @@ export const CLIENT_SLOT_API: readonly ClientSlotEntry[] = [ ], replaceRisk: 'none', example: 'return {\n inject: [\'slots\'],\n apply(ctx) {\n ctx.slots.inject(\'conversation.session.panel.section\', () => ctx.slots.register(\n { name: \'conversation.session.panel.section\', id: \'my-entry\', order: 100, label: \'My entry\' },\n () => React.createElement(\'div\', null, \'hello\'),\n ))\n },\n}', - source: 'packages/client/ui-session-panel/src/client/slots.ts:22', + source: 'packages/client/ui-session-panel/src/client/slots.ts:23', }, { key: 'conversation.session.panel.section.actions', @@ -2647,7 +2647,7 @@ export const CLIENT_SLOT_API: readonly ClientSlotEntry[] = [ ], replaceRisk: 'shadows-shipped-ui', example: 'return {\n inject: [\'slots\'],\n apply(ctx) {\n ctx.slots.inject(\'conversation.session.panel.section.actions\', () => ctx.slots.register(\n { name: \'conversation.session.panel.section.actions\', key: \'\' },\n () => React.createElement(\'div\', null, \'hello\'),\n ))\n },\n}', - source: 'packages/client/ui-session-panel/src/client/slots.ts:28', + source: 'packages/client/ui-session-panel/src/client/slots.ts:29', }, { key: 'conversation.trajectory.images',