Skip to content

🤯 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.

💄 style(task): polish editTask / runTask / setTaskVerify result cards (#16304)

Arvin Xu2889f762f80a
diff --git a/locales/en-US/plugin.json b/locales/en-US/plugin.json
index 67499b1936b..05075c6f915 100644
--- a/locales/en-US/plugin.json
+++ b/locales/en-US/plugin.json
@@ -361,11 +361,17 @@
"builtins.lobe-task.edit.rename": "rename",
"builtins.lobe-task.edit.unassign": "unassign",
"builtins.lobe-task.edit.unblocks": "unblocks",
+ "builtins.lobe-task.field.description": "Description",
+ "builtins.lobe-task.field.instruction": "Instruction",
"builtins.lobe-task.run.continueTopic": "continue topic",
+ "builtins.lobe-task.run.prompt": "Prompt",
+ "builtins.lobe-task.run.topic": "Topic",
"builtins.lobe-task.runTasks.count": "{{count}} tasks",
"builtins.lobe-task.runTasks.failedCount": "{{count}} failed",
"builtins.lobe-task.runTasks.more": "+{{count}} more",
"builtins.lobe-task.title": "Task Tools",
+ "builtins.lobe-task.verify.off": "Verify gate off",
+ "builtins.lobe-task.verify.on": "Verify gate on",
"builtins.lobe-topic-reference.apiName.getTopicContext": "Get Topic Context",
"builtins.lobe-topic-reference.title": "Topic Reference",
"builtins.lobe-user-interaction.apiName.askUserQuestion": "Ask user question",
diff --git a/locales/zh-CN/plugin.json b/locales/zh-CN/plugin.json
index ccbabc72e42..ae0e245ff00 100644
--- a/locales/zh-CN/plugin.json
+++ b/locales/zh-CN/plugin.json
@@ -361,11 +361,17 @@
"builtins.lobe-task.edit.rename": "重命名",
"builtins.lobe-task.edit.unassign": "取消指派",
"builtins.lobe-task.edit.unblocks": "移除依赖",
+ "builtins.lobe-task.field.description": "描述",
+ "builtins.lobe-task.field.instruction": "指令",
"builtins.lobe-task.run.continueTopic": "继续话题",
+ "builtins.lobe-task.run.prompt": "附加提示",
+ "builtins.lobe-task.run.topic": "话题",
"builtins.lobe-task.runTasks.count": "{{count}} 个任务",
"builtins.lobe-task.runTasks.failedCount": "{{count}} 个失败",
"builtins.lobe-task.runTasks.more": "还有 {{count}} 个",
"builtins.lobe-task.title": "任务工具",
+ "builtins.lobe-task.verify.off": "验收门已关闭",
+ "builtins.lobe-task.verify.on": "验收门已开启",
"builtins.lobe-topic-reference.apiName.getTopicContext": "获取话题上下文",
"builtins.lobe-topic-reference.title": "话题引用",
"builtins.lobe-user-interaction.apiName.askUserQuestion": "询问用户问题",
diff --git a/packages/builtin-tool-claude-code/src/client/Intervention/AskUserQuestion/index.tsx b/packages/builtin-tool-claude-code/src/client/Intervention/AskUserQuestion/index.tsx
index 2f21b35606b..20991d0e273 100644
--- a/packages/builtin-tool-claude-code/src/client/Intervention/AskUserQuestion/index.tsx
+++ b/packages/builtin-tool-claude-code/src/client/Intervention/AskUserQuestion/index.tsx
@@ -1,8 +1,7 @@
'use client';
import type { BuiltinInterventionProps } from '@lobechat/types';
-import { Button, Flexbox, Icon, Text, TextArea } from '@lobehub/ui';
-import { Tabs } from '@lobehub/ui/base-ui';
+import { Button, Flexbox, Icon, Tabs, Text, TextArea } from '@lobehub/ui';
import { createStaticStyles } from 'antd-style';
import { ArrowLeft, Check, PenLine, Send, X } from 'lucide-react';
import { memo } from 'react';
@@ -95,7 +94,7 @@ const AskUserQuestionIntervention = memo<BuiltinInterventionProps<AskUserQuestio
),
};
})}
- onChange={(key) => setActiveTab(key as string)}
+ onChange={(key: string) => setActiveTab(key)}
/>
)}
diff --git a/packages/builtin-tool-task/src/client/Inspector/SetTaskVerify/index.tsx b/packages/builtin-tool-task/src/client/Inspector/SetTaskVerify/index.tsx
index a3faeb13bb9..fa0e8ad63a1 100644
--- a/packages/builtin-tool-task/src/client/Inspector/SetTaskVerify/index.tsx
+++ b/packages/builtin-tool-task/src/client/Inspector/SetTaskVerify/index.tsx
@@ -23,22 +23,6 @@ const styles = createStaticStyles(({ css, cssVar }) => ({
background: ${cssVar.colorFillTertiary};
`,
- modeChip: css`
- flex-shrink: 0;
-
- padding-block: 2px;
- padding-inline: 8px;
- border-radius: 999px;
-
- font-size: 12px;
- color: ${cssVar.colorInfo};
-
- background: ${cssVar.colorInfoBg};
- `,
- separator: css`
- flex-shrink: 0;
- color: ${cssVar.colorTextQuaternary};
- `,
}));
export const SetTaskVerifyInspector = memo<
@@ -47,8 +31,6 @@ export const SetTaskVerifyInspector = memo<
const { t } = useTranslation('plugin');
const identifier = args?.identifier || partialArgs?.identifier;
- const enabled = args?.enabled ?? partialArgs?.enabled;
- const modeLabel = enabled === undefined ? undefined : enabled ? 'on' : 'off';
return (
<div
@@ -60,12 +42,6 @@ export const SetTaskVerifyInspector = memo<
>
<span>{t('builtins.lobe-task.apiName.setTaskVerify')}</span>
{identifier && <span className={styles.identifierChip}>{identifier}</span>}
- {modeLabel && (
- <>
- <span className={styles.separator}>·</span>
- <span className={styles.modeChip}>{modeLabel}</span>
- </>
- )}
</div>
);
});
diff --git a/packages/builtin-tool-task/src/client/Render/EditTask/index.tsx b/packages/builtin-tool-task/src/client/Render/EditTask/index.tsx
new file mode 100644
index 00000000000..d4718e383f5
--- /dev/null
+++ b/packages/builtin-tool-task/src/client/Render/EditTask/index.tsx
@@ -0,0 +1,155 @@
+'use client';
+
+import type { BuiltinRenderProps } from '@lobechat/types';
+import { Markdown, Text } from '@lobehub/ui';
+import { createStaticStyles } from 'antd-style';
+import { Pencil } from 'lucide-react';
+import { memo } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import TaskPriorityTag from '@/features/AgentTasks/features/TaskPriorityTag';
+
+import type { EditTaskParams, EditTaskState } from '../../../types';
+import {
+ AssigneeInline,
+ InlineField,
+ monoChipClassName,
+ SectionField,
+ TaskResultCard,
+} from '../shared';
+
+const styles = createStaticStyles(({ css, cssVar }) => ({
+ addChip: css`
+ padding-block: 1px;
+ padding-inline: 8px;
+ border-radius: 999px;
+
+ font-family: ${cssVar.fontFamilyCode};
+ font-size: 12px;
+ color: ${cssVar.colorSuccess};
+
+ background: ${cssVar.colorSuccessBg};
+ `,
+ deps: css`
+ display: inline-flex;
+ flex-wrap: wrap;
+ gap: 4px;
+ align-items: center;
+ `,
+ removeChip: css`
+ padding-block: 1px;
+ padding-inline: 8px;
+ border: 1px dashed ${cssVar.colorErrorBorder};
+ border-radius: 999px;
+
+ font-family: ${cssVar.fontFamilyCode};
+ font-size: 12px;
+ color: ${cssVar.colorError};
+ text-decoration: line-through;
+ `,
+}));
+
+export const EditTaskRender = memo<BuiltinRenderProps<EditTaskParams, EditTaskState>>(
+ ({ args, pluginState }) => {
+ const { t } = useTranslation('plugin');
+
+ const params = args ?? ({} as Partial<EditTaskParams>);
+ const identifier = pluginState?.identifier ?? params.identifier;
+
+ const hasName = params.name !== undefined;
+ const hasPriority = params.priority !== undefined;
+ const hasAssignee = params.assigneeAgentId !== undefined;
+ const hasParent = params.parentIdentifier !== undefined;
+ const hasInstruction = params.instruction !== undefined;
+ const hasDescription = params.description !== undefined;
+ const hasAddDeps = !!params.addDependencies?.length;
+ const hasRemoveDeps = !!params.removeDependencies?.length;
+
+ const hasAnyChange =
+ hasName ||
+ hasPriority ||
+ hasAssignee ||
+ hasParent ||
+ hasInstruction ||
+ hasDescription ||
+ hasAddDeps ||
+ hasRemoveDeps;
+
+ return (
+ <TaskResultCard
+ icon={Pencil}
+ identifier={identifier}
+ title={t('builtins.lobe-task.apiName.editTask')}
+ >
+ {hasAnyChange ? (
+ <>
+ {hasName && (
+ <InlineField label={t('builtins.lobe-task.edit.rename')}>{params.name}</InlineField>
+ )}
+ {hasPriority && (
+ <InlineField label={t('builtins.lobe-task.edit.priority')}>
+ <TaskPriorityTag disableDropdown priority={params.priority!} size={16} />
+ </InlineField>
+ )}
+ {hasAssignee && (
+ <InlineField label={t('builtins.lobe-task.edit.assign')}>
+ {params.assigneeAgentId === null ? (
+ <Text type={'secondary'}>{t('builtins.lobe-task.edit.unassign')}</Text>
+ ) : (
+ <AssigneeInline agentId={params.assigneeAgentId!} />
+ )}
+ </InlineField>
+ )}
+ {hasParent && (
+ <InlineField label={t('builtins.lobe-task.edit.parent')}>
+ {params.parentIdentifier === null ? (
+ <Text type={'secondary'}>{t('builtins.lobe-task.edit.parentClear')}</Text>
+ ) : (
+ <span className={monoChipClassName}>{params.parentIdentifier}</span>
+ )}
+ </InlineField>
+ )}
+ {hasInstruction && (
+ <SectionField label={t('builtins.lobe-task.field.instruction')}>
+ <Markdown fontSize={12} variant={'chat'}>
+ {params.instruction!}
+ </Markdown>
+ </SectionField>
+ )}
+ {hasDescription && (
+ <SectionField label={t('builtins.lobe-task.field.description')}>
+ {params.description}
+ </SectionField>
+ )}
+ {hasAddDeps && (
+ <InlineField label={t('builtins.lobe-task.edit.blocksOn')}>
+ <div className={styles.deps}>
+ {params.addDependencies!.map((dep) => (
+ <span className={styles.addChip} key={`add-${dep}`}>
+ {dep}
+ </span>
+ ))}
+ </div>
+ </InlineField>
+ )}
+ {hasRemoveDeps && (
+ <InlineField label={t('builtins.lobe-task.edit.unblocks')}>
+ <div className={styles.deps}>
+ {params.removeDependencies!.map((dep) => (
+ <span className={styles.removeChip} key={`remove-${dep}`}>
+ {dep}
+ </span>
+ ))}
+ </div>
+ </InlineField>
+ )}
+ </>
+ ) : null}
+ </TaskResultCard>
+ );
+ },
+);
+
+EditTaskRender.displayName = 'EditTaskRender';
+
+export default EditTaskRender;
diff --git a/packages/builtin-tool-task/src/client/Render/RunTask/index.tsx b/packages/builtin-tool-task/src/client/Render/RunTask/index.tsx
new file mode 100644
index 00000000000..b9a0077846c
--- /dev/null
+++ b/packages/builtin-tool-task/src/client/Render/RunTask/index.tsx
@@ -0,0 +1,76 @@
+'use client';
+
+import type { BuiltinRenderProps } from '@lobechat/types';
+import { Markdown } from '@lobehub/ui';
+import { createStaticStyles, cssVar } from 'antd-style';
+import { Play } from 'lucide-react';
+import { memo } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import type { RunTaskParams, RunTaskState } from '../../../types';
+import { InlineField, monoChipClassName, SectionField, TaskResultCard } from '../shared';
+
+const styles = createStaticStyles(({ css, cssVar }) => ({
+ topicChip: css`
+ display: inline-flex;
+ gap: 4px;
+ align-items: center;
+ align-self: flex-start;
+
+ padding-block: 2px;
+ padding-inline: 8px;
+ border-radius: 999px;
+
+ font-size: 12px;
+ color: ${cssVar.colorInfo};
+
+ background: ${cssVar.colorInfoBg};
+ `,
+}));
+
+export const RunTaskRender = memo<BuiltinRenderProps<RunTaskParams, RunTaskState>>(
+ ({ args, pluginState }) => {
+ const { t } = useTranslation('plugin');
+
+ const params = args ?? ({} as Partial<RunTaskParams>);
+ const identifier = pluginState?.identifier ?? params.identifier;
+ const prompt = params.prompt;
+ const continueTopic = !!params.continueTopicId;
+ const topicId = pluginState?.topicId;
+
+ const hasBody = !!prompt || continueTopic || !!topicId;
+
+ return (
+ <TaskResultCard
+ icon={Play}
+ iconColor={cssVar.colorWarning}
+ identifier={identifier}
+ title={t('builtins.lobe-task.apiName.runTask')}
+ >
+ {hasBody ? (
+ <>
+ {continueTopic && (
+ <span className={styles.topicChip}>{t('builtins.lobe-task.run.continueTopic')}</span>
+ )}
+ {prompt && (
+ <SectionField label={t('builtins.lobe-task.run.prompt')}>
+ <Markdown fontSize={12} variant={'chat'}>
+ {prompt}
+ </Markdown>
+ </SectionField>
+ )}
+ {topicId && (
+ <InlineField label={t('builtins.lobe-task.run.topic')}>
+ <span className={monoChipClassName}>{topicId}</span>
+ </InlineField>
+ )}
+ </>
+ ) : null}
+ </TaskResultCard>
+ );
+ },
+);
+
+RunTaskRender.displayName = 'RunTaskRender';
+
+export default RunTaskRender;
diff --git a/packages/builtin-tool-task/src/client/Render/SetTaskVerify/index.tsx b/packages/builtin-tool-task/src/client/Render/SetTaskVerify/index.tsx
new file mode 100644
index 00000000000..5b39f9a1ecb
--- /dev/null
+++ b/packages/builtin-tool-task/src/client/Render/SetTaskVerify/index.tsx
@@ -0,0 +1,85 @@
+'use client';
+
+import type { BuiltinRenderProps } from '@lobechat/types';
+import { Icon, Markdown } from '@lobehub/ui';
+import { createStaticStyles, cssVar } from 'antd-style';
+import { Check, ShieldCheck, X } from 'lucide-react';
+import { memo } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import type { SetTaskVerifyParams, SetTaskVerifyState } from '../../../types';
+import { TaskResultCard } from '../shared';
+
+const styles = createStaticStyles(({ css, cssVar }) => ({
+ offBadge: css`
+ display: inline-flex;
+ flex-shrink: 0;
+ gap: 4px;
+ align-items: center;
+
+ padding-block: 2px;
+ padding-inline: 8px;
+ border-radius: 999px;
+
+ font-size: 12px;
+ color: ${cssVar.colorTextTertiary};
+
+ background: ${cssVar.colorFillTertiary};
+ `,
+ onBadge: css`
+ display: inline-flex;
+ flex-shrink: 0;
+ gap: 4px;
+ align-items: center;
+
+ padding-block: 2px;
+ padding-inline: 8px;
+ border-radius: 999px;
+
+ font-size: 12px;
+ color: ${cssVar.colorSuccess};
+
+ background: ${cssVar.colorSuccessBg};
+ `,
+}));
+
+export const SetTaskVerifyRender = memo<
+ BuiltinRenderProps<SetTaskVerifyParams, SetTaskVerifyState>
+>(({ args, pluginState }) => {
+ const { t } = useTranslation('plugin');
+
+ const params = args ?? ({} as Partial<SetTaskVerifyParams>);
+ const identifier = pluginState?.identifier ?? params.identifier;
+ const enabled = pluginState?.enabled ?? params.enabled;
+ const requirement = params.requirement;
+ const showStatus = enabled === true || enabled === false;
+
+ // The on/off state lives in the header; the body is just the acceptance
+ // requirement rendered as markdown.
+ const statusBadge = showStatus ? (
+ <span className={enabled ? styles.onBadge : styles.offBadge}>
+ <Icon icon={enabled ? Check : X} size={13} />
+ {t(enabled ? 'builtins.lobe-task.verify.on' : 'builtins.lobe-task.verify.off')}
+ </span>
+ ) : undefined;
+
+ return (
+ <TaskResultCard
+ headerExtra={statusBadge}
+ icon={ShieldCheck}
+ iconColor={enabled === false ? cssVar.colorTextTertiary : cssVar.colorSuccess}
+ identifier={identifier}
+ title={t('builtins.lobe-task.apiName.setTaskVerify')}
+ >
+ {requirement ? (
+ <Markdown fontSize={12} variant={'chat'}>
+ {requirement}
+ </Markdown>
+ ) : null}
+ </TaskResultCard>
+ );
+});
+
+SetTaskVerifyRender.displayName = 'SetTaskVerifyRender';
+
+export default SetTaskVerifyRender;
diff --git a/packages/builtin-tool-task/src/client/Render/index.test.tsx b/packages/builtin-tool-task/src/client/Render/index.test.tsx
new file mode 100644
index 00000000000..bd7f5ce5a9e
--- /dev/null
+++ b/packages/builtin-tool-task/src/client/Render/index.test.tsx
@@ -0,0 +1,206 @@
+/**
+ * @vitest-environment happy-dom
+ */
+import { cleanup, render, screen } from '@testing-library/react';
+import type { ReactNode } from 'react';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+
+import type { EditTaskParams, RunTaskParams, SetTaskVerifyParams } from '../../types';
+import EditTaskRender from './EditTask';
+import RunTaskRender from './RunTask';
+import SetTaskVerifyRender from './SetTaskVerify';
+
+interface AgentDisplayMeta {
+ avatar?: string;
+ title?: string;
+}
+
+const mocks = vi.hoisted(() => ({
+ agentMetaById: {} as Record<string, AgentDisplayMeta | undefined>,
+}));
+
+// Translate to the last segment of the key so assertions stay readable.
+vi.mock('react-i18next', () => ({
+ useTranslation: () => ({ t: (key: string) => key.split('.').at(-1) || key }),
+}));
+
+// Headless stubs for @lobehub/ui so we exercise our own markup, not the design
+// system internals (which would need a theme provider in jsdom).
+vi.mock('@lobehub/ui', () => ({
+ ActionIcon: ({ title }: { title?: string }) => <button data-testid="action-icon" title={title} />,
+ Block: ({ children, onClick }: { children?: ReactNode; onClick?: () => void }) => (
+ <div data-testid="block" onClick={onClick}>
+ {children}
+ </div>
+ ),
+ Icon: () => <span data-testid="icon" />,
+ Markdown: ({ children }: { children?: ReactNode }) => (
+ <div data-testid="markdown">{children}</div>
+ ),
+ Text: ({ children }: { children?: ReactNode }) => <span>{children}</span>,
+}));
+
+vi.mock('@/features/AgentTasks/features/AssigneeAvatar', () => ({
+ default: ({ agentId }: { agentId?: string | null }) => (
+ <span data-agent-id={agentId || ''} data-testid="assignee-avatar" />
+ ),
+}));
+
+vi.mock('@/features/AgentTasks/features/TaskPriorityTag', () => ({
+ default: ({ priority }: { priority?: number | null }) => (
+ <span data-priority={String(priority)} data-testid="priority-tag" />
+ ),
+}));
+
+vi.mock('@/features/AgentTasks/shared/useAgentDisplayMeta', () => ({
+ useAgentDisplayMeta: (id: string) => mocks.agentMetaById[id],
+}));
+
+// The shared card reads the chat portal store to wire open/close detail.
+vi.mock('@/store/chat', () => ({
+ useChatStore: (selector: (state: unknown) => unknown) =>
+ selector({ closeTaskDetail: vi.fn(), openTaskDetail: vi.fn() }),
+}));
+
+vi.mock('@/store/chat/selectors', () => ({
+ chatPortalSelectors: {
+ showTaskDetail: () => false,
+ taskDetailId: () => undefined,
+ },
+}));
+
+const renderProps = {
+ content: '',
+ messageId: 'message-test',
+};
+
+describe('EditTaskRender', () => {
+ beforeEach(() => {
+ mocks.agentMetaById = {};
+ });
+ afterEach(() => cleanup());
+
+ const renderEdit = (args: Partial<EditTaskParams>) =>
+ render(
+ <EditTaskRender {...renderProps} args={{ identifier: 'T-1', ...args } as EditTaskParams} />,
+ );
+
+ it('renders the identifier and edit title', () => {
+ renderEdit({ name: 'Renamed task' });
+
+ expect(screen.getByText('T-1')).toBeTruthy();
+ expect(screen.getByText('editTask')).toBeTruthy();
+ expect(screen.getByText('Renamed task')).toBeTruthy();
+ });
+
+ it('resolves the assignee agent name', () => {
+ mocks.agentMetaById.agt_worker = { title: 'Worker Agent' };
+ renderEdit({ assigneeAgentId: 'agt_worker' });
+
+ expect(screen.getByTestId('assignee-avatar').dataset.agentId).toBe('agt_worker');
+ expect(screen.getByText('Worker Agent')).toBeTruthy();
+ });
+
+ it('shows the unassign label when the assignee is cleared', () => {
+ renderEdit({ assigneeAgentId: null });
+
+ expect(screen.getByText('unassign')).toBeTruthy();
+ expect(screen.queryByTestId('assignee-avatar')).toBeNull();
+ });
+
+ it('renders the instruction preview as markdown', () => {
+ renderEdit({ instruction: '# Do the thing' });
+
+ expect(screen.getByTestId('markdown').textContent).toContain('# Do the thing');
+ });
+
+ it('renders dependency changes', () => {
+ renderEdit({ addDependencies: ['T-2'], removeDependencies: ['T-3'] });
+
+ expect(screen.getByText('T-2')).toBeTruthy();
+ expect(screen.getByText('T-3')).toBeTruthy();
+ });
+
+ it('renders only the header when there are no field changes', () => {
+ renderEdit({});
+
+ expect(screen.getByText('T-1')).toBeTruthy();
+ expect(screen.queryByTestId('markdown')).toBeNull();
+ expect(screen.queryByTestId('assignee-avatar')).toBeNull();
+ });
+});
+
+describe('SetTaskVerifyRender', () => {
+ beforeEach(() => {
+ mocks.agentMetaById = {};
+ });
+ afterEach(() => cleanup());
+
+ const renderVerify = (args: Partial<SetTaskVerifyParams>) =>
+ render(
+ <SetTaskVerifyRender
+ {...renderProps}
+ args={{ identifier: 'T-1', ...args } as SetTaskVerifyParams}
+ />,
+ );
+
+ it('shows the gate-on label and full requirement text', () => {
+ renderVerify({ enabled: true, requirement: 'Ship a complete report' });
+
+ expect(screen.getByText('on')).toBeTruthy();
+ expect(screen.getByText('Ship a complete report')).toBeTruthy();
+ });
+
+ it('shows the gate-off label when disabled', () => {
+ renderVerify({ enabled: false });
+
+ expect(screen.getByText('off')).toBeTruthy();
+ });
+
+ it('renders the requirement as markdown only (no extra fields)', () => {
+ renderVerify({
+ enabled: true,
+ maxIterations: 3,
+ requirement: '## Acceptance',
+ verifierAgentId: 'agt_verifier',
+ });
+
+ // Body is just the requirement markdown — verifier / iterations are not shown.
+ expect(screen.getByTestId('markdown').textContent).toContain('## Acceptance');
+ expect(screen.queryByTestId('assignee-avatar')).toBeNull();
+ expect(screen.queryByText('3')).toBeNull();
+ });
+});
+
+describe('RunTaskRender', () => {
+ afterEach(() => cleanup());
+
+ const renderRun = (
+ args: Partial<RunTaskParams>,
+ pluginState?: { identifier: string; success: boolean; topicId?: string },
+ ) =>
+ render(
+ <RunTaskRender
+ {...renderProps}
+ args={{ identifier: 'T-1', ...args } as RunTaskParams}
+ pluginState={pluginState}
+ />,
+ );
+
+ it('renders the run title and identifier', () => {
+ renderRun({});
+
+ expect(screen.getByText('runTask')).toBeTruthy();
+ expect(screen.getByText('T-1')).toBeTruthy();
+ });
+
+ it('renders the prompt and resolved topic id', () => {
+ renderRun(
+ { prompt: 'Focus on the MVP' },
+ { identifier: 'T-1', success: true, topicId: 'tpc_123' },
+ );
+
+ expect(screen.getByText('Focus on the MVP')).toBeTruthy();
+ expect(screen.getByText('tpc_123')).toBeTruthy();
+ });
+});
diff --git a/packages/builtin-tool-task/src/client/Render/index.ts b/packages/builtin-tool-task/src/client/Render/index.ts
index 260f75f6db3..5267fa076d9 100644
--- a/packages/builtin-tool-task/src/client/Render/index.ts
+++ b/packages/builtin-tool-task/src/client/Render/index.ts
@@ -3,21 +3,30 @@ import type { BuiltinRender } from '@lobechat/types';
import { TaskApiName } from '../../types';
import CreateTaskRender from './CreateTask';
import CreateTasksRender from './CreateTasks';
+import EditTaskRender from './EditTask';
+import RunTaskRender from './RunTask';
import RunTasksRender from './RunTasks';
+import SetTaskVerifyRender from './SetTaskVerify';
/**
* Task tool Render components registry.
*
- * Only mutating create-style operations have a dedicated render — read
- * operations (list/view) and lightweight mutations (edit/status/delete)
- * present their results directly via the tool's text content.
+ * Create-style and single-task mutation operations present a focused result
+ * card; the remaining read operations (list/view) and lightweight mutations
+ * (status/delete/comments) fall back to the generic argument/result render.
*/
export const TaskRenders: Record<string, BuiltinRender> = {
[TaskApiName.createTask]: CreateTaskRender as BuiltinRender,
[TaskApiName.createTasks]: CreateTasksRender as BuiltinRender,
+ [TaskApiName.editTask]: EditTaskRender as BuiltinRender,
+ [TaskApiName.runTask]: RunTaskRender as BuiltinRender,
[TaskApiName.runTasks]: RunTasksRender as BuiltinRender,
+ [TaskApiName.setTaskVerify]: SetTaskVerifyRender as BuiltinRender,
};
export { default as CreateTaskRender } from './CreateTask';
export { default as CreateTasksRender } from './CreateTasks';
+export { default as EditTaskRender } from './EditTask';
+export { default as RunTaskRender } from './RunTask';
export { default as RunTasksRender } from './RunTasks';
+export { default as SetTaskVerifyRender } from './SetTaskVerify';
diff --git a/packages/builtin-tool-task/src/client/Render/shared.tsx b/packages/builtin-tool-task/src/client/Render/shared.tsx
new file mode 100644
index 00000000000..838acd8bdbd
--- /dev/null
+++ b/packages/builtin-tool-task/src/client/Render/shared.tsx
@@ -0,0 +1,238 @@
+'use client';
+
+import { ActionIcon, Block, Icon, Text } from '@lobehub/ui';
+import { createStaticStyles, cssVar, cx } from 'antd-style';
+import type { LucideIcon } from 'lucide-react';
+import { PanelRight, PanelRightClose } from 'lucide-react';
+import type { ReactNode } from 'react';
+import { memo } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import AssigneeAvatar from '@/features/AgentTasks/features/AssigneeAvatar';
+import { useAgentDisplayMeta } from '@/features/AgentTasks/shared/useAgentDisplayMeta';
+import { useChatStore } from '@/store/chat';
+import { chatPortalSelectors } from '@/store/chat/selectors';
+
+const styles = createStaticStyles(({ css, cssVar }) => ({
+ assignee: css`
+ display: inline-flex;
+ gap: 6px;
+ align-items: center;
+
+ min-width: 0;
+ max-width: 100%;
+ `,
+ assigneeName: css`
+ overflow: hidden;
+
+ font-size: 13px;
+ color: ${cssVar.colorText};
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ `,
+ body: css`
+ display: flex;
+ flex-direction: column;
+ gap: 10px;
+
+ padding-block: 12px;
+ padding-inline: 12px;
+ `,
+ header: css`
+ display: flex;
+ gap: 8px;
+ align-items: center;
+
+ padding-block: 10px;
+ padding-inline: 12px;
+ `,
+ headerDivider: css`
+ border-block-end: 1px solid ${cssVar.colorBorderSecondary};
+ `,
+ identifier: css`
+ flex-shrink: 0;
+
+ padding-block: 1px;
+ padding-inline: 6px;
+ border-radius: 4px;
+
+ font-family: ${cssVar.fontFamilyCode};
+ font-size: 12px;
+ color: ${cssVar.colorTextSecondary};
+
+ background: ${cssVar.colorFillTertiary};
+ `,
+ inlineRow: css`
+ display: flex;
+ gap: 8px;
+ align-items: center;
+ min-width: 0;
+ `,
+ inlineValue: css`
+ overflow: hidden;
+ flex: 1;
+
+ min-width: 0;
+
+ font-size: 13px;
+ color: ${cssVar.colorText};
+ `,
+ label: css`
+ flex-shrink: 0;
+ font-size: 12px;
+ color: ${cssVar.colorTextTertiary};
+ `,
+ mono: css`
+ font-family: ${cssVar.fontFamilyCode};
+ font-size: 12px;
+ color: ${cssVar.colorTextSecondary};
+ `,
+ section: css`
+ display: flex;
+ flex-direction: column;
+ gap: 4px;
+ min-width: 0;
+ `,
+ sectionValue: css`
+ font-size: 13px;
+ line-height: 1.6;
+ color: ${cssVar.colorTextSecondary};
+ overflow-wrap: anywhere;
+ `,
+ spacer: css`
+ flex: 1;
+ `,
+ title: css`
+ font-size: 13px;
+ font-weight: 500;
+ color: ${cssVar.colorText};
+ `,
+}));
+
+/**
+ * Shared open/close wiring for a task's detail portal, reused by every
+ * single-task result card so clicking a card (or its toggle) reveals the full
+ * task in the right-side panel.
+ */
+export const useTaskDetailToggle = (identifier?: string) => {
+ const [activeTaskDetailId, showTaskDetail, openTaskDetail, closeTaskDetail] = useChatStore(
+ (s) => [
+ chatPortalSelectors.taskDetailId(s),
+ chatPortalSelectors.showTaskDetail(s),
+ s.openTaskDetail,
+ s.closeTaskDetail,
+ ],
+ );
+
+ const canOpen = !!identifier;
+ const isExpanded = canOpen && showTaskDetail && activeTaskDetailId === identifier;
+
+ const open = () => {
+ if (identifier) openTaskDetail(identifier);
+ };
+
+ const toggle = () => {
+ if (!identifier) return;
+ if (isExpanded) closeTaskDetail();
+ else openTaskDetail(identifier);
+ };
+
+ return { canOpen, isExpanded, open, toggle };
+};
+
+interface TaskResultCardProps {
+ children?: ReactNode;
+ /** Inline status/extra slot rendered in the header, after the identifier chip. */
+ headerExtra?: ReactNode;
+ icon?: LucideIcon;
+ iconColor?: string;
+ identifier?: string;
+ title: ReactNode;
+}
+
+/**
+ * Outlined card shell shared by the single-task mutation renders (edit / run /
+ * verify): a header line with operation icon, title and identifier chip plus an
+ * optional body of detail fields. The whole card opens the task detail portal.
+ */
+export const TaskResultCard = memo<TaskResultCardProps>(
+ ({ children, headerExtra, icon, iconColor, identifier, title }) => {
+ const { t } = useTranslation('chat');
+ const { canOpen, isExpanded, open, toggle } = useTaskDetailToggle(identifier);
+
+ return (
+ <Block
+ clickable={canOpen}
+ variant={'outlined'}
+ width={'100%'}
+ onClick={canOpen ? open : undefined}
+ >
+ <div className={cx(styles.header, !!children && styles.headerDivider)}>
+ {icon && (
+ <Icon icon={icon} size={15} style={{ color: iconColor ?? cssVar.colorTextSecondary }} />
+ )}
+ <Text className={styles.title}>{title}</Text>
+ {identifier && <span className={styles.identifier}>{identifier}</span>}
+ {headerExtra}
+ <div className={styles.spacer} />
+ {canOpen && (
+ <ActionIcon
+ active={isExpanded}
+ icon={isExpanded ? PanelRightClose : PanelRight}
+ size={'small'}
+ title={t(isExpanded ? 'taskDetail.closeDetail' : 'taskDetail.openDetail')}
+ onClick={(e) => {
+ e.stopPropagation();
+ toggle();
+ }}
+ />
+ )}
+ </div>
+ {children && <div className={styles.body}>{children}</div>}
+ </Block>
+ );
+ },
+);
+
+TaskResultCard.displayName = 'TaskResultCard';
+
+/** A scalar detail row: muted label followed by an inline value. */
+export const InlineField = memo<{ children: ReactNode; label: ReactNode }>(
+ ({ children, label }) => (
+ <div className={styles.inlineRow}>
+ <span className={styles.label}>{label}</span>
+ <div className={styles.inlineValue}>{children}</div>
+ </div>
+ ),
+);
+
+InlineField.displayName = 'InlineField';
+
+/** A stacked detail block: muted label above long-form content. */
+export const SectionField = memo<{ children: ReactNode; label: ReactNode }>(
+ ({ children, label }) => (
+ <div className={styles.section}>
+ <span className={styles.label}>{label}</span>
+ <div className={styles.sectionValue}>{children}</div>
+ </div>
+ ),
+);
+
+SectionField.displayName = 'SectionField';
+
+/** An agent avatar + display name, resolved from the agent registry. */
+export const AssigneeInline = memo<{ agentId: string }>(({ agentId }) => {
+ const agentMeta = useAgentDisplayMeta(agentId, { fallbackToDefault: false });
+ const displayName = agentMeta?.title || agentId;
+
+ return (
+ <span className={styles.assignee} title={displayName}>
+ <AssigneeAvatar agentId={agentId} fallbackToDefault={false} size={18} />
+ <span className={styles.assigneeName}>{displayName}</span>
+ </span>
+ );
+});
+
+AssigneeInline.displayName = 'AssigneeInline';
+
+export const monoChipClassName = styles.mono;
diff --git a/packages/builtin-tool-task/src/client/index.ts b/packages/builtin-tool-task/src/client/index.ts
index f3473a9d335..4fe1d6c2d9f 100644
--- a/packages/builtin-tool-task/src/client/index.ts
+++ b/packages/builtin-tool-task/src/client/index.ts
@@ -16,7 +16,15 @@ export {
} from './Inspector';
// Render components (read-only snapshots)
-export { CreateTaskRender, CreateTasksRender, RunTasksRender, TaskRenders } from './Render';
+export {
+ CreateTaskRender,
+ CreateTasksRender,
+ EditTaskRender,
+ RunTaskRender,
+ RunTasksRender,
+ SetTaskVerifyRender,
+ TaskRenders,
+} from './Render';
// Re-export manifest and types for convenience
export { TaskIdentifier, TaskManifest } from '../manifest';
diff --git a/packages/locales/src/default/plugin.ts b/packages/locales/src/default/plugin.ts
index 77afc21b51f..9856bf9f4d0 100644
--- a/packages/locales/src/default/plugin.ts
+++ b/packages/locales/src/default/plugin.ts
@@ -366,11 +366,17 @@ export default {
'builtins.lobe-task.edit.rename': 'rename',
'builtins.lobe-task.edit.unassign': 'unassign',
'builtins.lobe-task.edit.unblocks': 'unblocks',
+ 'builtins.lobe-task.field.description': 'Description',
+ 'builtins.lobe-task.field.instruction': 'Instruction',
'builtins.lobe-task.run.continueTopic': 'continue topic',
+ 'builtins.lobe-task.run.prompt': 'Prompt',
+ 'builtins.lobe-task.run.topic': 'Topic',
'builtins.lobe-task.runTasks.count': '{{count}} tasks',
'builtins.lobe-task.runTasks.failedCount': '{{count}} failed',
'builtins.lobe-task.runTasks.more': '+{{count}} more',
'builtins.lobe-task.title': 'Task Tools',
+ 'builtins.lobe-task.verify.off': 'Verify gate off',
+ 'builtins.lobe-task.verify.on': 'Verify gate on',
'builtins.lobe-self-feedback-intent.apiName.declareSelfFeedbackIntent': 'Record improvement idea',
'builtins.lobe-self-feedback-intent.inspector.gap.proposal': 'Suggest improvement',
'builtins.lobe-self-feedback-intent.inspector.memory.write': 'Record preference',