🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
💄 style(verify,task): trim the verify card and run drawer header (#21609)
Arvin Xu71aeb7618758
diff --git a/src/features/Acceptance/Run/CheckerDock.tsx b/src/features/Acceptance/Run/CheckerDock.tsxindex 854ac3a92dc..28779bb03a7 100644--- a/src/features/Acceptance/Run/CheckerDock.tsx+++ b/src/features/Acceptance/Run/CheckerDock.tsx@@ -214,7 +214,6 @@ const CheckerDock = memo<CheckerDockProps>(({ operationId, embedded }) => {const renderCheckRow = (item: VerifyCheckItem) => {const result = resultByItem.get(item.id);const sIcon = statusIcon(result?.status);- const evidence = result?.toulmin?.reasoning || result?.suggestion;return (<divclassName={cx(styles.checkRow, styles.clickable)}@@ -234,12 +233,11 @@ const CheckerDock = memo<CheckerDockProps>(({ operationId, embedded }) => {) : (<Icon color={cssVar[sIcon.color]} icon={sIcon.icon} size={16} spin={sIcon.spin} />)}- <Flexbox style={{ minWidth: 0 }}>- <span className={styles.title} style={{ fontWeight: 600 }}>- {item.title}- </span>- {evidence && <span className={styles.desc}>{evidence}</span>}- </Flexbox>+ {/* Title only: the judge's reasoning is long and buries the verdicts;+ it lives in the result detail opened by clicking the row. */}+ <span className={styles.title} style={{ fontWeight: 600, minWidth: 0 }}>+ {item.title}+ </span><IconclassName={styles.chevron}icon={ChevronRight}diff --git a/src/features/AgentTasks/AgentTaskDetail/TopicChatDrawer/TopicRuntimeConfig.test.tsx b/src/features/AgentTasks/AgentTaskDetail/TopicChatDrawer/TopicRuntimeConfig.test.tsxdeleted file mode 100644index 4090339dd27..00000000000--- a/src/features/AgentTasks/AgentTaskDetail/TopicChatDrawer/TopicRuntimeConfig.test.tsx+++ /dev/null@@ -1,194 +0,0 @@-import type { ChatTopic } from '@lobechat/types';-import { fireEvent, render, screen, waitFor } from '@testing-library/react';-import { beforeEach, describe, expect, it, vi } from 'vitest';--import type { AgentStoreState } from '@/store/agent/initialState';-import { initialState as initialAgentState } from '@/store/agent/initialState';-import type { ChatStoreState } from '@/store/chat/initialState';-import { initialState as initialChatState } from '@/store/chat/initialState';--import { TopicRuntimeConfig } from './TopicRuntimeConfig';--const fixture = vi.hoisted(() => ({- agent: {} as AgentStoreState,- chat: {} as ChatStoreState,- revalidate: vi.fn().mockResolvedValue(undefined),- useFetchTopicDetail: vi.fn(),-}));--vi.mock('@/store/agent', () => ({- useAgentStore: <T,>(selector: (state: AgentStoreState) => T) => selector(fixture.agent),-}));-vi.mock('@/store/chat', () => ({- useChatStore: <T,>(- selector: (- state: ChatStoreState & {- useFetchTopicDetail: typeof fixture.useFetchTopicDetail;- },- ) => T,- ) =>- selector({- ...fixture.chat,- useFetchTopicDetail: fixture.useFetchTopicDetail,- }),-}));--describe('TopicRuntimeConfig', () => {- beforeEach(() => {- fixture.revalidate.mockClear();- fixture.useFetchTopicDetail.mockReset();- fixture.useFetchTopicDetail.mockReturnValue({ revalidate: fixture.revalidate });- fixture.agent = {- ...initialAgentState,- agentMap: {- assignee: {- agencyConfig: { heterogeneousProvider: { model: 'gpt-5.5', type: 'codex' } },- },- },- };- fixture.chat = { ...initialChatState, topicDetailMap: {} };- });-- it('hydrates a cold run and preserves its receipt after Agent configuration changes', () => {- const { rerender } = render(<TopicRuntimeConfig agentId={'assignee'} topicId={'run-1'} />);- expect(fixture.useFetchTopicDetail).toHaveBeenCalledWith('run-1');- expect(screen.queryByRole('button')).not.toBeInTheDocument();-- fixture.chat.topicDataMap.agent_assignee = {- currentPage: 1,- hasMore: false,- pageSize: 20,- total: 1,- items: [{ id: 'run-1', model: 'gpt-5.5', provider: 'codex' } as ChatTopic],- };- fixture.chat.topicDetailMap['run-1'] = {- id: 'run-1',- metadata: {- heteroRuntimeConfig: {- fields: [- { key: 'runtime', source: 'agent', value: 'codex' },- { key: 'model', source: 'topic', value: 'gpt-5.4' },- { key: 'effort', source: 'topic', value: 'low' },- { key: 'speed', source: 'agent', value: 'fast' },- ],- operationId: 'operation-1',- },- },- } as ChatTopic;- fixture.agent.agentMap.assignee = {};- rerender(<TopicRuntimeConfig agentId={'assignee'} topicId={'run-1'} />);- fireEvent.click(screen.getByRole('button', { name: 'taskDetail.runtimeConfig.title' }));- expect(screen.getByText('gpt-5.4', { exact: true })).toBeInTheDocument();- expect(screen.getAllByText('taskDetail.runtimeConfig.source.topic')).toHaveLength(2);- expect(screen.getByText('taskDetail.runtimeConfig.runScope')).toBeInTheDocument();- });-- /** @example A continued Task on the same Topic replaces op1's receipt with op2's receipt. */- it('refreshes a mounted Topic inspector when the displayed operation changes', async () => {- // ROOT CAUSE:- //- // TaskRunner continuations keep the same Topic ID. Its detail fetch therefore- // stayed mounted with the old receipt after Task activity advanced to a new run.- // Revalidate on the run change, then display the newest persisted Topic receipt.- fixture.chat.topicDetailMap['run-1'] = {- id: 'run-1',- metadata: {- heteroRuntimeConfig: {- operationId: 'operation-1',- fields: [{ key: 'model', source: 'task', value: 'gpt-5.4' }],- },- },- } as ChatTopic;- const { rerender } = render(- <TopicRuntimeConfig agentId={'assignee'} operationId={'operation-1'} topicId={'run-1'} />,- );- fireEvent.click(screen.getByRole('button', { name: 'taskDetail.runtimeConfig.title' }));- /** @example The current operation's persisted receipt is visible. */- expect(screen.getByText('gpt-5.4', { exact: true })).toBeInTheDocument();- rerender(- <TopicRuntimeConfig agentId={'assignee'} operationId={'operation-2'} topicId={'run-1'} />,- );- /** @example A same-Topic continuation revalidates the mounted by-id SWR entry once. */- await waitFor(() => expect(fixture.revalidate).toHaveBeenCalledTimes(1));- expect(fixture.useFetchTopicDetail).toHaveBeenLastCalledWith('run-1');- fixture.chat.topicDetailMap['run-1'] = {- id: 'run-1',- metadata: {- heteroRuntimeConfig: {- operationId: 'operation-2',- fields: [{ key: 'model', source: 'task', value: 'gpt-5.5' }],- },- },- } as ChatTopic;- rerender(- <TopicRuntimeConfig agentId={'assignee'} operationId={'operation-2'} topicId={'run-1'} />,- );- /** @example The refreshed receipt shows the new effective native model. */- expect(screen.getByText('gpt-5.5', { exact: true })).toBeInTheDocument();- });-- /** @example A drawer follow-up writes op2 while the Task association still points to op1. */- it('keeps the latest Topic receipt visible after a follow-up settles', () => {- // ROOT CAUSE:- //- // Ordinary drawer follow-ups update the Topic receipt without running TaskRunner.- // The Task activity can keep op1 while the Topic has op2. Treating that activity- // ID as a receipt filter would hide the actual follow-up configuration forever.- fixture.chat.topicDetailMap['run-1'] = {- id: 'run-1',- metadata: {- heteroRuntimeConfig: {- operationId: 'operation-2',- fields: [{ key: 'model', source: 'topic', value: 'gpt-5.5' }],- },- },- } as ChatTopic;- const { rerender } = render(- <TopicRuntimeConfig agentId={'assignee'} operationId={'operation-2'} topicId={'run-1'} />,- );- rerender(- <TopicRuntimeConfig agentId={'assignee'} operationId={'operation-1'} topicId={'run-1'} />,- );- fireEvent.click(screen.getByRole('button', { name: 'taskDetail.runtimeConfig.title' }));- /** @example Clearing the running marker must not hide op2's native model. */- expect(screen.getByText('gpt-5.5', { exact: true })).toBeInTheDocument();- fixture.revalidate.mockClear();- fixture.chat.topicDetailMap['run-1'] = {- ...fixture.chat.topicDetailMap['run-1'],- metadata: {- heteroRuntimeConfig: {- operationId: 'operation-3',- fields: [{ key: 'model', source: 'topic', value: 'gpt-5.4' }],- },- },- } as ChatTopic;- rerender(- <TopicRuntimeConfig agentId={'assignee'} operationId={'operation-1'} topicId={'run-1'} />,- );- /** @example Receipt updates do not create a revalidation loop. */- expect(fixture.revalidate).not.toHaveBeenCalled();- /** @example The by-id Topic remains the receipt source of truth. */- expect(screen.getByText('gpt-5.4', { exact: true })).toBeInTheDocument();- });-- it('previews fetched Topic pins instead of an older list snapshot', () => {- fixture.chat.topicDataMap.agent_assignee = {- currentPage: 1,- hasMore: false,- pageSize: 20,- total: 1,- items: [{ id: 'run-1', model: 'gpt-5.5', provider: 'codex' } as ChatTopic],- };- fixture.chat.topicDetailMap['run-1'] = {- id: 'run-1',- model: 'gpt-5.4',- provider: 'codex',- metadata: { heteroEffort: 'low' },- } as ChatTopic;- render(<TopicRuntimeConfig agentId={'assignee'} topicId={'run-1'} />);- fireEvent.click(screen.getByRole('button', { name: 'taskDetail.runtimeConfig.title' }));- expect(screen.getByText('gpt-5.4', { exact: true })).toBeInTheDocument();- expect(screen.getByText('low', { exact: true })).toBeInTheDocument();- expect(screen.getByText('taskDetail.runtimeConfig.topicScope')).toBeInTheDocument();- });-});diff --git a/src/features/AgentTasks/AgentTaskDetail/TopicChatDrawer/TopicRuntimeConfig.tsx b/src/features/AgentTasks/AgentTaskDetail/TopicChatDrawer/TopicRuntimeConfig.tsxdeleted file mode 100644index d88e3bd09ef..00000000000--- a/src/features/AgentTasks/AgentTaskDetail/TopicChatDrawer/TopicRuntimeConfig.tsx+++ /dev/null@@ -1,79 +0,0 @@-import { resolveHeterogeneousRuntimeConfig } from '@lobechat/types';-import isEqual from 'fast-deep-equal';-import { useEffect, useRef } from 'react';--import { useAgentStore } from '@/store/agent';-import { agentByIdSelectors } from '@/store/agent/selectors';-import { useChatStore } from '@/store/chat';-import { resolveTopicHeteroPin, topicSelectors } from '@/store/chat/slices/topic/selectors';--import { HeterogeneousTaskConfig } from '../HeterogeneousTaskConfig';--/** The explicit owner and Topic of a Task run drawer. */-interface TopicRuntimeConfigProps {- /** The run's actual assignee, including descendant Task runs. */- agentId: string;- /** A run change that requests fresh Topic details; follow-ups may write a newer receipt. */- operationId?: string | null;- /** The run being inspected; unrelated active chat state is never consulted. */- topicId: string;-}--/**- * Shows the selected Task Topic's runtime configuration after its snapshot loads.- *- * Use when:- * - Inspecting a run in a Task drawer or embedded run conversation.- *- * Expects:- * - The explicit Topic ID; the by-id hook hydrates cold Task drawer caches.- *- * Returns:- * - The Topic-scoped inspector, or nothing while its data is unavailable.- */-export const TopicRuntimeConfig = ({ agentId, operationId, topicId }: TopicRuntimeConfigProps) => {- const useFetchTopicDetail = useChatStore((s) => s.useFetchTopicDetail);- const { revalidate } = useFetchTopicDetail(topicId);-- const provider = useAgentStore(- (s) => agentByIdSelectors.getAgencyConfigById(agentId)(s)?.heterogeneousProvider,- isEqual,- );- // The run inspector fetches current details; a list row may predate its receipt.- const topic = useChatStore(- (s) => s.topicDetailMap[topicId] ?? topicSelectors.getTopicById(topicId)(s),- isEqual,- );- const receipt = topic?.metadata?.heteroRuntimeConfig;- // A run this client did not dispatch (a scheduled Task run, another tab) writes- // a newer receipt under the same Topic ID. The by-id SWR entry above already- // loads on mount; revalidate that same entry only when the run changes.- const seenOperation = useRef({ operationId, topicId });- useEffect(() => {- const seen = seenOperation.current;- if (seen.topicId !== topicId) {- seenOperation.current = { operationId, topicId };- return;- }- if (!operationId || seen.operationId === operationId) return;- seenOperation.current = { operationId, topicId };- void revalidate().catch((error) => {- console.error('Failed to refresh Task run configuration', error);- });- }, [operationId, revalidate, topicId]);-- // Task continuations change activity IDs; ordinary follow-ups can write a newer- // Topic receipt without changing that association. Always display the latest detail.- const pin = resolveTopicHeteroPin(topic);- if (receipt) {- return <HeterogeneousTaskConfig fields={receipt.fields} source={'run'} />;- }- if (!provider || !topic) return null;-- return (- <HeterogeneousTaskConfig- fields={resolveHeterogeneousRuntimeConfig(provider, pin, 'topic')}- source={'topic'}- />- );-};diff --git a/src/features/AgentTasks/AgentTaskDetail/TopicChatDrawer/index.test.tsx b/src/features/AgentTasks/AgentTaskDetail/TopicChatDrawer/index.test.tsxindex 441553f747e..92fbf2c64a9 100644--- a/src/features/AgentTasks/AgentTaskDetail/TopicChatDrawer/index.test.tsx+++ b/src/features/AgentTasks/AgentTaskDetail/TopicChatDrawer/index.test.tsx@@ -27,8 +27,6 @@ const mocks = vi.hoisted(() => ({showPortal: false,topicDataMap: {},topicDetailMap: {},- revalidateTopicDetail: vi.fn().mockResolvedValue(undefined),- useFetchTopicDetail: vi.fn(),},permission: {allowed: true,@@ -273,11 +271,6 @@ describe('TopicChatDrawer', () => {beforeEach(() => {mocks.agentState.useHydrateAgentConfig.mockClear();mocks.chatState.replaceMessages.mockClear();- mocks.chatState.revalidateTopicDetail.mockClear();- mocks.chatState.useFetchTopicDetail.mockReset();- mocks.chatState.useFetchTopicDetail.mockReturnValue({- revalidate: mocks.chatState.revalidateTopicDetail,- });mocks.chatState.portalStack = [];mocks.chatState.showPortal = false;mocks.chatState.closeArtifact.mockClear();@@ -331,24 +324,6 @@ describe('TopicChatDrawer', () => {);});- /** @example A completed same-Topic continuation still refreshes the receipt. */- it('passes completed operation changes from Task activity into the run inspector', () => {- mocks.taskState.taskDetailMap['T-1'].activities[0].operationId = 'op-first';- const { rerender } = render(- <TopicChatDrawerBody agentId={'agt_assignee'} topicId={'topic-1'} />,- );- /** @example The mount itself loads through the by-id SWR entry. */- expect(mocks.chatState.revalidateTopicDetail).not.toHaveBeenCalled();- mocks.taskState.taskDetailMap['T-1'].activities[0].operationId = 'op-completed';- // The memoized body re-renders when its store subscription changes; a prop- // change stands in for that subscription here.- rerender(- <TopicChatDrawerBody disableInputCollapse agentId={'agt_assignee'} topicId={'topic-1'} />,- );- /** @example No running marker is required to invalidate an older cached receipt. */- expect(mocks.chatState.revalidateTopicDetail).toHaveBeenCalledTimes(1);- });-/** @example Embedded Topic B never reconnects against active drawer Topic A. */it('keeps embedded operation context separate from an unrelated active drawer', () => {mocks.taskState.taskDetailMap['T-1'].activities[0].runningOperation = {@@ -361,8 +336,6 @@ describe('TopicChatDrawer', () => {);/** @example An unrelated active drawer supplies no fallback operation. */expect(useGatewayReconnect).toHaveBeenLastCalledWith('topic-2', undefined, 'embedded-agent');- /** @example No unrelated operation triggers a receipt refresh for Topic B. */- expect(mocks.chatState.revalidateTopicDetail).not.toHaveBeenCalled();const runningOperation = {assistantMessageId: 'ast-2',heteroType: 'codex',@@ -375,22 +348,18 @@ describe('TopicChatDrawer', () => {topicId={'topic-2'}/>,);- /** @example An explicit embedded run owns both streaming and receipt context. */+ /** @example An explicit embedded run owns its streaming context. */expect(useGatewayReconnect).toHaveBeenLastCalledWith('topic-2',runningOperation,'embedded-agent',);- /** @example The embedded run refreshes its own Topic's receipt. */- expect(mocks.chatState.revalidateTopicDetail).toHaveBeenCalledTimes(1);- expect(mocks.chatState.useFetchTopicDetail).toHaveBeenLastCalledWith('topic-2');});it('hydrates the task assignee agent config for drawer messages', () => {render(<TopicChatDrawer />);expect(mocks.agentState.useHydrateAgentConfig).toHaveBeenCalledWith(true, 'agt_assignee');- expect(mocks.chatState.useFetchTopicDetail).toHaveBeenCalledWith('topic-1');});it('keeps the floating drawer reply input collapsed by default', () => {diff --git a/src/features/AgentTasks/AgentTaskDetail/TopicChatDrawer/index.tsx b/src/features/AgentTasks/AgentTaskDetail/TopicChatDrawer/index.tsxindex e5fbd19de48..a015e8ef395 100644--- a/src/features/AgentTasks/AgentTaskDetail/TopicChatDrawer/index.tsx+++ b/src/features/AgentTasks/AgentTaskDetail/TopicChatDrawer/index.tsx@@ -52,7 +52,6 @@ import { isForbiddenError } from '@/utils/forbiddenError';import AssigneeAvatar from '../../features/AssigneeAvatar';import { useTopicDrawerArtifactPortal } from '../../hooks/useTopicDrawerArtifactPortal';import FeedbackInput from './FeedbackInput';-import { TopicRuntimeConfig } from './TopicRuntimeConfig';const SHARE_ICON_SIZE = { blockSize: 32, size: 16 } as const;const DEFAULT_PANEL_HEIGHT = 'min(640px, calc(100dvh - 16px))';@@ -72,8 +71,6 @@ export interface TopicChatDrawerBodyProps {drawer is opened with conversational intent (e.g. the brief's "Continuechat"). */inputFocusRequest?: number;- /** Latest operation for this Topic, retained after its running marker clears. */- operationId?: string | null;/*** The run to resume streaming from. Hosts that embed the body outside the* drawer pass it themselves; the drawer falls back to its own topic's run.@@ -84,7 +81,7 @@ export interface TopicChatDrawerBodyProps {}/**- * Renders a Task run conversation with its latest runtime receipt and follow-up composer.+ * Renders a Task run conversation with its follow-up composer.** Use when:* - Hosting the floating Task drawer or an embedded run conversation.@@ -101,7 +98,6 @@ export const TopicChatDrawerBody = memo<TopicChatDrawerBodyProps>(defaultInputExpanded,disableInputCollapse,inputFocusRequest,- operationId,runningOperation,topicId,}) => {@@ -127,11 +123,6 @@ export const TopicChatDrawerBody = memo<TopicChatDrawerBodyProps>(return activity?.id === topicId ? activity : undefined;});const currentRunningOperation = runningOperation ?? drawerActivity?.runningOperation;- const currentOperationId =- operationId ??- runningOperation?.operationId ??- drawerActivity?.runningOperation?.operationId ??- drawerActivity?.operationId;// Pass this drawer's agent explicitly — the run drawer also mounts on the// home surface, where the chat store's `activeAgentId` is unset.useGatewayReconnect(topicId, currentRunningOperation, agentId);@@ -145,13 +136,6 @@ export const TopicChatDrawerBody = memo<TopicChatDrawerBodyProps>(<ConversationProvider context={context} operationState={operationState}><TaskCardScopeProvider value={true}><Flexbox height={'100%'} style={{ overflow: 'hidden' }}>- <Flexbox align={'flex-start'} paddingInline={12}>- <TopicRuntimeConfig- agentId={agentId}- operationId={currentOperationId}- topicId={topicId}- />- </Flexbox><Flexbox flex={1} style={{ minHeight: 0, overflow: 'hidden' }}><ChatList disableActionsBar itemContent={itemContent} /></Flexbox>@@ -428,7 +412,6 @@ const TopicChatDrawer = memo(() => {<TopicChatDrawerBodyagentId={agentId!}inputFocusRequest={inputFocusRequest}- operationId={activity?.runningOperation?.operationId ?? activity?.operationId}runningOperation={activity?.runningOperation}topicId={topicId!}/>