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: integrate acceptance details into tasks (#17574)

Arvin Xu054fe26de908
diff --git a/.agents/acceptance/common-mistakes.md b/.agents/acceptance/common-mistakes.md
index ee5370041ac..eff28ac827d 100644
--- a/.agents/acceptance/common-mistakes.md
+++ b/.agents/acceptance/common-mistakes.md
@@ -140,3 +140,83 @@ never open the flow for the user.
[The original field notes](./references/common-mistakes-field-notes.md) retain the
full incident narratives and old Case numbers for earlier cross-references.
+
+## Task Detail acceptance prototypes must reuse Acceptance semantics
+
+**Wrong approach**: inventing a task-specific status glyph set and a generic card-based detail drawer while only copying the Acceptance data.
+
+**Why it's wrong**: the same check result reads differently across Task Detail and the canonical Acceptance surface, and the extra labeled cards make a compact review workflow feel like a dashboard.
+
+**What it breaks**: reviewers cannot transfer their learned status vocabulary, and opening one check adds visual hierarchy instead of progressively disclosing its evidence and decision.
+
+**Correct approach**: reuse Acceptance's exact check glyph semantics (`Check`, `XCircle`, `HelpCircle`, `MessageSquareX`) and mirror its expanded-check content order: status/title, verifier conclusion, evidence, standing feedback, then review actions.
+
+## Acceptance evidence must be inspectable, not represented by a placeholder
+
+**Wrong approach**: drawing a generic screenshot placeholder and evidence count inside an otherwise interactive check detail.
+
+**Why it's wrong**: the reviewer opens the detail specifically to inspect the proof; a placeholder preserves layout but removes the content that supports the verdict.
+
+**What it breaks**: the detail surface cannot answer whether the check actually passed or failed, and a “view original” affordance has no meaningful target.
+
+**Correct approach**: render a real evidence image inline at a readable size, wire the original-image action, and keep the surrounding text hierarchy identical to the canonical expanded Check Item.
+
+## “Reuse the Acceptance Check Item” means structural parity, not visual inspiration
+
+**Wrong approach**: retaining a custom drawer header and evidence-card footer after the reviewer explicitly asks for the existing Acceptance Check Item UI.
+
+**Why it's wrong**: even if the same facts are present, custom grouping changes scan order and creates a second interaction dialect for the same object.
+
+**What it breaks**: Task Detail and Acceptance no longer feel like two views of the same check, and every later improvement to the canonical row must be translated manually.
+
+**Correct approach**: mirror the canonical expanded row slot-for-slot: verdict glyph, sequence, title, evidence badges, round chip, expanded chevron, verifier narrative, raw evidence, then review actions. Add only the minimal container-level close affordance required by the right panel.
+
+## A real data path is not enough when the review target is the UI at scale
+
+**Wrong approach**: calling a two-item local Acceptance fixture a real UI acceptance because it uses the production data APIs.
+
+**Why it's wrong**: the request is about how a long, mixed-status acceptance reads inside Task Detail. Two rows cannot expose grouping pressure, list density, status scanning, or the relationship between the full list and the right-side detail.
+
+**What it breaks**: the published evidence technically proves the integration but gives the reviewer no meaningful view of the product decision they need to judge.
+
+**Correct approach**: mirror the representative production bundle's item count, titles, state mix, and semantic groups; capture a viewport tall enough to show the complete list, then separately capture an opened failed item while preserving the list context behind it.
+
+## A detail panel must read as a surface, not as a card inside a surface
+
+**Wrong approach**: place the expanded Acceptance Check Item inside an outlined card and preserve compact list-row typography after moving it into a wide right-side panel.
+
+**Why it's wrong**: the extra border creates a redundant container hierarchy, while list-scale type and spacing make a dedicated detail view still feel like a temporarily expanded row.
+
+**What it breaks**: the panel does not gain the visual authority or readable evidence area expected from progressive disclosure, even when its raw width increases.
+
+**Correct approach**: let the detail content occupy the panel directly without an inner border, use a materially wider panel, and scale the title, verdict glyph, narrative, evidence area, and spacing for sustained reading.
+
+## A detail surface must not inherit list-row controls
+
+**Wrong approach**: reuse the canonical Acceptance CheckRow in a detail panel while retaining its collapse chevron, evidence-type badges, round chips, hover-only review icons, and small footer actions.
+
+**Why it's wrong**: those controls help users scan and expand a dense list; inside an already-open detail surface they duplicate context, imply a nonexistent collapse state, and compete with the actual decision.
+
+**What it breaks**: the reviewer cannot immediately identify the primary next action, and the detail panel still behaves like a list row stretched wider rather than a dedicated decision surface.
+
+**Correct approach**: keep the canonical check content and verdict semantics, but make detail mode permanently expanded, remove list-only metadata and collapse affordances, and present full-width large reject/accept actions separated from the evidence content.
+
+## Check-detail status and identity need separate hierarchy levels
+
+**Wrong approach**: keep the verdict glyph as a small leading icon inside the same line as a modestly sized check title.
+
+**Why it's wrong**: a detail surface must establish state before identity, matching the Acceptance page's status-first header. A list-scale title and inline glyph make the open detail feel like another row.
+
+**What it breaks**: the reviewer cannot scan the check state independently, and the title lacks enough hierarchy to anchor the evidence and decision area below.
+
+**Correct approach**: render a dedicated semantic status pill at the top of the detail, then place the check sequence and a materially larger title on their own heading row.
+
+## Prominent detail actions still need calibrated density
+
+**Wrong approach**: respond to weak review actions by maximizing button height and preserving generous padding above both the detail header and decision bar.
+
+**Why it's wrong**: prominence comes from placement, contrast, and primary/secondary hierarchy, not sheer control size. Oversized buttons and stacked top padding waste the detail surface.
+
+**What it breaks**: the panel feels inflated, the evidence and decision area drift apart, and the status header starts too far below the Portal title.
+
+**Correct approach**: keep the two-column decision bar and primary contrast, but use medium 40px actions, a 12px gap, a 16px separator offset, and a compact handoff from the Portal header into the status-first detail header.
diff --git a/apps/server/src/services/verify/planGenerator.ts b/apps/server/src/services/verify/planGenerator.ts
index db2f5f6ca8c..5ae6034bb99 100644
--- a/apps/server/src/services/verify/planGenerator.ts
+++ b/apps/server/src/services/verify/planGenerator.ts
@@ -260,6 +260,7 @@ export class VerifyPlanGeneratorService {
model: params.modelConfig.model,
provider: params.modelConfig.provider,
schema: GENERATED_CRITERIA_JSON_SCHEMA,
+ thinking: { type: 'disabled' },
},
{
tracing: {
@@ -411,6 +412,7 @@ export class VerifyPlanGeneratorService {
model: params.modelConfig.model,
provider: params.modelConfig.provider,
schema: GENERATED_CRITERIA_JSON_SCHEMA,
+ thinking: { type: 'disabled' },
},
{
tracing: {
diff --git a/apps/server/src/services/verify/schema.ts b/apps/server/src/services/verify/schema.ts
index d9f989c1a2d..d23f57fd52e 100644
--- a/apps/server/src/services/verify/schema.ts
+++ b/apps/server/src/services/verify/schema.ts
@@ -44,7 +44,7 @@ export const GENERATED_CRITERIA_JSON_SCHEMA: GenerateObjectSchema = {
required: ['title', 'description', 'instruction', 'verifierType', 'required', 'onFail'],
type: 'object',
},
- maxItems: 6,
+ maxItems: 8,
type: 'array',
},
},
diff --git a/locales/en-US/chat.json b/locales/en-US/chat.json
index 90a4966062c..304a0713620 100644
--- a/locales/en-US/chat.json
+++ b/locales/en-US/chat.json
@@ -982,6 +982,16 @@
"taskCallback.error": "Task failed",
"taskCallback.interrupted": "Task interrupted",
"taskCallback.viewTask": "View task",
+ "taskDetail.acceptance.checklist": "Acceptance checklist",
+ "taskDetail.acceptance.closeDetail": "Close check detail",
+ "taskDetail.acceptance.collapseAll": "Collapse all groups",
+ "taskDetail.acceptance.detailTitle": "Check details",
+ "taskDetail.acceptance.expandAll": "Expand all groups",
+ "taskDetail.acceptance.goal": "Acceptance goal",
+ "taskDetail.acceptance.loadError": "Could not load delivery acceptance.",
+ "taskDetail.acceptance.retry": "Retry",
+ "taskDetail.acceptance.reviewError": "Could not save this review.",
+ "taskDetail.acceptance.title": "Delivery acceptance",
"taskDetail.activities": "Activities",
"taskDetail.activities.agentTag": "Agent",
"taskDetail.activities.fallback.brief": "posted a brief",
@@ -1321,7 +1331,7 @@
"upload.validation.videoSizeExceeded": "Video file size must not exceed {{maxSize}}. Current file size is {{actualSize}}.",
"verifyConfig.addCriterion": "Add criterion",
"verifyConfig.cancel": "Cancel",
- "verifyConfig.collapsedHint": "Add acceptance criteria",
+ "verifyConfig.collapsedHint": "Generate criteria from the task",
"verifyConfig.criteriaCount": "{{count}} criteria",
"verifyConfig.criterionTitlePlaceholder": "Describe what to check",
"verifyConfig.detail.descriptionLabel": "Notes",
diff --git a/locales/zh-CN/chat.json b/locales/zh-CN/chat.json
index d60afb8ec8e..fc4c14b1ed4 100644
--- a/locales/zh-CN/chat.json
+++ b/locales/zh-CN/chat.json
@@ -982,6 +982,16 @@
"taskCallback.error": "任务失败",
"taskCallback.interrupted": "任务已中断",
"taskCallback.viewTask": "查看任务",
+ "taskDetail.acceptance.checklist": "验收清单",
+ "taskDetail.acceptance.closeDetail": "关闭检查详情",
+ "taskDetail.acceptance.collapseAll": "折叠全部分组",
+ "taskDetail.acceptance.detailTitle": "检查详情",
+ "taskDetail.acceptance.expandAll": "展开全部分组",
+ "taskDetail.acceptance.goal": "验收目标",
+ "taskDetail.acceptance.loadError": "交付验收加载失败。",
+ "taskDetail.acceptance.retry": "重试",
+ "taskDetail.acceptance.reviewError": "复核结果保存失败。",
+ "taskDetail.acceptance.title": "交付验收",
"taskDetail.activities": "活动",
"taskDetail.activities.agentTag": "智能体",
"taskDetail.activities.fallback.brief": "发布了简要说明",
@@ -1321,7 +1331,7 @@
"upload.validation.videoSizeExceeded": "视频文件不能超过 {{maxSize}}。当前为 {{actualSize}}",
"verifyConfig.addCriterion": "添加验收项",
"verifyConfig.cancel": "取消",
- "verifyConfig.collapsedHint": "添加验收标准",
+ "verifyConfig.collapsedHint": "基于任务内容生成验收标准",
"verifyConfig.criteriaCount": "{{count}} 项检查",
"verifyConfig.criterionTitlePlaceholder": "描述需要检查的内容",
"verifyConfig.detail.descriptionLabel": "补充说明",
diff --git a/packages/locales/src/default/chat.ts b/packages/locales/src/default/chat.ts
index 148e197e9bf..7388252ca68 100644
--- a/packages/locales/src/default/chat.ts
+++ b/packages/locales/src/default/chat.ts
@@ -1160,6 +1160,16 @@ export default {
'taskSchedule.weekdays.thu': 'Thu',
'taskSchedule.weekdays.tue': 'Tue',
'taskSchedule.weekdays.wed': 'Wed',
+ 'taskDetail.acceptance.checklist': 'Acceptance checklist',
+ 'taskDetail.acceptance.closeDetail': 'Close check detail',
+ 'taskDetail.acceptance.detailTitle': 'Check details',
+ 'taskDetail.acceptance.collapseAll': 'Collapse all groups',
+ 'taskDetail.acceptance.expandAll': 'Expand all groups',
+ 'taskDetail.acceptance.goal': 'Acceptance goal',
+ 'taskDetail.acceptance.loadError': 'Could not load delivery acceptance.',
+ 'taskDetail.acceptance.retry': 'Retry',
+ 'taskDetail.acceptance.reviewError': 'Could not save this review.',
+ 'taskDetail.acceptance.title': 'Delivery acceptance',
'taskDetail.activities': 'Activities',
'taskDetail.activitiesEmpty': 'No activity yet',
'taskDetail.artifacts': 'Artifacts',
@@ -1807,7 +1817,7 @@ export default {
'workingPanel.title': 'Working Panel',
'verifyConfig.addCriterion': 'Add criterion',
'verifyConfig.cancel': 'Cancel',
- 'verifyConfig.collapsedHint': 'Add acceptance criteria',
+ 'verifyConfig.collapsedHint': 'Generate criteria from the task',
'verifyConfig.criteriaCount': '{{count}} criteria',
'verifyConfig.criterionTitlePlaceholder': 'Describe what to check',
'verifyConfig.detail.descriptionLabel': 'Notes',
diff --git a/src/features/AgentTaskManager/index.tsx b/src/features/AgentTaskManager/index.tsx
index 8536e38acc6..04febf5d4b7 100644
--- a/src/features/AgentTaskManager/index.tsx
+++ b/src/features/AgentTaskManager/index.tsx
@@ -1,6 +1,10 @@
import { memo } from 'react';
+import { PortalContent } from '@/features/Portal/router';
import RightPanel from '@/features/RightPanel';
+import { useChatStore } from '@/store/chat';
+import { chatPortalSelectors } from '@/store/chat/selectors';
+import { PortalViewType } from '@/store/chat/slices/portal/initialState';
import { useGlobalStore } from '@/store/global';
import { systemStatusSelectors } from '@/store/global/selectors';
@@ -12,6 +16,9 @@ const AgentTaskManager = memo(() => {
systemStatusSelectors.showTaskAgentPanel(s),
s.toggleTaskAgentPanel,
]);
+ const portalView = useChatStore(chatPortalSelectors.currentViewType);
+ const showAcceptance =
+ portalView === PortalViewType.Acceptance || portalView === PortalViewType.AcceptanceCheck;
return (
<RightPanel
@@ -19,11 +26,16 @@ const AgentTaskManager = memo(() => {
expand={expand}
maxWidth={720}
minWidth={320}
+ width={portalView === PortalViewType.AcceptanceCheck ? 640 : undefined}
onExpandChange={(next) => toggleTaskAgentPanel(next)}
>
- <TaskAgentProvider>
- <Conversation />
- </TaskAgentProvider>
+ {showAcceptance ? (
+ <PortalContent />
+ ) : (
+ <TaskAgentProvider>
+ <Conversation />
+ </TaskAgentProvider>
+ )}
</RightPanel>
);
});
diff --git a/src/features/AgentTasks/AgentTaskDetail/TaskAcceptance.test.tsx b/src/features/AgentTasks/AgentTaskDetail/TaskAcceptance.test.tsx
new file mode 100644
index 00000000000..7e6a09f019c
--- /dev/null
+++ b/src/features/AgentTasks/AgentTaskDetail/TaskAcceptance.test.tsx
@@ -0,0 +1,169 @@
+/**
+ * @vitest-environment happy-dom
+ */
+import { fireEvent, render, screen } from '@testing-library/react';
+import type { ReactNode } from 'react';
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+
+import TaskAcceptance from './TaskAcceptance';
+
+const mocks = vi.hoisted(() => ({
+ acceptanceSubject: null as null | { id: string },
+ bundle: undefined as
+ | undefined
+ | {
+ acceptance: { id: string; requirement: string };
+ checks: Array<{
+ category: string;
+ id: string;
+ seq: number;
+ title: string;
+ }>;
+ isOwner: boolean;
+ },
+ mutateBundle: vi.fn(),
+ mutateSubject: vi.fn(),
+ openAcceptanceCheck: vi.fn(),
+ toggleTaskAgentPanel: vi.fn(),
+}));
+
+vi.mock('@lobehub/ui', () => ({
+ ActionIcon: ({ onClick, title }: { onClick?: () => void; title?: string }) => (
+ <button type="button" onClick={onClick}>
+ {title}
+ </button>
+ ),
+ Block: ({ children, onClick }: { children: ReactNode; onClick?: () => void }) => (
+ <div onClick={onClick}>{children}</div>
+ ),
+ Drawer: ({ children, open }: { children: ReactNode; open?: boolean }) =>
+ open ? <aside>{children}</aside> : null,
+ Flexbox: ({ children, onClick }: { children: ReactNode; onClick?: () => void }) => (
+ <div onClick={onClick}>{children}</div>
+ ),
+ Icon: () => <span />,
+ Tag: ({ children }: { children: ReactNode }) => <span>{children}</span>,
+ Text: ({ children }: { children: ReactNode }) => <span>{children}</span>,
+}));
+
+vi.mock('@lobehub/ui/base-ui', () => ({
+ Button: ({ children, onClick }: { children: ReactNode; onClick?: () => void }) => (
+ <button type="button" onClick={onClick}>
+ {children}
+ </button>
+ ),
+}));
+
+vi.mock('antd', () => ({
+ App: { useApp: () => ({ message: { error: vi.fn() } }) },
+}));
+
+vi.mock('antd-style', () => ({
+ createStaticStyles: () => ({
+ body: 'body',
+ drawerBody: 'drawerBody',
+ error: 'error',
+ group: 'group',
+ groupHeader: 'groupHeader',
+ list: 'list',
+ row: 'row',
+ seq: 'seq',
+ }),
+ cssVar: {
+ colorTextDescription: '#999',
+ colorTextSecondary: '#666',
+ },
+}));
+
+vi.mock('react-i18next', () => ({
+ useTranslation: () => ({ t: (key: string) => key }),
+}));
+
+vi.mock('@/components/NeuralNetworkLoading', () => ({ default: () => <div>loading</div> }));
+
+vi.mock('@/features/Verify', () => ({
+ CheckRow: ({ check }: { check: { title: string } }) => (
+ <div data-testid="acceptance-check-detail">detail: {check.title}</div>
+ ),
+ checkHeadMeta: () => ({ color: 'green', icon: () => null }),
+ groupChecks: (checks: Array<{ category: string }>) =>
+ [...new Set(checks.map((check) => check.category))].map((category) => ({
+ checks: checks.filter((check) => check.category === category),
+ key: `category:${category}`,
+ label: category,
+ })),
+ useAcceptanceBundle: () => ({
+ data: mocks.bundle,
+ error: undefined,
+ isLoading: false,
+ mutate: mocks.mutateBundle,
+ }),
+ useAcceptanceBySubject: () => ({
+ data: mocks.acceptanceSubject,
+ error: undefined,
+ mutate: mocks.mutateSubject,
+ }),
+}));
+
+vi.mock('@/services/verify', () => ({
+ verifyService: { reviewChecks: vi.fn() },
+}));
+
+vi.mock('@/store/chat', () => ({
+ useChatStore: (selector: (state: Record<string, unknown>) => unknown) =>
+ selector({ openAcceptanceCheck: mocks.openAcceptanceCheck }),
+}));
+
+vi.mock('@/store/chat/selectors', () => ({
+ chatPortalSelectors: { currentViewType: () => null },
+}));
+
+vi.mock('@/store/chat/slices/portal/initialState', () => ({
+ PortalViewType: { TaskDetail: 'taskDetail' },
+}));
+
+vi.mock('@/store/global', () => ({
+ useGlobalStore: (selector: (state: Record<string, unknown>) => unknown) =>
+ selector({ toggleTaskAgentPanel: mocks.toggleTaskAgentPanel }),
+}));
+
+vi.mock('@/store/task', () => ({
+ useTaskStore: (selector: (state: Record<string, unknown>) => unknown) =>
+ selector({ activeTaskId: 'T-231' }),
+}));
+
+vi.mock('../shared/AccordionArrowIcon', () => ({ default: () => <span>arrow</span> }));
+
+describe('TaskAcceptance', () => {
+ beforeEach(() => {
+ vi.clearAllMocks();
+ mocks.acceptanceSubject = null;
+ mocks.bundle = undefined;
+ });
+
+ it('stays absent when the task has no acceptance aggregate', () => {
+ const { container } = render(<TaskAcceptance />);
+
+ expect(container).toBeEmptyDOMElement();
+ });
+
+ it('renders grouped checks and opens the selected check in the Acceptance portal', () => {
+ mocks.acceptanceSubject = { id: 'acceptance-1' };
+ mocks.bundle = {
+ acceptance: { id: 'acceptance-1', requirement: 'Everything is verifiable.' },
+ checks: [
+ { category: 'Setup', id: 'c1', seq: 1, title: 'Create task' },
+ { category: 'Result', id: 'c2', seq: 2, title: 'Show result' },
+ ],
+ isOwner: true,
+ };
+
+ render(<TaskAcceptance />);
+
+ expect(screen.getByText('Setup')).toBeInTheDocument();
+ expect(screen.getByText('Result')).toBeInTheDocument();
+ fireEvent.click(screen.getByText('Create task'));
+ expect(mocks.toggleTaskAgentPanel).toHaveBeenCalledWith(true);
+ expect(mocks.openAcceptanceCheck).toHaveBeenCalledWith('acceptance-1', 'c1');
+ });
+});
diff --git a/src/features/AgentTasks/AgentTaskDetail/TaskAcceptance.tsx b/src/features/AgentTasks/AgentTaskDetail/TaskAcceptance.tsx
new file mode 100644
index 00000000000..c360ade612f
--- /dev/null
+++ b/src/features/AgentTasks/AgentTaskDetail/TaskAcceptance.tsx
@@ -0,0 +1,289 @@
+'use client';
+
+import { ActionIcon, Block, Flexbox, Icon, Tag, Text } from '@lobehub/ui';
+import { Button } from '@lobehub/ui/base-ui';
+import { createStaticStyles, cssVar } from 'antd-style';
+import { ChevronRight, ChevronsDownUp, ChevronsUpDown, RotateCcw, ShieldCheck } from 'lucide-react';
+import { memo, useMemo, useState } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import NeuralNetworkLoading from '@/components/NeuralNetworkLoading';
+import {
+ type AcceptanceCheck,
+ checkHeadMeta,
+ groupChecks,
+ useAcceptanceBundle,
+ useAcceptanceBySubject,
+} from '@/features/Verify';
+import { useChatStore } from '@/store/chat';
+import { chatPortalSelectors } from '@/store/chat/selectors';
+import { PortalViewType } from '@/store/chat/slices/portal/initialState';
+import { useGlobalStore } from '@/store/global';
+import { useTaskStore } from '@/store/task';
+import { taskDetailSelectors } from '@/store/task/selectors';
+
+import AccordionArrowIcon from '../shared/AccordionArrowIcon';
+
+const styles = createStaticStyles(({ css }) => ({
+ body: css`
+ padding-inline: 12px;
+ `,
+ error: css`
+ padding-block: 10px;
+ padding-inline: 12px;
+ border-radius: ${cssVar.borderRadiusLG};
+ background: ${cssVar.colorErrorBg};
+ `,
+ group: css`
+ & + & {
+ border-block-start: 1px solid ${cssVar.colorBorderSecondary};
+ }
+ `,
+ groupHeader: css`
+ cursor: pointer;
+ padding-block: 9px;
+ padding-inline: 12px;
+ `,
+ list: css`
+ overflow: hidden;
+ padding: 0;
+ `,
+ row: css`
+ cursor: pointer;
+ padding-block: 10px;
+ padding-inline: 12px;
+
+ & + & {
+ border-block-start: 1px solid ${cssVar.colorBorderSecondary};
+ }
+
+ &:hover {
+ background: ${cssVar.colorFillQuaternary};
+ }
+ `,
+ seq: css`
+ flex: none;
+ font-size: 12px;
+ color: ${cssVar.colorTextTertiary};
+ `,
+}));
+
+interface AcceptanceErrorProps {
+ onRetry: () => void;
+}
+
+const AcceptanceError = memo<AcceptanceErrorProps>(({ onRetry }) => {
+ const { t } = useTranslation('chat');
+
+ return (
+ <Flexbox horizontal align={'center'} className={styles.error} gap={8}>
+ <Text fontSize={12} style={{ flex: 1 }} type={'danger'}>
+ {t('taskDetail.acceptance.loadError')}
+ </Text>
+ <Button icon={<Icon icon={RotateCcw} />} size={'small'} type={'text'} onClick={onRetry}>
+ {t('taskDetail.acceptance.retry')}
+ </Button>
+ </Flexbox>
+ );
+});
+
+AcceptanceError.displayName = 'TaskAcceptanceError';
+
+interface CompactCheckRowProps {
+ check: AcceptanceCheck;
+ onOpen: () => void;
+}
+
+const CompactCheckRow = memo<CompactCheckRowProps>(({ check, onOpen }) => {
+ const meta = checkHeadMeta(check);
+
+ return (
+ <Flexbox
+ horizontal
+ align={'center'}
+ className={styles.row}
+ data-task-acceptance-check={check.id}
+ gap={10}
+ role={'button'}
+ tabIndex={0}
+ onClick={onOpen}
+ onKeyDown={(event) => {
+ if (event.key === 'Enter' || event.key === ' ') onOpen();
+ }}
+ >
+ <Icon color={meta.color} icon={meta.icon} size={16} style={{ flex: 'none' }} />
+ <span className={styles.seq}>C{check.seq}</span>
+ <Text ellipsis style={{ flex: 1, minWidth: 0 }}>
+ {check.title}
+ </Text>
+ </Flexbox>
+ );
+});
+
+CompactCheckRow.displayName = 'TaskAcceptanceCompactCheckRow';
+
+const TaskAcceptance = memo(() => {
+ const { t } = useTranslation(['chat', 'verify']);
+ const openAcceptanceCheck = useChatStore((state) => state.openAcceptanceCheck);
+ const currentPortalView = useChatStore(chatPortalSelectors.currentViewType);
+ const showTaskAgentPanel = useGlobalStore((state) => state.toggleTaskAgentPanel);
+ const taskId = useTaskStore(taskDetailSelectors.activeTaskId);
+ const [sectionExpanded, setSectionExpanded] = useState(true);
+ const [collapsedGroups, setCollapsedGroups] = useState<Set<string>>(() => new Set());
+
+ const {
+ data: acceptanceSubject,
+ error: subjectError,
+ mutate: mutateSubject,
+ } = useAcceptanceBySubject('task', taskId ?? null);
+ const {
+ data: bundle,
+ error: bundleError,
+ isLoading: bundleLoading,
+ mutate: mutateBundle,
+ } = useAcceptanceBundle(acceptanceSubject?.id ?? null);
+
+ const checks = useMemo(() => bundle?.checks ?? [], [bundle?.checks]);
+ const groups = useMemo(
+ () => groupChecks(checks, t('acceptance.group.uncategorized', { ns: 'verify' })),
+ [checks, t],
+ );
+ const groupKeys = groups.map((group) => group.key);
+ const allGroupsCollapsed =
+ groupKeys.length > 0 && groupKeys.every((key) => collapsedGroups.has(key));
+ if (!acceptanceSubject && !subjectError) return null;
+
+ const renderHeader = () => (
+ <Block
+ clickable
+ horizontal
+ align={'center'}
+ gap={8}
+ paddingBlock={4}
+ paddingInline={8}
+ style={{ cursor: 'pointer', width: 'fit-content' }}
+ variant={'borderless'}
+ onClick={() => setSectionExpanded((expanded) => !expanded)}
+ >
+ <Icon color={cssVar.colorTextDescription} icon={ShieldCheck} size={16} />
+ <Text color={cssVar.colorTextSecondary} fontSize={13} weight={500}>
+ {t('taskDetail.acceptance.title')}
+ </Text>
+ {checks.length > 0 && <Tag size={'small'}>{checks.length}</Tag>}
+ <AccordionArrowIcon isOpen={sectionExpanded} style={{ color: cssVar.colorTextDescription }} />
+ </Block>
+ );
+
+ if (subjectError) {
+ return (
+ <Flexbox gap={8}>
+ {renderHeader()}
+ <Flexbox className={styles.body}>
+ <AcceptanceError onRetry={() => void mutateSubject()} />
+ </Flexbox>
+ </Flexbox>
+ );
+ }
+
+ return (
+ <Flexbox gap={8}>
+ {renderHeader()}
+ {sectionExpanded && (
+ <Flexbox className={styles.body} gap={14}>
+ {bundleLoading && <NeuralNetworkLoading size={28} />}
+ {bundleError && <AcceptanceError onRetry={() => void mutateBundle()} />}
+ {bundle && (
+ <>
+ {bundle.acceptance.requirement && (
+ <Flexbox gap={6}>
+ <Text fontSize={12} type={'secondary'}>
+ {t('taskDetail.acceptance.goal')}
+ </Text>
+ <Text>{bundle.acceptance.requirement}</Text>
+ </Flexbox>
+ )}
+ <Flexbox gap={7}>
+ <Flexbox horizontal align={'center'} gap={8}>
+ <Text fontSize={12} type={'secondary'}>
+ {t('taskDetail.acceptance.checklist')}
+ </Text>
+ <Flexbox flex={1} />
+ {groupKeys.length > 0 && (
+ <ActionIcon
+ icon={allGroupsCollapsed ? ChevronsUpDown : ChevronsDownUp}
+ size={'small'}
+ title={
+ allGroupsCollapsed
+ ? t('taskDetail.acceptance.expandAll')
+ : t('taskDetail.acceptance.collapseAll')
+ }
+ onClick={() =>
+ setCollapsedGroups(allGroupsCollapsed ? new Set() : new Set(groupKeys))
+ }
+ />
+ )}
+ </Flexbox>
+ <Block className={styles.list} variant={'outlined'}>
+ {groups.map((group) => {
+ const collapsed = collapsedGroups.has(group.key);
+
+ return (
+ <Flexbox className={styles.group} key={group.key}>
+ <Flexbox
+ horizontal
+ align={'center'}
+ className={styles.groupHeader}
+ gap={8}
+ onClick={() =>
+ setCollapsedGroups((previous) => {
+ const next = new Set(previous);
+ if (next.has(group.key)) next.delete(group.key);
+ else next.add(group.key);
+ return next;
+ })
+ }
+ >
+ <Text fontSize={12}>{group.label}</Text>
+ <Text fontSize={11} type={'secondary'}>
+ {group.checks.length}
+ </Text>
+ <Flexbox flex={1} />
+ <Icon
+ color={cssVar.colorTextDescription}
+ icon={ChevronRight}
+ size={13}
+ style={{
+ transform: collapsed ? 'none' : 'rotate(90deg)',
+ transition: 'transform 0.2s',
+ }}
+ />
+ </Flexbox>
+ {!collapsed &&
+ group.checks.map((check) => (
+ <CompactCheckRow
+ check={check}
+ key={check.id}
+ onOpen={() => {
+ if (currentPortalView !== PortalViewType.TaskDetail) {
+ showTaskAgentPanel(true);
+ }
+ openAcceptanceCheck(bundle.acceptance.id, check.id);
+ }}
+ />
+ ))}
+ </Flexbox>
+ );
+ })}
+ </Block>
+ </Flexbox>
+ </>
+ )}
+ </Flexbox>
+ )}
+ </Flexbox>
+ );
+});
+
+TaskAcceptance.displayName = 'TaskAcceptance';
+
+export default TaskAcceptance;
diff --git a/src/features/AgentTasks/AgentTaskDetail/TaskDetailSections.tsx b/src/features/AgentTasks/AgentTaskDetail/TaskDetailSections.tsx
index 1c51e351c62..a8689747076 100644
--- a/src/features/AgentTasks/AgentTaskDetail/TaskDetailSections.tsx
+++ b/src/features/AgentTasks/AgentTaskDetail/TaskDetailSections.tsx
@@ -1,6 +1,7 @@
import { Flexbox } from '@lobehub/ui';
import { memo } from 'react';
+import TaskAcceptance from './TaskAcceptance';
import TaskActivities from './TaskActivities';
import TaskArtifacts from './TaskArtifacts';
import TaskDetailAssignee from './TaskDetailAssignee';
@@ -39,6 +40,7 @@ const TaskDetailSections = memo(() => {
<Flexbox gap={24} style={{ paddingBottom: 120 }}>
<TaskInstruction />
<TaskVerifyConfig />
+ <TaskAcceptance />
<TaskSubtasks />
<TaskArtifacts />
<TaskActivities />
diff --git a/src/features/AgentTasks/AgentTaskDetail/TaskVerifyConfig.tsx b/src/features/AgentTasks/AgentTaskDetail/TaskVerifyConfig.tsx
index acf8bde1f67..febd4060d63 100644
--- a/src/features/AgentTasks/AgentTaskDetail/TaskVerifyConfig.tsx
+++ b/src/features/AgentTasks/AgentTaskDetail/TaskVerifyConfig.tsx
@@ -38,6 +38,8 @@ import { agentByIdSelectors, agentSelectors } from '@/store/agent/selectors';
import { useTaskStore } from '@/store/task';
import { taskDetailSelectors } from '@/store/task/selectors';
+import { resolveTaskAcceptanceGoal } from './resolveTaskAcceptanceGoal';
+
const SAVE_DEBOUNCE_MS = 600;
const styles = createStaticStyles(({ css, cssVar }) => ({
@@ -83,6 +85,9 @@ const TaskVerifyConfig = memo(() => {
const { allowed: canEditTask } = usePermission('create_content');
const taskId = useTaskStore(taskDetailSelectors.activeTaskId);
+ const taskDescription = useTaskStore(taskDetailSelectors.activeTaskDescription);
+ const taskInstruction = useTaskStore(taskDetailSelectors.activeTaskInstruction);
+ const taskName = useTaskStore(taskDetailSelectors.activeTaskName);
const verify = useTaskStore(taskDetailSelectors.activeTaskVerifyConfig);
const taskModel = useTaskStore(taskDetailSelectors.activeTaskModel);
const taskProvider = useTaskStore(taskDetailSelectors.activeTaskProvider);
@@ -102,6 +107,12 @@ const TaskVerifyConfig = memo(() => {
);
const model = taskModel || agentModel || '';
const provider = taskProvider || agentProvider || '';
+ const taskAcceptanceGoal = resolveTaskAcceptanceGoal({
+ description: taskDescription,
+ instruction: taskInstruction,
+ name: taskName,
+ });
+ const savedCount = verify?.verifyCriteriaIds?.length ?? 0;
const { data: rubrics } = useRubrics();
@@ -236,24 +247,45 @@ const TaskVerifyConfig = memo(() => {
);
// ---- actions ----
+ const generateCriteria = useCallback(
+ async (goal: string) => {
+ if (!goal || generating || !model || !provider) return;
+ setExpanded(true);
+ setRequirement(goal);
+ setGenerating(true);
+ try {
+ const generated = await verifyService.generateCriteria({
+ context: taskName?.trim() ? `Task: ${taskName.trim()}` : undefined,
+ goal,
+ maxCriteria: 8,
+ modelConfig: { model, provider },
+ });
+ if (generated.length === 0) throw new Error('No acceptance criteria were generated.');
+ const items = generated.map((draft) => toDraftItem(draft));
+ commit(items, { enabled: true, requirement: goal });
+ } catch (error) {
+ console.error('[TaskVerifyConfig] generate failed:', error);
+ message.error(t('verifyConfig.generateFailed'));
+ } finally {
+ setGenerating(false);
+ }
+ },
+ [commit, generating, message, model, provider, t, taskName],
+ );
+
const handleGenerate = useCallback(async () => {
const goal = requirement.trim();
if (!goal || generating || !model || !provider) return;
- setGenerating(true);
- try {
- const generated = await verifyService.generateCriteria({
- goal,
- modelConfig: { model, provider },
- });
- const items = generated.map((d) => toDraftItem(d));
- commit(items);
- } catch (e) {
- console.error('[TaskVerifyConfig] generate failed:', e);
- message.error(t('verifyConfig.generateFailed'));
- } finally {
- setGenerating(false);
+ await generateCriteria(goal);
+ }, [generateCriteria, generating, model, provider, requirement]);
+
+ const handleCollapsedClick = useCallback(() => {
+ if (savedCount > 0 || requirement.trim()) {
+ setExpanded(true);
+ return;
}
- }, [requirement, generating, model, provider, commit, message, t]);
+ void generateCriteria(taskAcceptanceGoal);
+ }, [generateCriteria, requirement, savedCount, taskAcceptanceGoal]);
const handleRemove = useCallback(
(id: string) => {
@@ -350,7 +382,6 @@ const TaskVerifyConfig = memo(() => {
if (!canEditTask) return null;
const hasConfig = drafts.length > 0;
- const savedCount = verify?.verifyCriteriaIds?.length ?? 0;
// ---- Collapsed trigger (default): a "+" row; reveals the editor on click ----
if (!expanded) {
@@ -374,7 +405,7 @@ const TaskVerifyConfig = memo(() => {
paddingInline={8}
style={{ width: 'fit-content' }}
variant={'borderless'}
- onClick={() => setExpanded(true)}
+ onClick={handleCollapsedClick}
>
<Icon
color={cssVar.colorTextDescription}
diff --git a/src/features/AgentTasks/AgentTaskDetail/resolveTaskAcceptanceGoal.test.ts b/src/features/AgentTasks/AgentTaskDetail/resolveTaskAcceptanceGoal.test.ts
new file mode 100644
index 00000000000..989d25a4813
--- /dev/null
+++ b/src/features/AgentTasks/AgentTaskDetail/resolveTaskAcceptanceGoal.test.ts
@@ -0,0 +1,26 @@
+import { describe, expect, it } from 'vitest';
+
+import { resolveTaskAcceptanceGoal } from './resolveTaskAcceptanceGoal';
+
+describe('resolveTaskAcceptanceGoal', () => {
+ it('uses the task instruction as the acceptance-generation goal', () => {
+ expect(
+ resolveTaskAcceptanceGoal({
+ description: 'Short description',
+ instruction: ' Deliver a 1500-word science-fiction story with a complete ending. ',
+ name: 'Write a story',
+ }),
+ ).toBe('Deliver a 1500-word science-fiction story with a complete ending.');
+ });
+
+ it('falls back to the description and then the task name', () => {
+ expect(
+ resolveTaskAcceptanceGoal({ description: ' Export a readable PDF. ', name: 'Export PDF' }),
+ ).toBe('Export a readable PDF.');
+ expect(resolveTaskAcceptanceGoal({ name: ' Export PDF ' })).toBe('Export PDF');
+ });
+
+ it('returns an empty goal when the task has no usable content', () => {
+ expect(resolveTaskAcceptanceGoal({ description: ' ', instruction: '', name: null })).toBe('');
+ });
+});
diff --git a/src/features/AgentTasks/AgentTaskDetail/resolveTaskAcceptanceGoal.ts b/src/features/AgentTasks/AgentTaskDetail/resolveTaskAcceptanceGoal.ts
new file mode 100644
index 00000000000..2725f2ed0f5
--- /dev/null
+++ b/src/features/AgentTasks/AgentTaskDetail/resolveTaskAcceptanceGoal.ts
@@ -0,0 +1,11 @@
+interface TaskAcceptanceSource {
+ description?: string | null;
+ instruction?: string | null;
+ name?: string | null;
+}
+
+export const resolveTaskAcceptanceGoal = ({
+ description,
+ instruction,
+ name,
+}: TaskAcceptanceSource) => instruction?.trim() || description?.trim() || name?.trim() || '';
diff --git a/src/features/AgentTasks/TaskWorkspaceLayout.test.tsx b/src/features/AgentTasks/TaskWorkspaceLayout.test.tsx
index aa1743d1855..e46ada0078a 100644
--- a/src/features/AgentTasks/TaskWorkspaceLayout.test.tsx
+++ b/src/features/AgentTasks/TaskWorkspaceLayout.test.tsx
@@ -9,6 +9,10 @@ import { resetNavPanel } from '@/features/NavPanel';
import TaskWorkspaceLayout from './TaskWorkspaceLayout';
+const mocks = vi.hoisted(() => ({
+ isMobile: false,
+}));
+
vi.mock('@lobehub/ui', () => ({
Flexbox: ({ children, ...props }: { children?: ReactNode; [key: string]: unknown }) => (
<div {...props}>{children}</div>
@@ -33,12 +37,17 @@ vi.mock('@/features/NavPanel', () => ({
resetNavPanel: vi.fn(),
}));
+vi.mock('@/features/Portal/Mobile', () => ({
+ default: () => <div data-testid="mobile-task-portal" />,
+}));
+
vi.mock('@/hooks/useIsMobile', () => ({
- useIsMobile: () => false,
+ useIsMobile: () => mocks.isMobile,
}));
describe('TaskWorkspaceLayout', () => {
beforeEach(() => {
+ mocks.isMobile = false;
vi.mocked(resetNavPanel).mockClear();
});
@@ -49,4 +58,13 @@ describe('TaskWorkspaceLayout', () => {
expect(screen.getByTestId('task-workspace-outlet')).toBeInTheDocument();
expect(screen.getByTestId('task-agent-manager')).toBeInTheDocument();
});
+
+ it('mounts the Portal surface instead of the desktop task manager on mobile', () => {
+ mocks.isMobile = true;
+
+ render(<TaskWorkspaceLayout />);
+
+ expect(screen.getByTestId('mobile-task-portal')).toBeInTheDocument();
+ expect(screen.queryByTestId('task-agent-manager')).not.toBeInTheDocument();
+ });
});
diff --git a/src/features/AgentTasks/TaskWorkspaceLayout.tsx b/src/features/AgentTasks/TaskWorkspaceLayout.tsx
index d4cd73520f4..367d9c4926d 100644
--- a/src/features/AgentTasks/TaskWorkspaceLayout.tsx
+++ b/src/features/AgentTasks/TaskWorkspaceLayout.tsx
@@ -6,6 +6,7 @@ import { Outlet } from 'react-router';
import AgentTaskManager from '@/features/AgentTaskManager';
import { resetNavPanel } from '@/features/NavPanel';
+import MobilePortal from '@/features/Portal/Mobile';
import { useIsMobile } from '@/hooks/useIsMobile';
const TaskWorkspaceLayout = memo(() => {
@@ -20,7 +21,7 @@ const TaskWorkspaceLayout = memo(() => {
<Flexbox flex={1} style={{ minWidth: 0 }}>
<Outlet />
</Flexbox>
- {!isMobile && <AgentTaskManager />}
+ {isMobile ? <MobilePortal /> : <AgentTaskManager />}
</Flexbox>
);
});
diff --git a/src/features/Portal/Acceptance/Body.test.tsx b/src/features/Portal/Acceptance/Body.test.tsx
index 748202feb97..dbe719b7394 100644
--- a/src/features/Portal/Acceptance/Body.test.tsx
+++ b/src/features/Portal/Acceptance/Body.test.tsx
@@ -14,7 +14,9 @@ vi.mock('@/store/chat', () => ({
}));
vi.mock('@/store/chat/selectors', () => ({
- chatPortalSelectors: { acceptancePortalId: () => 'acc-1' },
+ chatPortalSelectors: {
+ acceptancePortalId: () => 'acc-1',
+ },
}));
// P0 regression (blank "页面暂时不可用" crash): the portal pane is a layout
@@ -28,7 +30,10 @@ vi.mock('@/features/Conversation/store', () => ({
}));
vi.mock('@/features/Verify', () => ({
- AcceptanceViewer: (props: { onDraftToComposer?: (text: string) => boolean }) => {
+ AcceptanceViewer: (props: {
+ initialCheckId?: string;
+ onDraftToComposer?: (text: string) => boolean;
+ }) => {
mocks.captured.onDraftToComposer = props.onDraftToComposer;
return null;
},
diff --git a/src/features/Portal/AcceptanceCheck/Body.test.tsx b/src/features/Portal/AcceptanceCheck/Body.test.tsx
new file mode 100644
index 00000000000..4f450f4dd75
--- /dev/null
+++ b/src/features/Portal/AcceptanceCheck/Body.test.tsx
@@ -0,0 +1,91 @@
+import { fireEvent, render, screen } from '@testing-library/react';
+import type { ReactNode } from 'react';
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+
+import Body from './Body';
+
+const mocks = vi.hoisted(() => ({
+ bundleError: undefined as Error | undefined,
+ mutate: vi.fn(),
+}));
+
+vi.mock('@lobehub/ui', () => ({
+ Center: ({ children }: { children: ReactNode }) => <div>{children}</div>,
+ Empty: () => <div />,
+ Flexbox: ({ children, className }: { children: ReactNode; className?: string }) => (
+ <div className={className} data-testid={'detail-surface'}>
+ {children}
+ </div>
+ ),
+}));
+
+vi.mock('@lobehub/ui/base-ui', () => ({
+ Button: ({ children, onClick }: { children: ReactNode; onClick?: () => void }) => (
+ <button type="button" onClick={onClick}>
+ {children}
+ </button>
+ ),
+}));
+
+vi.mock('antd', () => ({
+ App: { useApp: () => ({ message: { error: vi.fn() } }) },
+}));
+
+vi.mock('react-i18next', () => ({
+ useTranslation: () => ({ t: (key: string) => key }),
+}));
+
+vi.mock('@/store/chat', () => ({
+ useChatStore: (selector: (state: Record<string, unknown>) => unknown) =>
+ selector({
+ openAcceptance: vi.fn(),
+ portalData: { acceptanceId: 'acc-1', checkId: 'check-1', type: 'acceptanceCheck' },
+ }),
+}));
+
+vi.mock('@/store/chat/selectors', () => ({
+ chatPortalSelectors: {
+ acceptanceCheckPortal: (state: { portalData: { acceptanceId: string; checkId: string } }) =>
+ state.portalData,
+ },
+}));
+
+vi.mock('@/features/Verify', () => ({
+ FocusedCheckDetails: () => <div data-testid={'check-details'} />,
+ useAcceptanceBundle: () => ({
+ data: {
+ acceptance: { id: 'acc-1' },
+ checks: [{ id: 'check-1' }],
+ isOwner: true,
+ },
+ error: mocks.bundleError,
+ isLoading: false,
+ mutate: mocks.mutate,
+ }),
+}));
+
+describe('AcceptanceCheck Portal Body', () => {
+ beforeEach(() => {
+ mocks.bundleError = undefined;
+ mocks.mutate.mockReset();
+ });
+
+ it('renders the expanded check directly on a borderless detail surface', () => {
+ render(<Body />);
+
+ const surface = screen.getByTestId('detail-surface');
+ const checkDetails = screen.getByTestId('check-details');
+
+ expect(checkDetails.parentElement).toBe(surface);
+ expect(surface.querySelector('[class*="block"]')).toBeNull();
+ });
+
+ it('offers an in-place retry when loading the selected check fails', () => {
+ mocks.bundleError = new Error('network failed');
+
+ render(<Body />);
+
+ fireEvent.click(screen.getByRole('button', { name: 'taskDetail.acceptance.retry' }));
+ expect(mocks.mutate).toHaveBeenCalledTimes(1);
+ });
+});
diff --git a/src/features/Portal/AcceptanceCheck/Body.tsx b/src/features/Portal/AcceptanceCheck/Body.tsx
new file mode 100644
index 00000000000..61d1884e9b9
--- /dev/null
+++ b/src/features/Portal/AcceptanceCheck/Body.tsx
@@ -0,0 +1,85 @@
+'use client';
+
+import { Center, Empty, Flexbox } from '@lobehub/ui';
+import { Button } from '@lobehub/ui/base-ui';
+import { App } from 'antd';
+import { createStaticStyles } from 'antd-style';
+import { memo, useState } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import NeuralNetworkLoading from '@/components/NeuralNetworkLoading';
+import { type CheckReviewInput, FocusedCheckDetails, useAcceptanceBundle } from '@/features/Verify';
+import { verifyService } from '@/services/verify';
+import { useChatStore } from '@/store/chat';
+import { chatPortalSelectors } from '@/store/chat/selectors';
+
+const styles = createStaticStyles(({ css }) => ({
+ body: css`
+ overflow-y: auto;
+ padding-block: 0 24px;
+ padding-inline: 24px;
+ `,
+}));
+
+const Body = memo(() => {
+ const { t } = useTranslation('chat');
+ const { message } = App.useApp();
+ const portal = useChatStore(chatPortalSelectors.acceptanceCheckPortal);
+ const openAcceptance = useChatStore((state) => state.openAcceptance);
+ const { data, error, isLoading, mutate } = useAcceptanceBundle(portal?.acceptanceId ?? null);
+ const [reviewPending, setReviewPending] = useState(false);
+ const check = data?.checks.find((item) => item.id === portal?.checkId);
+
+ const handleReview = async (input: CheckReviewInput): Promise<boolean> => {
+ if (!data) return false;
+
+ try {
+ setReviewPending(true);
+ await verifyService.reviewChecks({ id: data.acceptance.id, ...input });
+ await mutate();
+ return true;
+ } catch (cause) {
+ message.error(
+ cause instanceof Error ? cause.message : t('taskDetail.acceptance.reviewError'),
+ );
+ return false;
+ } finally {
+ setReviewPending(false);
+ }
+ };
+
+ if (isLoading) {
+ return (
+ <Center height={'100%'}>
+ <NeuralNetworkLoading size={40} />
+ </Center>
+ );
+ }
+
+ if (error || !data || !check) {
+ return (
+ <Center height={'100%'}>
+ <Flexbox align={'center'} gap={12}>
+ <Empty description={t('taskDetail.acceptance.loadError')} />
+ <Button onClick={() => void mutate()}>{t('taskDetail.acceptance.retry')}</Button>
+ </Flexbox>
+ </Center>
+ );
+ }
+
+ return (
+ <Flexbox className={styles.body}>
+ <FocusedCheckDetails
+ canReview={data.isOwner}
+ check={check}
+ reviewPending={reviewPending}
+ onReview={handleReview}
+ onRound={() => openAcceptance(data.acceptance.id)}
+ />
+ </Flexbox>
+ );
+});
+
+Body.displayName = 'AcceptanceCheckPortalBody';
+
+export default Body;
diff --git a/src/features/Portal/AcceptanceCheck/Title.tsx b/src/features/Portal/AcceptanceCheck/Title.tsx
new file mode 100644
index 00000000000..1ffc32e1af0
--- /dev/null
+++ b/src/features/Portal/AcceptanceCheck/Title.tsx
@@ -0,0 +1,12 @@
+import { memo } from 'react';
+import { useTranslation } from 'react-i18next';
+
+const Title = memo(() => {
+ const { t } = useTranslation('chat');
+
+ return t('taskDetail.acceptance.detailTitle');
+});
+
+Title.displayName = 'AcceptanceCheckPortalTitle';
+
+export default Title;
diff --git a/src/features/Portal/AcceptanceCheck/index.ts b/src/features/Portal/AcceptanceCheck/index.ts
new file mode 100644
index 00000000000..9bf2edc0382
--- /dev/null
+++ b/src/features/Portal/AcceptanceCheck/index.ts
@@ -0,0 +1,5 @@
+import type { PortalImpl } from '../type';
+import Body from './Body';
+import Title from './Title';
+
+export const AcceptanceCheck: PortalImpl = { Body, Title };
diff --git a/src/features/Portal/Mobile.tsx b/src/features/Portal/Mobile.tsx
new file mode 100644
index 00000000000..d4e8af89069
--- /dev/null
+++ b/src/features/Portal/Mobile.tsx
@@ -0,0 +1,60 @@
+'use client';
+
+import { Flexbox } from '@lobehub/ui';
+import { createStaticStyles, cx } from 'antd-style';
+import { type ReactNode } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import ImperativeModal from '@/components/ImperativeModal';
+import { useChatStore } from '@/store/chat';
+import { portalThreadSelectors } from '@/store/chat/selectors';
+
+import { PortalContent } from './router';
+
+const styles = createStaticStyles(({ css, cssVar }) => ({
+ container: css`
+ background: linear-gradient(${cssVar.colorBgElevated}, ${cssVar.colorBgContainer}) !important;
+ `,
+}));
+
+const MobilePortal = () => {
+ const [showMobilePortal, isPortalThread, clearPortalStack] = useChatStore((state) => [
+ state.showPortal,
+ portalThreadSelectors.showThread(state),
+ state.clearPortalStack,
+ ]);
+ const { t } = useTranslation('portal');
+
+ const renderBody = (body: ReactNode) => (
+ <Flexbox gap={8} height={'calc(100% - 52px)'} padding={'0 8px'} style={{ overflow: 'hidden' }}>
+ <Flexbox
+ height={'100%'}
+ style={{ marginInline: -8, overflow: 'hidden', position: 'relative' }}
+ width={'calc(100% + 16px)'}
+ >
+ {body}
+ </Flexbox>
+ </Flexbox>
+ );
+
+ return (
+ <ImperativeModal
+ allowFullscreen
+ destroyOnHidden
+ className={cx(isPortalThread && styles.container)}
+ footer={null}
+ height={'95%'}
+ open={showMobilePortal}
+ title={t('title')}
+ styles={{
+ body: { padding: 0 },
+ header: { display: 'none' },
+ }}
+ onCancel={() => clearPortalStack()}
+ >
+ <PortalContent renderBody={renderBody} />
+ </ImperativeModal>
+ );
+};
+
+export default MobilePortal;
diff --git a/src/features/Portal/router.tsx b/src/features/Portal/router.tsx
index 4694fcac6f8..d4c3257fdfb 100644
--- a/src/features/Portal/router.tsx
+++ b/src/features/Portal/router.tsx
@@ -7,6 +7,7 @@ import { chatPortalSelectors } from '@/store/chat/selectors';
import { PortalViewType } from '@/store/chat/slices/portal/initialState';
import { Acceptance } from './Acceptance';
+import { AcceptanceCheck } from './AcceptanceCheck';
import { AgentDetail } from './AgentDetail';
import { Artifacts } from './Artifacts';
import Header from './components/Header';
@@ -27,6 +28,7 @@ import { VerifyResult } from './VerifyResult';
// View type to component mapping
const VIEW_COMPONENTS: Record<PortalViewType, PortalImpl> = {
[PortalViewType.Acceptance]: Acceptance,
+ [PortalViewType.AcceptanceCheck]: AcceptanceCheck,
[PortalViewType.AgentDetail]: AgentDetail,
[PortalViewType.Home]: {
Body: HomeBody,
diff --git a/src/features/Verify/Acceptance/CheckList.tsx b/src/features/Verify/Acceptance/CheckList.tsx
index ed268db4367..3afeefe147b 100644
--- a/src/features/Verify/Acceptance/CheckList.tsx
+++ b/src/features/Verify/Acceptance/CheckList.tsx
@@ -105,6 +105,22 @@ const STATE_META: Record<AcceptanceCheckState, { color: string; icon: typeof Che
uncertain: { color: cssVar.colorWarning, icon: HelpCircle },
};
+/** Canonical verdict glyph for every surface that presents an Acceptance check. */
+export const checkHeadMeta = (check: AcceptanceCheck) => {
+ const meta = STATE_META[check.state];
+ const reviewState = userReviewState(check);
+
+ if (reviewState === 'rejected') {
+ return { color: cssVar.colorError, icon: MessageSquareX };
+ }
+
+ if (check.state === 'passed' && reviewState === 'accepted') {
+ return { color: cssVar.colorSuccess, icon: CheckCheck };
+ }
+
+ return meta;
+};
+
export const isException = (check: AcceptanceCheck) =>
check.state === 'failed' || check.state === 'uncertain';
diff --git a/src/features/Verify/hooks.test.ts b/src/features/Verify/hooks.test.ts
index 0eee71061ae..f906163eadf 100644
--- a/src/features/Verify/hooks.test.ts
+++ b/src/features/Verify/hooks.test.ts
@@ -7,7 +7,11 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import { verifyService } from '@/services/verify';
-import { useVerifyReportBundle, useVerifyReportSummariesInfinite } from './hooks';
+import {
+ useAcceptanceBySubject,
+ useVerifyReportBundle,
+ useVerifyReportSummariesInfinite,
+} from './hooks';
const useSWRInfiniteMock = vi.hoisted(() => vi.fn());
@@ -53,6 +57,19 @@ describe('Verify data hooks', () => {
expect(getReportBundle).toHaveBeenCalledTimes(1);
});
+ it('loads an acceptance by its task subject identifier', async () => {
+ const getAcceptanceBySubject = vi
+ .spyOn(verifyService, 'getAcceptanceBySubject')
+ .mockResolvedValue({ id: 'acceptance-1' } as never);
+
+ const { result } = renderHook(() => useAcceptanceBySubject('task', 'T-231'), {
+ wrapper: createSWRWrapper(new Map()),
+ });
+
+ await waitFor(() => expect(result.current.data).toEqual({ id: 'acceptance-1' }));
+ expect(getAcceptanceBySubject).toHaveBeenCalledWith('task', 'T-231');
+ });
+
it('keeps loaded reports visible while SWR revalidates after a remount', () => {
useSWRInfiniteMock.mockReturnValue(
mockInfiniteResponse({
diff --git a/src/features/Verify/hooks.ts b/src/features/Verify/hooks.ts
index 9483925ee9b..42f33d84fc0 100644
--- a/src/features/Verify/hooks.ts
+++ b/src/features/Verify/hooks.ts
@@ -1,3 +1,4 @@
+import type { AcceptanceSubjectType } from '@lobechat/types';
import { useCallback, useEffect } from 'react';
import useSWRInfinite from 'swr/infinite';
@@ -52,6 +53,17 @@ export const useAcceptanceBundle = (acceptanceId: string | null) =>
ACCEPTANCE_BUNDLE_SWR_CONFIG,
);
+/** The optional acceptance aggregate attached to a task/topic/document subject. */
+export const useAcceptanceBySubject = (
+ subjectType: AcceptanceSubjectType,
+ subjectId: string | null,
+) =>
+ useClientDataSWR(
+ subjectId ? verifyKeys.acceptanceBySubject(subjectType, subjectId) : null,
+ () => verifyService.getAcceptanceBySubject(subjectType, subjectId!),
+ ACCEPTANCE_BUNDLE_SWR_CONFIG,
+ );
+
/** The caller's recent acceptance aggregates (with subject headers) — the list panel. */
export const useAcceptanceList = (enabled: boolean) =>
useClientDataSWR(
diff --git a/src/features/Verify/index.ts b/src/features/Verify/index.ts
index 51d9e118c4e..b17f1470e9d 100644
--- a/src/features/Verify/index.ts
+++ b/src/features/Verify/index.ts
@@ -1,9 +1,12 @@
export { default as AcceptanceViewer } from './Acceptance';
+export type { AcceptanceCheck, CheckReviewInput } from './Acceptance/CheckList';
+export { checkHeadMeta, FocusedCheckDetails, groupChecks } from './Acceptance/CheckList';
export { default as AcceptanceWorkspace } from './Acceptance/Workspace';
export { default as AcceptanceEmptyDetail } from './Acceptance/Workspace/EmptyDetail';
export { default as CheckerDock } from './CheckerDock';
export {
useAcceptanceBundle,
+ useAcceptanceBySubject,
useVerifyReportSummariesInfinite,
useVerifyResults,
useVerifyState,
diff --git a/src/routes/(main)/agent/features/Portal/_layout/Mobile.tsx b/src/routes/(main)/agent/features/Portal/_layout/Mobile.tsx
index 4ff0fbce194..4d7b9fa0d3e 100644
--- a/src/routes/(main)/agent/features/Portal/_layout/Mobile.tsx
+++ b/src/routes/(main)/agent/features/Portal/_layout/Mobile.tsx
@@ -1,59 +1 @@
-'use client';
-
-import { Flexbox } from '@lobehub/ui';
-import { createStaticStyles, cx } from 'antd-style';
-import { type ReactNode } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import ImperativeModal from '@/components/ImperativeModal';
-import { PortalContent } from '@/features/Portal/router';
-import { useChatStore } from '@/store/chat';
-import { portalThreadSelectors } from '@/store/chat/selectors';
-
-const styles = createStaticStyles(({ css, cssVar }) => ({
- container: css`
- background: linear-gradient(${cssVar.colorBgElevated}, ${cssVar.colorBgContainer}) !important;
- `,
-}));
-
-const Layout = () => {
- const [showMobilePortal, isPortalThread, clearPortalStack] = useChatStore((s) => [
- s.showPortal,
- portalThreadSelectors.showThread(s),
- s.clearPortalStack,
- ]);
- const { t } = useTranslation('portal');
-
- const renderBody = (body: ReactNode) => (
- <Flexbox gap={8} height={'calc(100% - 52px)'} padding={'0 8px'} style={{ overflow: 'hidden' }}>
- <Flexbox
- height={'100%'}
- style={{ marginInline: -8, overflow: 'hidden', position: 'relative' }}
- width={'calc(100% + 16px)'}
- >
- {body}
- </Flexbox>
- </Flexbox>
- );
-
- return (
- <ImperativeModal
- allowFullscreen
- destroyOnHidden
- className={cx(isPortalThread && styles.container)}
- footer={null}
- height={'95%'}
- open={showMobilePortal}
- title={t('title')}
- styles={{
- body: { padding: 0 },
- header: { display: 'none' },
- }}
- onCancel={() => clearPortalStack()}
- >
- <PortalContent renderBody={renderBody} />
- </ImperativeModal>
- );
-};
-
-export default Layout;
+export { default } from '@/features/Portal/Mobile';
diff --git a/src/store/chat/slices/portal/action.ts b/src/store/chat/slices/portal/action.ts
index 22ad81f7783..b1917f9f11d 100644
--- a/src/store/chat/slices/portal/action.ts
+++ b/src/store/chat/slices/portal/action.ts
@@ -582,6 +582,10 @@ export class ChatPortalActionImpl {
this.#get().pushPortalView({ acceptanceId, type: PortalViewType.Acceptance });
};
+ openAcceptanceCheck = (acceptanceId: string, checkId: string): void => {
+ this.#get().pushPortalView({ acceptanceId, checkId, type: PortalViewType.AcceptanceCheck });
+ };
+
openMessageDetail = (messageId: string): void => {
this.#get().pushPortalView({ messageId, type: PortalViewType.MessageDetail });
};
diff --git a/src/store/chat/slices/portal/initialState.ts b/src/store/chat/slices/portal/initialState.ts
index 0a3c31c48d6..c35c53a6865 100644
--- a/src/store/chat/slices/portal/initialState.ts
+++ b/src/store/chat/slices/portal/initialState.ts
@@ -9,6 +9,7 @@ export enum ArtifactDisplayMode {
export enum PortalViewType {
Acceptance = 'acceptance',
+ AcceptanceCheck = 'acceptanceCheck',
AgentDetail = 'agentDetail',
Artifact = 'artifact',
Document = 'document',
@@ -45,6 +46,7 @@ export interface OpenLocalFileEntry extends OpenLocalFileParams {
export type PortalViewData =
| { type: PortalViewType.Home }
| { acceptanceId: string; type: PortalViewType.Acceptance }
+ | { acceptanceId: string; checkId: string; type: PortalViewType.AcceptanceCheck }
| { agentId: string; type: PortalViewType.AgentDetail }
| { artifact: PortalArtifact; type: PortalViewType.Artifact }
| { agentDocumentId?: string; documentId: string; type: PortalViewType.Document }
diff --git a/src/store/chat/slices/portal/selectors.ts b/src/store/chat/slices/portal/selectors.ts
index 6e2b9acb988..06542894d00 100644
--- a/src/store/chat/slices/portal/selectors.ts
+++ b/src/store/chat/slices/portal/selectors.ts
@@ -241,6 +241,7 @@ const verifyResultCheckItemId = (s: ChatStoreState) => currentVerifyResult(s)?.c
const verifyReportRunId = (s: ChatStoreState) => getViewData(s, PortalViewType.VerifyReport)?.runId;
const acceptancePortalId = (s: ChatStoreState) =>
getViewData(s, PortalViewType.Acceptance)?.acceptanceId;
+const acceptanceCheckPortal = (s: ChatStoreState) => getViewData(s, PortalViewType.AcceptanceCheck);
const isPluginUIOpen = (id: string) => (s: ChatStoreState) =>
toolMessageId(s) === id && showPortal(s);
@@ -316,6 +317,7 @@ export const chatPortalSelectors = {
verifyReportRunId,
// Acceptance data
+ acceptanceCheckPortal,
acceptancePortalId,
};