🤯 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
♻️ refactor: organize acceptance viewer and improve mobile flow review (#19290)
Arvin Xu9a71b5e0d4df
diff --git a/.agents/skills/compose-atoms/SKILL.md b/.agents/skills/compose-atoms/SKILL.mdindex d17d9e323c1..35527ee61f5 100644--- a/.agents/skills/compose-atoms/SKILL.md+++ b/.agents/skills/compose-atoms/SKILL.md@@ -165,7 +165,7 @@ The feature barrel may export the **full** assembler for in-app use. Light hosts```bash# example: light host must not import a write atom-WORKBENCH_TRACE_MODULE=features/Acceptance/Viewer/AcceptanceDecision bun run build:rr+WORKBENCH_TRACE_MODULE=features/Acceptance/Viewer/Review/AcceptanceDecision bun run build:rr```If the light assembler appears on the importer chain, a static import still exists — usually a barrel, a leftover flag, or actions left on the page.diff --git a/.agents/skills/split-micro-app/SKILL.md b/.agents/skills/split-micro-app/SKILL.mdindex a1b929e06bc..c8ab5dd6b3d 100644--- a/.agents/skills/split-micro-app/SKILL.md+++ b/.agents/skills/split-micro-app/SKILL.md@@ -87,7 +87,7 @@ tsconfig `include` must cover `app/`). Stack: `@react-router/dev@8` + `@cloudfla| Client-shim lambda | Client `@/libs/trpc/client` is a cookie-only `httpLink` (`trpcClient.client.ts`). Do not ship the real `lambda.ts` — its `headers()` pulls image store → chat store + `model-bank` catalog. || SSR-stub shiki langs | On the SSR env, resolve `@shikijs/langs` / `@shikijs/themes` / shiki's `langs-bundle` / `themes` / wasm to `app/stubs/shiki.ts`. Do **not** stub the `shiki` package entry — Pierre diffs and Highlighter import named APIs from it. || Client shiki from CDN | On the client env, resolve `shiki` / `shiki/*` / `@shikijs/*` to pinned `https://esm.sh/...@<installed shiki version>` as externals. Do not bundle grammars or wasm into `build/client`. |-| Slot-inject app-only features | Context seam owned by the shared feature (see `src/features/Acceptance/Viewer/originConversation.tsx`); app provides, micro app leaves null → affordances hide |+| Slot-inject app-only features | Context seam owned by the shared feature (see `src/features/Acceptance/Viewer/Conversation/originConversation.tsx`); app provides, micro app leaves null → affordances hide || Bypass barrels | Deep-path imports (`@/features/Acceptance/Acceptance`, not the barrel) — barrels evaluate sibling exports with side effects || Compose capability atoms | Shared UI is assembled per surface; the light app never imports the fat viewer. See **`compose-atoms`**. Do not add `readOnly` on the in-app page || Decouple dual-use components | Lift store reads to optional props (see AudioPlayer `uploadState`/`onCancelUpload`) |diff --git a/apps/cli/src/commands/acceptanceFlow.test.ts b/apps/cli/src/commands/acceptanceFlow.test.tsindex f9e556c53d8..1ed0c0f6094 100644--- a/apps/cli/src/commands/acceptanceFlow.test.ts+++ b/apps/cli/src/commands/acceptanceFlow.test.ts@@ -9,7 +9,9 @@ const { startFlow, outputJson } = vi.hoisted(() => ({}));vi.mock('../api/client', () => ({- getTrpcClient: async () => ({ acceptance: { startFlow: { mutate: startFlow } } }),+ getTrpcClient: async () => ({+ acceptance: { startFlow: { mutate: startFlow } },+ }),}));vi.mock('../utils/format', () => ({ outputJson }));@@ -58,3 +60,25 @@ it('allows a fresh verification round when --run is omitted', async () => {verifyRunId: undefined,});});++it('prepares a flow for review through the plan command', async () => {+ startFlow.mockClear();+ const program = new Command().exitOverride();+ attachAcceptanceFlowCommands(program.command('acceptance'));+ await program.parseAsync([+ 'node',+ 'lh',+ 'acceptance',+ 'flow',+ 'plan',+ 'acceptance-id',+ '--flow',+ 'flow-id',+ ]);+ expect(startFlow).toHaveBeenCalledWith({+ id: 'acceptance-id',+ flowId: 'flow-id',+ sourceRunId: undefined,+ verifyRunId: undefined,+ });+});diff --git a/apps/cli/src/commands/acceptanceFlow.ts b/apps/cli/src/commands/acceptanceFlow.tsindex f5a21553adb..f009dc1e176 100644--- a/apps/cli/src/commands/acceptanceFlow.ts+++ b/apps/cli/src/commands/acceptanceFlow.ts@@ -23,7 +23,9 @@ export function attachAcceptanceFlowCommands(acceptance: Command) {outputJson((await client.acceptance.getBundle.query({ id })).flows);});flow- .command('start <acceptanceId>')+ .command('plan <acceptanceId>')+ .alias('start')+ .description('Prepare a frozen flow plan for inspection without executing checks').requiredOption('--flow <id>').option('--run <id>', 'Existing round; omit to create a fresh round for this flow').option('--from-run <id>', 'Replay the frozen definition from a previous round')diff --git a/apps/workbench/app/stubs/surface.test.ts b/apps/workbench/app/stubs/surface.test.tsindex 2b943d1deb5..998c93b2d12 100644--- a/apps/workbench/app/stubs/surface.test.ts+++ b/apps/workbench/app/stubs/surface.test.ts@@ -91,7 +91,7 @@ describe('workbench stub surface', () => {reportStubSurfaceGaps([{- rel: 'src/features/Acceptance/Viewer/attachments.tsx',+ rel: 'src/features/Acceptance/Viewer/Evidence/attachments.tsx',source: `import { useFileStore } from '@/store/file';const removeFile = useFileStore((s) => s.removeFile);`,},@@ -104,7 +104,7 @@ describe('workbench stub surface', () => {],),).toEqual([- ' src/features/Acceptance/Viewer/attachments.tsx\n @/store/file: useFileStore.removeFile',+ ' src/features/Acceptance/Viewer/Evidence/attachments.tsx\n @/store/file: useFileStore.removeFile',]);});});diff --git a/apps/workbench/src/features/acceptance/AcceptanceDetail.tsx b/apps/workbench/src/features/acceptance/AcceptanceDetail.tsxindex a008b248bb7..da2a359d84c 100644--- a/apps/workbench/src/features/acceptance/AcceptanceDetail.tsx+++ b/apps/workbench/src/features/acceptance/AcceptanceDetail.tsx@@ -6,13 +6,13 @@ import { createStaticStyles, cssVar } from 'antd-style';import { useParams } from 'react-router';import { extractUuid } from '@/features/Acceptance/utils';-import AcceptanceCheckInventory from '@/features/Acceptance/Viewer/AcceptanceCheckInventory';-import AcceptanceGoal from '@/features/Acceptance/Viewer/AcceptanceGoal';-import AcceptanceIdentity from '@/features/Acceptance/Viewer/AcceptanceIdentity';import {AcceptanceBundleGate,AcceptanceScope,} from '@/features/Acceptance/Viewer/AcceptanceScope';+import AcceptanceCheckInventory from '@/features/Acceptance/Viewer/Checks/AcceptanceCheckInventory';+import AcceptanceGoal from '@/features/Acceptance/Viewer/Header/AcceptanceGoal';+import AcceptanceIdentity from '@/features/Acceptance/Viewer/Header/AcceptanceIdentity';import { useAcceptanceBundle } from '@/features/Acceptance/Viewer/useAcceptanceBundle';import { WorkbenchHeader } from '../../shell/WorkbenchHeader';diff --git a/locales/en-US/verify.json b/locales/en-US/verify.jsonindex 770df63c8d5..442af502054 100644--- a/locales/en-US/verify.json+++ b/locales/en-US/verify.json@@ -492,13 +492,19 @@"flow.expandAll": "Expand all","flow.expandGroup": "Expand {{title}}","flow.expected": "Expected behavior",+ "flow.graphView": "Graph","flow.groupProgress": "{{passed}} / {{total}} verified","flow.groupReviewed": "{{count}} accepted","flow.instruction": "How to reach this state","flow.latestResult": "Latest result","flow.noAttachments": "No additional evidence attached. See the observation above.","flow.nodeCount": "{{count}} nodes",+ "flow.outlineView": "Steps","flow.pendingPlan": "Pending verification plan",+ "flow.plan.actionError": "Unable to update the flow plan. Refresh and review the latest plan before retrying.",+ "flow.plan.feedbackDescription": "Describe which journeys, branches or expected outcomes need to change.",+ "flow.plan.label": "Acceptance flow plan",+ "flow.plan.requestChanges": "Request changes","flow.planned": "Plan published · verification has not started","flow.rerunVersion": "Rerun this version","flow.resultHistory": "{{count}} verification records",diff --git a/locales/zh-CN/verify.json b/locales/zh-CN/verify.jsonindex ec9f0d627ef..4b1f2d59e5b 100644--- a/locales/zh-CN/verify.json+++ b/locales/zh-CN/verify.json@@ -492,13 +492,19 @@"flow.expandAll": "全部展开","flow.expandGroup": "展开{{title}}","flow.expected": "预期表现",+ "flow.graphView": "关系图","flow.groupProgress": "{{passed}} / {{total}} 项验证通过","flow.groupReviewed": "{{count}} 项已验收","flow.instruction": "如何到达此状态","flow.latestResult": "最新结果","flow.noAttachments": "暂无附加证据,可先查看上方实际结果。","flow.nodeCount": "{{count}} 个节点",+ "flow.outlineView": "步骤","flow.pendingPlan": "待验证计划",+ "flow.plan.actionError": "流程计划更新失败,请刷新并检查最新计划后重试。",+ "flow.plan.feedbackDescription": "说明哪些业务流程、分支或预期结果需要调整。",+ "flow.plan.label": "验收流程计划",+ "flow.plan.requestChanges": "需要调整","flow.planned": "流程已发布 · 尚未开始验证","flow.rerunVersion": "复跑此版本","flow.resultHistory": "{{count}} 条验证记录",diff --git a/packages/builtin-skills/src/acceptance/SKILL.md b/packages/builtin-skills/src/acceptance/SKILL.mdindex 4871461b70d..94f6d8ce016 100644--- a/packages/builtin-skills/src/acceptance/SKILL.md+++ b/packages/builtin-skills/src/acceptance/SKILL.md@@ -102,8 +102,8 @@ substitute a private agent plugin.## Optional user-journey flows-When acceptance depends on a sequence of user states, publish its graph before-exercising the product. Keep the checklist paths above for independent checks;+When acceptance depends on a sequence of user states, publish its graph during+planning, before implementation or verification begins. Keep the checklist paths above for independent checks;a graph is optional and does not replace evidence or human review.1. Use the named acceptance (or create one with `lh acceptance create --help`).@@ -118,25 +118,33 @@ a graph is optional and does not replace evidence or human review.definition and returns `flowId`. To edit it, include that `flowId` and thecurrent `expectedHash` in the file. `lh acceptance flow view <acceptanceId>`reads definitions, snapshots and results. Publishing does not execute checks.-3. `lh acceptance flow start <acceptanceId> --flow <flowId>` creates a round+3. `lh acceptance flow plan <acceptanceId> --flow <flowId>` creates a draft roundwith a frozen graph and plan. Add `--run <verifyRunId>` to attach another flowto the same open round. Read `lh acceptance run get <verifyRunId> --json` forthe actual plan IDs: each branch and subflow invocation has its own`checkItemId`; never substitute the reusable asset ID.-4. Exercise the real product, then use+4. Share the acceptance link so the user can inspect the proposed nodes, branches+ and expected outcomes before implementation. Read and address any actionable+ feedback. Preparing a plan neither executes checks nor approves delivery;+ there is no separate flow-confirmation action. Continue within the user's+ authorized scope, or pause if the user explicitly asked to review before work.+ For requested changes, publish the revised definition and prepare a new draft+ round in the same acceptance.+5. Implement the work and exercise the real product, then use`lh acceptance flow record <acceptanceId> --file result.json`, containing`verifyRunId`, `checkItemId`, `verdict` (`passed`, `failed`, `uncertain`, or`blocked`) and `observation`. Record only what was observed. Use the returnedresult ID to attach required artifacts through `lh acceptance run evidence`(inspect its `--help`), following the same evidence rules as checklist checks.-5. After all required checks are recorded and passed, run+6. After all required checks are recorded and passed, run`lh acceptance flow complete <acceptanceId> --run <verifyRunId>`. Completionsettles verification; it does not accept the delivery on the user's behalf.Read back the round and verify evidence coverage before handing it over.-To rerun the exact old graph, start with `--from-run <sourceVerifyRunId>` and+To rerun the exact old graph, prepare a plan with `--from-run <sourceVerifyRunId>` andomit `--run` for a fresh round. This preserves the old definition and starts-without results. Accepted or closed acceptances must be explicitly reopened+without results. Each replay starts as an unexecuted draft. Accepted or closed+acceptances must be explicitly reopenedbefore starting. Edges describe business transitions; they do not automaticallyschedule execution. Continue to read `lh acceptance feedback <acceptanceId> --actionable` before repairs and publish new rounds into the same acceptance.diff --git a/packages/database/src/models/__tests__/acceptanceFlow.test.ts b/packages/database/src/models/__tests__/acceptanceFlow.test.tsindex a3e048f22b6..a8899728270 100644--- a/packages/database/src/models/__tests__/acceptanceFlow.test.ts+++ b/packages/database/src/models/__tests__/acceptanceFlow.test.ts@@ -106,6 +106,23 @@ describe('check assets and round snapshots', () => {},);+ it('records a prepared draft without a separate confirmation and freezes it on execution', async () => {+ const { flowId } = await model.publish(acceptanceId, definition);+ const run = await model.start(acceptanceId, flowId);+ const draft = await roundPlan(run.id);+ expect(draft.planConfirmedAt).toBeNull();+ await model.record(acceptanceId, {+ verifyRunId: run.id,+ checkItemId: draft.plan![0].id,+ verdict: 'passed',+ observation: 'Execution after inspecting the draft requires no extra confirmation',+ });+ expect((await roundPlan(run.id)).status).toBe('collecting_evidence');+ expect((await roundPlan(run.id)).planConfirmedAt).not.toBeNull();+ const replay = await model.start(acceptanceId, flowId, undefined, run.id);+ expect((await roundPlan(replay.id)).planConfirmedAt).toBeNull();+ });+it('creates assets before execution and instantiates each incoming branch in the canonical plan', async () => {const published = await model.publish(acceptanceId, definition);expect(diff --git a/packages/locales/src/default/verify.ts b/packages/locales/src/default/verify.tsindex c289d6a7abb..8de4cbf112c 100644--- a/packages/locales/src/default/verify.ts+++ b/packages/locales/src/default/verify.ts@@ -1,4 +1,13 @@export default {+ 'flow.graphView': 'Graph',+ 'flow.outlineView': 'Steps',+ 'flow.plan.requestChanges': 'Request changes',+ 'flow.plan.feedbackDescription':+ 'Describe which journeys, branches or expected outcomes need to change.',+ 'flow.plan.label': 'Acceptance flow plan',+ 'flow.plan.actionError':+ 'Unable to update the flow plan. Refresh and review the latest plan before retrying.',+'acceptance.review.submitFailed': 'Could not submit. Your draft is saved; please try again.','acceptance.bar.mobileProgress': 'Delivery: {{done}} / {{total}} reviewed','acceptance.review.historicalReadOnly':diff --git a/src/features/Acceptance/Viewer/AcceptanceOverview.tsx b/src/features/Acceptance/Viewer/AcceptanceOverview.tsxnew file mode 100644index 00000000000..f2f4b838f8a--- /dev/null+++ b/src/features/Acceptance/Viewer/AcceptanceOverview.tsx@@ -0,0 +1,126 @@+'use client';++import { Flexbox } from '@lobehub/ui';+import { createStaticStyles, cssVar, useResponsive } from 'antd-style';+import { useState } from 'react';++import { useAcceptanceScope } from './AcceptanceScope';+import AcceptanceCheckInventory from './Checks/AcceptanceCheckInventory';+import AcceptanceCheckOwnerToolbar from './Checks/AcceptanceCheckOwnerToolbar';+import AcceptanceOriginTopic from './Conversation/AcceptanceOriginTopic';+import AcceptanceResources from './Evidence/AcceptanceResources';+import { AcceptanceFlow } from './Flow/AcceptanceFlow';+import { getFlowNodeCount, resolveAcceptanceTab } from './Flow/flowNavigation';+import AcceptanceEnterFocus from './Focus/AcceptanceEnterFocus';+import AcceptanceGoal from './Header/AcceptanceGoal';+import AcceptanceGoalEdit from './Header/AcceptanceGoalEdit';+import AcceptanceIdentity from './Header/AcceptanceIdentity';+import AcceptanceSharedNotice from './Header/AcceptanceSharedNotice';+import AcceptanceStatusControl from './Header/AcceptanceStatusControl';+import type { AcceptanceTabKey } from './Header/AcceptanceTabs';+import AcceptanceTabs from './Header/AcceptanceTabs';+import { acceptanceContentLayout } from './layout';+import { flowPlanPhase } from './Plan/planReview';+import AcceptanceDecision from './Review/AcceptanceDecision';+import { checksForTurn } from './turnChecks';+import { useAcceptanceBundle } from './useAcceptanceBundle';+import { useAcceptanceTurn } from './useAcceptanceTurn';++const styles = createStaticStyles(({ css }) => ({+ column: css`+ width: 100%;+ max-width: ${acceptanceContentLayout.maxWidth}px;+ margin-inline: auto;+ padding-inline: 24px;++ @media (width <= 767px) {+ padding-inline: 16px;+ }+ `,+ headerBand: css`+ flex: none;+ padding-block: 20px 0;+ border-block-end: 1px solid ${cssVar.colorBorderSecondary};+ `,+}));+interface AcceptancePageProps {+ onDraftToComposer?: (text: string) => boolean;+}++/**+ * The record's own body: an identity band that ends in the full-width rule,+ * then whichever face of the delivery the tabs select.+ */+export const AcceptanceOverview = ({+ onDraftToComposer,+}: Pick<AcceptancePageProps, 'onDraftToComposer'>) => {+ const { md = false } = useResponsive();+ const { acceptanceId, embedded } = useAcceptanceScope();+ const { turn } = useAcceptanceTurn(embedded);+ const { data } = useAcceptanceBundle(acceptanceId);+ const [requestedTab, setTab] = useState<AcceptanceTabKey>();+ const flowCount = getFlowNodeCount(data?.flows);+ const tab = resolveAcceptanceTab(+ requestedTab,+ flowCount,+ Boolean(flowPlanPhase(data?.rounds.at(-1))),+ md,+ );+ const checks = data ? checksForTurn(data, turn) : [];+ const resourceCount = new Set(+ checks.flatMap((check) =>+ (check.evidence ?? [])+ .filter((evidence) => evidence.fileUrl || evidence.documentId)+ .map((evidence) => evidence.fileId ?? evidence.documentId ?? evidence.id),+ ),+ ).size;++ return (+ <>+ <Flexbox className={styles.headerBand}>+ <Flexbox className={styles.column} gap={12}>+ <AcceptanceSharedNotice />+ <AcceptanceIdentity+ focusSlot={<AcceptanceEnterFocus />}+ statusSlot={<AcceptanceStatusControl />}+ topicSlot={<AcceptanceOriginTopic />}+ />+ <AcceptanceGoal editSlot={<AcceptanceGoalEdit />} />+ {/* The requirement needs room to land before the tabs start a new+ thought — at the band's uniform gap it read as another row of+ the same list. */}+ <Flexbox style={{ paddingBlockStart: 16 }}>+ <AcceptanceTabs+ active={tab}+ checkCount={checks.length}+ flowCount={md ? flowCount : 0}+ resourceCount={resourceCount}+ onChange={setTab}+ />+ </Flexbox>+ </Flexbox>+ </Flexbox>++ <Flexbox+ className={styles.column}+ gap={16}+ paddingBlock={20}+ style={tab === 'flow' ? { maxWidth: 1500 } : undefined}+ >+ {tab === 'flow' ? (+ <>+ <AcceptanceFlow />+ <AcceptanceDecision onDraftToComposer={onDraftToComposer} />+ </>+ ) : tab === 'checks' ? (+ <>+ <AcceptanceCheckInventory toolbar={<AcceptanceCheckOwnerToolbar />} />+ <AcceptanceDecision onDraftToComposer={onDraftToComposer} />+ </>+ ) : (+ <AcceptanceResources />+ )}+ </Flexbox>+ </>+ );+};diff --git a/src/features/Acceptance/Viewer/CheckList.tsx b/src/features/Acceptance/Viewer/CheckList.tsxdeleted file mode 100644index be48e7941cc..00000000000--- a/src/features/Acceptance/Viewer/CheckList.tsx+++ /dev/null@@ -1,2147 +0,0 @@-'use client';--import type {- AcceptanceGroupFeedback,- AcceptanceRejectIntent,- AcceptanceReviewAnnotation,- ReviewAdjudication,- ReviewProposalEdit,-} from '@lobechat/types';-import { copyToClipboard, Empty, Flexbox, Icon, Image, TextArea, Tooltip } from '@lobehub/ui';-import { ActionIcon, Button, Tag, Text } from '@lobehub/ui/base-ui';-import { createStaticStyles, cssVar, cx, useResponsive } from 'antd-style';-import dayjs from 'dayjs';-import {- AudioLines,- BadgeCheck,- Ban,- Check,- CheckCheck,- ChevronRight,- ChevronsDownUp,- ChevronsUpDown,- CircleDashed,- FileText,- Film,- HelpCircle,- Images,- MessageSquareText,- MessageSquareX,- PartyPopper,- Repeat,- Route,- XCircle,-} from 'lucide-react';-import { Fragment, memo, useMemo, useState } from 'react';-import { useTranslation } from 'react-i18next';--import AudioPlayer from '@/features/AudioPlayer';-import { useIsHydrated } from '@/hooks/useIsHydrated';-import type { AcceptanceBundle } from '@/services/verify';--import {- EvidenceComparisonCard,- meaningfulEvidenceCaption,- readEvidenceComparison,-} from '../Report/EvidenceComparisonCard';-import {- CollapsibleMarkdownEvidence,- EvidenceFileCard,- markdownTextEvidenceTypes,-} from '../Report/MarkdownEvidence';-import { hasRenderableEvidence, readVisualizationManifest } from '../Report/visualization';-import { VisualizationDeltaBadge, VisualizationRenderer } from '../Report/VisualizationRenderer';-import { checkDisplayTitle } from '../utils';-import { AnnotatedImage } from './Annotation';-import { AttachmentThumbs } from './attachments';-import { openCheckRejectModal } from './CheckRejectModal';-import { openGroupFeedbackModal } from './modals';-import type { CheckProposal } from './proposal';-import { classifyProposalEdit } from './proposal';-import ProposalCard from './ProposalCard';-import { ScreenshotTiles } from './ScreenshotTiles';--export type AcceptanceCheck = AcceptanceBundle['checks'][number];-export type AcceptanceCheckState = AcceptanceCheck['state'];-type AcceptanceEvidence = AcceptanceCheck['evidence'][number];-type AcceptanceCheckReviewEntry = AcceptanceCheck['reviews'][number];--export const CHECK_GROUPING_THRESHOLD = 10;--/** Small checklists stay flat; grouping only earns its hierarchy once the list grows beyond 10. */-export const shouldGroupChecks = (checkCount: number) => checkCount > CHECK_GROUPING_THRESHOLD;--/** What the user asked the page to record — the page owns the service call. */-export interface CheckReviewInput {- action: 'accept' | 'ignore' | 'reject';- annotations?: AcceptanceReviewAnnotation[];- checkItemIds: string[];- comment?: string;- fileIds?: string[];- /** Present when this decision answered a model proposal. */- proposal?: { adjudication: ReviewAdjudication; edit?: ReviewProposalEdit; predictionId: string };- /** Which of the three jobs a reject is doing. */- rejectIntent?: AcceptanceRejectIntent;-}--/** Answering a model proposal without ruling on the check. */-export interface ProposalDismissInput {- adjudication: 'misidentified' | 'not-an-issue';- checkItemId: string;- predictionId: string;-}--/** The user's standing verdict on a check — `pending` means "awaiting your confirmation". */-export type UserReviewState = 'accepted' | 'ignored' | 'pending' | 'rejected';--export const userReviewState = (check: AcceptanceCheck): UserReviewState => {- const review = check.userReview;- if (!review || review.stale) return 'pending';- if (review.action === 'accept') return 'accepted';- if (review.action === 'ignore') return 'ignored';- return 'rejected';-};--/** Accepted and ignored checks are terminal — there is no remaining work to send back. */-export const isCheckWorkActionable = (check: AcceptanceCheck): boolean =>- ['pending', 'rejected'].includes(userReviewState(check));--/** A successful review decision moves the reviewer forward by folding the finished row. */-export const shouldCollapseAfterReview = (succeeded: boolean, expanded: boolean): boolean =>- succeeded && expanded;--/** Every reviewable check in the group is user-accepted — settled business. */-export const isGroupFullyAccepted = (checks: AcceptanceCheck[]): boolean => {- const reviewable = checks.filter((check) => check.result);- return (- reviewable.length > 0 && reviewable.every((check) => userReviewState(check) === 'accepted')- );-};--/** Unresolved-first ordering — exceptions are what the decision hinges on. */-const SEVERITY: Record<AcceptanceCheckState, number> = {- failed: 0,- not_executed: 2,- passed: 3,- uncertain: 1,-};--/**- * Verdict iconography: a bare check for passed (no ring), doubling into a- * bare double-check once the human signs it off — one icon slot, read like a- * delivery receipt. Non-passed states keep their ringed marks.- */-const STATE_META: Record<AcceptanceCheckState, { color: string; icon: typeof Check }> = {- failed: { color: cssVar.colorError, icon: XCircle },- not_executed: { color: cssVar.colorTextQuaternary, icon: CircleDashed },- passed: { color: cssVar.colorSuccess, icon: Check },- 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';--const IMAGE_EVIDENCE = new Set(['gif', 'screenshot']);-/** Rendered by a `<video>` / `<audio>` element rather than an image box. */-const PLAYER_EVIDENCE = new Set(['audio', 'video']);-/** Everything that shows or plays inline — the deliverable itself, not a log about it. */-const MEDIA_EVIDENCE = new Set([...IMAGE_EVIDENCE, ...PLAYER_EVIDENCE]);-const ANNOTATABLE_EVIDENCE = IMAGE_EVIDENCE;--const isVisual = (item: AcceptanceEvidence) =>- Boolean(item.fileUrl) && MEDIA_EVIDENCE.has(item.type);--export const hasVisualEvidence = (check: AcceptanceCheck) => check.evidence.some(isVisual);--const isAnnotatable = (item: AcceptanceEvidence) =>- Boolean(item.fileUrl) && ANNOTATABLE_EVIDENCE.has(item.type);--export const hasAnnotatableEvidence = (check: AcceptanceCheck) =>- check.evidence.some(isAnnotatable);--const styles = createStaticStyles(({ css }) => ({- caption: css`- align-self: center;- font-size: 12px;- color: ${cssVar.colorTextTertiary};- `,- chip: css`- padding-inline: 6px;- border-radius: 4px;-- font-size: 11px;- line-height: 18px;- color: ${cssVar.colorTextTertiary};- white-space: nowrap;-- background: ${cssVar.colorFillTertiary};- `,- chipClickable: css`- cursor: pointer;-- &:hover {- color: ${cssVar.colorText};- background: ${cssVar.colorFillSecondary};- }- `,- evidenceImage: css`- overflow: hidden;-- width: fit-content;- max-width: 100%;- border: 1px solid ${cssVar.colorBorderSecondary};- border-radius: ${cssVar.borderRadiusLG};- `,- evidenceText: css`- overflow: auto;-- max-height: 200px;- padding-block: 8px;- padding-inline: 12px;- border-radius: ${cssVar.borderRadius};-- font-family: ${cssVar.fontFamilyCode};- font-size: 12px;- white-space: pre-wrap;-- background: ${cssVar.colorFillQuaternary};- `,- emptyCard: css`- padding-block: 48px;- padding-inline: 16px;- border: 1px solid ${cssVar.colorBorderSecondary};- border-radius: ${cssVar.borderRadiusLG};-- background: ${cssVar.colorBgContainer};- `,- // The finish-line icon pops in — a small beat of delight the plain empty- // state never earned. Plays once, on the transition into the celebration.- celebrateIcon: css`- @keyframes acceptance-celebrate-pop {- 0% {- transform: scale(0.6);- opacity: 0;- }-- 60% {- transform: scale(1.15);- }-- 100% {- transform: scale(1);- opacity: 1;- }- }-- animation: acceptance-celebrate-pop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both;- `,- /* No card chrome: the row separators alone carry the list's structure. A- border plus inline padding stole horizontal room from every row and made a- long checklist read as a boxed-in panel rather than a dense inventory.- The inline inset lives on each row/group header instead of the card, so- hover washes and the group band still run edge to edge while the text- keeps breathing room on both sides. */- groupCard: css`- background: ${cssVar.colorBgContainer};- `,- groupHeader: css`- cursor: pointer;- padding-block: 10px;- padding-inline: 16px;- background: ${cssVar.colorFillQuaternary};-- .acceptance-group-actions {- opacity: 0;- transition: opacity 0.2s;- }-- &:hover {- .acceptance-group-actions {- opacity: 1;- }- }- `,- historyToggle: css`- cursor: pointer;-- display: inline-flex;- gap: 4px;- align-items: center;-- width: fit-content;-- font-size: 12px;- color: ${cssVar.colorTextTertiary};-- &:hover {- color: ${cssVar.colorText};- }- `,- row: css`- border-block-start: 1px solid ${cssVar.colorBorderSecondary};-- /* The list opens flush with the content above it. Grouped lists are- unaffected: their first child is the group header, so rows are never- first. */- &:first-child {- border-block-start: none;- }- `,- /** Stable check label ("C3") — referenced by feedback and annotations. */- seqChip: css`- flex: none;-- font-family: ${cssVar.fontFamilyCode};- font-size: 11px;- line-height: 22px;- color: ${cssVar.colorTextSecondary};- letter-spacing: 0.02em;- `,- seqChipClickable: css`- cursor: copy;-- &:hover {- color: ${cssVar.colorText};- }- `,- rowActions: css`- opacity: 0;- transition: opacity 0.2s;- `,- rowMeta: css`- transition: opacity 0.2s;-- @media (hover: hover) and (pointer: fine) {- pointer-events: none;- opacity: 0;- }- `,- rowHeader: css`- cursor: pointer;- padding-block: 12px;- padding-inline: 16px;-- &:hover,- &:focus-within {- .acceptance-row-actions {- opacity: 1;- }-- .acceptance-row-meta {- pointer-events: auto;- opacity: 1;- }- }-- /* The hover wash marks the collapsed row as a click target. An OPEN row is- in reading mode — a gray band flashing between the white body and the- white page just severs the title from its content, so no wash there. */- &:not([data-expanded]):hover {- background: ${cssVar.colorFillQuaternary};- }- `,- stepDot: css`- flex: none;-- width: 9px;- height: 9px;- margin-block-start: 5px;- border: 2px solid;- border-radius: 50%;-- background: ${cssVar.colorBgContainer};- `,- stepRail: css`- flex: 1;- width: 1px;- margin-block-start: 6px;- background: ${cssVar.colorBorderSecondary};- `,- titleEllipsis: css`- overflow: hidden;- text-overflow: ellipsis;- white-space: nowrap;- `,-}));--/** Evidence media counts for the collapsed row's right-side badges. */-const evidenceCounts = (evidence: AcceptanceEvidence[]) => {- const counts = { audio: 0, file: 0, image: 0, video: 0 };- for (const item of evidence) {- if (item.type === 'video' && item.fileUrl) counts.video += 1;- else if (item.type === 'audio' && item.fileUrl) counts.audio += 1;- else if (isVisual(item)) counts.image += 1;- else counts.file += 1;- }- return counts;-};--const EVIDENCE_BADGES = [- { icon: Images, key: 'image', labelKey: 'acceptance.evidence.image' },- { icon: Film, key: 'video', labelKey: 'acceptance.evidence.video' },- { icon: AudioLines, key: 'audio', labelKey: 'acceptance.evidence.audio' },- { icon: FileText, key: 'file', labelKey: 'acceptance.evidence.file' },-] as const;--/**- * Reserve the image's box before it loads — with the stored intrinsic size the- * layout never jumps when a row expands and its screenshots stream in.- */-const imageRatio = (item: AcceptanceEvidence): string | undefined =>- item.fileWidth && item.fileHeight ? `${item.fileWidth} / ${item.fileHeight}` : undefined;--/** Flat media for a comparison side — the card frames it, so no own border/radius. */-const comparisonContent = (item: AcceptanceEvidence) => {- if (item.type === 'video')- return <video controls src={item.fileUrl!} style={{ display: 'block', width: '100%' }} />;- if (item.type === 'audio')- return (- <AudioPlayer- fullWidth- alt={item.description ?? item.fileName ?? item.type}- downloadFileName={item.fileName ?? 'audio'}- url={item.fileUrl!}- />- );- if (item.type === 'screenshot' && item.fileUrl)- return (- <ScreenshotTiles- flat- alt={item.description ?? item.fileName ?? item.type}- fileHeight={item.fileHeight}- fileWidth={item.fileWidth}- src={item.fileUrl}- />- );- return (- <Image- preview- alt={item.description ?? item.fileName ?? item.type}- loading={'lazy'}- src={item.fileUrl!}- style={{ aspectRatio: imageRatio(item), borderRadius: 0, width: '100%' }}- variant={'borderless'}- />- );-};--export const EvidenceList = memo<{- evidence: AcceptanceEvidence[];- onReviewEvidence?: (id: string) => void;- /**- * Regions to draw over an evidence image, keyed by evidence id. Used by the- * AI proposal: rather than the card rendering its own copy of the screenshot- * (which showed the same image twice in one row), the boxes land on the image- * that is already here.- */- overlays?: Map<- string,- { comment?: string; label?: number; rect: AcceptanceReviewAnnotation['rect'] }[]- >;-}>(({ evidence, overlays, onReviewEvidence }) => {- const { md = true } = useResponsive();- const sorted = [...evidence].sort((a, b) => (isVisual(b) ? 1 : 0) - (isVisual(a) ? 1 : 0));- if (sorted.length === 0) return null;-- // Before/after pairs render as one fused comparison card (same component as- // the verify report). Only complete pairs fuse; a lone half stays a plain- // artifact, matching the ingest CLI's warning semantics.- const groups = new Map<string, Partial<Record<'after' | 'before', AcceptanceEvidence>>>();- for (const item of sorted) {- if (!isVisual(item)) continue;- const comparison = readEvidenceComparison(item.metadata);- if (!comparison) continue;- const group = groups.get(comparison.id) ?? {};- group[comparison.role] = item;- groups.set(comparison.id, group);- }- const pairedIds = new Set(- [...groups.values()]- .filter((group) => group.before && group.after)- .flatMap((group) => [group.before!.id, group.after!.id]),- );-- const comparisonSide = (item: AcceptanceEvidence) => ({- caption:- readEvidenceComparison(item.metadata)?.label ??- meaningfulEvidenceCaption(item.description) ??- undefined,- content: comparisonContent(item),- });-- const consumedScreenshotIds = new Set<string>();-- return (- <Flexbox gap={12}>- {sorted.map((item) => {- if (consumedScreenshotIds.has(item.id)) return null;- if (pairedIds.has(item.id) && (md || !onReviewEvidence)) {- const comparison = readEvidenceComparison(item.metadata)!;- // The pair renders once, anchored at its `before` half.- if (comparison.role !== 'before') return null;- const group = groups.get(comparison.id)!;- return (- <EvidenceComparisonCard- after={comparisonSide(group.after!)}- before={comparisonSide(group.before!)}- key={comparison.id}- layout={comparison.layout}- />- );- }-- const description = meaningfulEvidenceCaption(item.description);- const caption = description && <span className={styles.caption}>{description}</span>;- if (item.fileUrl && item.type === 'video')- return (- <Flexbox gap={4} key={item.id} style={{ maxWidth: '100%', width: 'fit-content' }}>- <video- controls- src={item.fileUrl}- style={{ borderRadius: 8, maxHeight: 360, maxWidth: '100%', width: 'auto' }}- />- {caption}- </Flexbox>- );- if (item.fileUrl && item.type === 'audio')- return (- <Flexbox gap={4} key={item.id} width={'100%'}>- {/* The conversation's own waveform player — one audio dialect across- the product, with the download the reviewer needs to keep the clip. */}- <AudioPlayer- fullWidth- alt={item.description ?? item.fileName ?? item.type}- downloadFileName={item.fileName ?? 'audio'}- url={item.fileUrl}- />- {caption}- </Flexbox>- );- if (!md && onReviewEvidence && item.fileUrl && IMAGE_EVIDENCE.has(item.type)) {- return (- <button- key={item.id}- type={'button'}- style={{- padding: 0,- width: '100%',- border: 0,- background: 'none',- textAlign: 'start',- cursor: 'pointer',- }}- onClick={() => onReviewEvidence(item.id)}- >- <img- alt={item.description ?? item.fileName ?? item.type}- loading={'lazy'}- src={item.fileUrl}- style={{- display: 'block',- maxWidth: '100%',- width: '100%',- height: 180,- objectFit: 'cover',- objectPosition: 'top',- borderRadius: 8,- }}- />- {caption}- </button>- );- }- const overlay = overlays?.get(item.id);- if (item.fileUrl && item.type === 'screenshot') {- const run = [item];- const start = sorted.indexOf(item);- for (let index = start + 1; index < sorted.length; index++) {- const next = sorted[index]!;- if (pairedIds.has(next.id) || !next.fileUrl || next.type !== 'screenshot') break;- run.push(next);- consumedScreenshotIds.add(next.id);- }- return (- <Flexbox- horizontal- align={'flex-start'}- gap={12}- key={item.id}- style={{ maxWidth: '100%' }}- wrap={'wrap'}- >- {run.map((shot) => {- const shotCaption = meaningfulEvidenceCaption(shot.description);- return (- <ScreenshotTiles- alt={shot.description ?? shot.fileName ?? shot.type}- annotations={overlays?.get(shot.id)}- fileHeight={shot.fileHeight}- fileWidth={shot.fileWidth}- key={shot.id}- src={shot.fileUrl!}- caption={- shotCaption ? (- <span className={styles.caption}>{shotCaption}</span>- ) : undefined- }- />- );- })}- </Flexbox>- );- }- if (item.fileUrl && IMAGE_EVIDENCE.has(item.type)) {- return (- <Flexbox gap={4} key={item.id} style={{ maxWidth: '100%', width: 'fit-content' }}>- {overlay?.length ? (- <AnnotatedImage- annotations={overlay}- showComments={false}- src={item.fileUrl}- imageStyle={- item.fileWidth && item.fileHeight- ? { aspectRatio: imageRatio(item), maxWidth: '100%', width: item.fileWidth }- : undefined- }- />- ) : (- <Flexbox- className={styles.evidenceImage}- style={- item.fileWidth && item.fileHeight- ? { aspectRatio: imageRatio(item), maxWidth: '100%', width: item.fileWidth }- : undefined- }- >- <Image- alt={item.description ?? item.fileName ?? item.type}- loading={'lazy'}- src={item.fileUrl}- variant={'borderless'}- style={{- borderRadius: 0,- maxWidth: '100%',- width: item.fileWidth && item.fileHeight ? '100%' : undefined,- }}- />- </Flexbox>- )}- {caption}- </Flexbox>- );- }- if (item.content && markdownTextEvidenceTypes.has(item.type))- return (- // An authored alt/description becomes the fold row's title itself —- // the supplement below the row duplicated it one line later.- <CollapsibleMarkdownEvidence- key={item.id}- title={item.description?.trim() || item.fileName?.trim() || undefined}- >- {item.content}- </CollapsibleMarkdownEvidence>- );- if (item.content)- return (- <Flexbox gap={4} key={item.id}>- <div className={styles.evidenceText}>{item.content}</div>- {caption}- </Flexbox>- );- if (item.fileUrl && markdownTextEvidenceTypes.has(item.type))- return (- <EvidenceFileCard- markdown- description={item.description}- fileName={item.fileName}- key={item.id}- url={item.fileUrl}- />- );- return null;- })}- </Flexbox>- );-});--/**- * The user's acceptance, rendered as one quiet gray line — a signature, not an- * event card: the verdict icon stays the row's headline, this is metadata.- */-const AcceptedNote = memo<{ review: AcceptanceCheckReviewEntry }>(({ review }) => {- const { t } = useTranslation('verify');- const hydrated = useIsHydrated();- return (- <Flexbox horizontal align={'center'} gap={6}>- <Icon color={cssVar.colorTextQuaternary} icon={BadgeCheck} size={13} />- <Text fontSize={12} type={'secondary'}>- {t('acceptance.review.acceptedNote', {- time: hydrated ? dayjs(review.createdAt).format('MM-DD HH:mm') : '',- })}- </Text>- </Flexbox>- );-});--const IgnoredNote = memo<{ review: AcceptanceCheckReviewEntry }>(({ review }) => {- const { t } = useTranslation('verify');- const hydrated = useIsHydrated();- return (- <Flexbox horizontal align={'center'} gap={6}>- <Icon color={cssVar.colorTextQuaternary} icon={Ban} size={13} />- <Text fontSize={12} type={'secondary'}>- {t('acceptance.review.ignoredNote', {- time: hydrated ? dayjs(review.createdAt).format('MM-DD HH:mm') : '',- })}- </Text>- </Flexbox>- );-});--/**- * One reject-feedback event: a small red marker line, then the note and the- * circled regions as plain content — no background wash. Used both as the- * standing feedback under the row's evidence and inside the iteration history.- */-const FeedbackCard = memo<{- evidenceById: Map<string, AcceptanceEvidence>;- review: AcceptanceCheckReviewEntry;-}>(({ evidenceById, review }) => {- const { t } = useTranslation('verify');- const hydrated = useIsHydrated();- if (review.action === 'accept') return <AcceptedNote review={review} />;- if (review.action === 'ignore') return <IgnoredNote review={review} />;-- const groups = new Map<- string,- { comment?: string; rect: AcceptanceReviewAnnotation['rect'] }[]- >();- for (const annotation of review.annotations ?? []) {- const bucket = groups.get(annotation.evidenceId) ?? [];- bucket.push({ comment: annotation.comment, rect: annotation.rect });- groups.set(annotation.evidenceId, bucket);- }-- return (- <Flexbox gap={8}>- <Flexbox horizontal align={'center'} gap={6}>- <Icon color={cssVar.colorError} icon={MessageSquareX} size={13} />- <Text style={{ color: cssVar.colorError, fontSize: 12 }}>- {t('acceptance.review.feedbackLabel')}- </Text>- <Text fontSize={12} type={'secondary'}>- {hydrated ? dayjs(review.createdAt).format('MM-DD HH:mm') : null}- </Text>- </Flexbox>- {review.comment && <Text style={{ fontSize: 12 }}>{review.comment}</Text>}- <AttachmentThumbs attachments={review.attachments} />- {[...groups.entries()].map(([evidenceId, annotations]) => {- const evidence = evidenceById.get(evidenceId);- // The evidence may be gone (deleted round) — the notes stay readable.- if (!evidence?.fileUrl)- return annotations- .filter((annotation) => annotation.comment)- .map((annotation, index) => (- <Text fontSize={12} key={`${evidenceId}-${index}`} type={'secondary'}>- {annotation.comment}- </Text>- ));- return (- <AnnotatedImage- annotations={annotations}- key={evidenceId}- src={evidence.fileUrl}- imageStyle={{- // Known dimensions reserve the box up front (explicit height +- // ratio-derived width) — no height jump when the row expands- // and the screenshot streams in.- aspectRatio: imageRatio(evidence),- height: evidence.fileHeight ? Math.min(evidence.fileHeight, 240) : undefined,- maxHeight: 240,- }}- />- );- })}- </Flexbox>- );-});--/** Everything a check knows about its evidence, keyed by id — annotation lookups. */-const collectEvidenceById = (check: AcceptanceCheck): Map<string, AcceptanceEvidence> => {- const map = new Map<string, AcceptanceEvidence>();- for (const entry of check.timeline) for (const item of entry.evidence) map.set(item.id, item);- for (const item of check.evidence) map.set(item.id, item);- return map;-};--/** A step of the merged history: an executed round, or a user feedback event. */-type HistoryStep =- | { key: string; kind: 'review'; review: AcceptanceCheckReviewEntry; roundIndex: number }- | { key: string; kind: 'run'; roundIndex: number; step: AcceptanceCheck['timeline'][number] };--/**- * The iteration-history timeline (newest first): each executed step's round,- * the wording THAT round used, and its evidence — plus the user's feedback- * events, slotted after the round they judged — how the check evolved.- */-const IterationTimeline = memo<{- check: AcceptanceCheck;- evidenceById: Map<string, AcceptanceEvidence>;- historyReviews: AcceptanceCheckReviewEntry[];- onRound?: (round: number) => void;-}>(({ check, evidenceById, historyReviews, onRound }) => {- const { t } = useTranslation('verify');-- const merged: HistoryStep[] = [- ...check.timeline.map<HistoryStep>((step) => ({- key: `run-${step.roundIndex}-${step.resultId}`,- kind: 'run',- roundIndex: step.roundIndex,- step,- })),- ...historyReviews.map<HistoryStep>((review) => ({- key: `review-${review.id}`,- kind: 'review',- review,- roundIndex: review.roundIndex,- })),- ]- .sort(- (a, b) =>- a.roundIndex - b.roundIndex ||- // Within a round the run comes first — feedback judges its result.- (a.kind === 'review' ? 1 : 0) - (b.kind === 'review' ? 1 : 0) ||- (a.kind === 'review' && b.kind === 'review'- ? new Date(a.review.createdAt).getTime() - new Date(b.review.createdAt).getTime()- : 0),- )- .reverse();-- return (- <Flexbox>- {merged.map((entry, index) => {- const isCurrent = index === 0;- const isLast = index === merged.length - 1;-- if (entry.kind === 'review')- return (- <Flexbox horizontal gap={12} key={entry.key}>- <Flexbox align={'center'} style={{ flex: 'none', width: 9 }}>- <span- className={styles.stepDot}- style={{- borderColor:- entry.review.action === 'accept'- ? cssVar.colorSuccess- : entry.review.action === 'ignore'- ? cssVar.colorTextQuaternary- : cssVar.colorError,- }}- />- {!isLast && <div className={styles.stepRail} />}- </Flexbox>- <Flexbox flex={1} gap={6} style={{ minWidth: 0, paddingBlockEnd: isLast ? 0 : 20 }}>- <FeedbackCard evidenceById={evidenceById} review={entry.review} />- </Flexbox>- </Flexbox>- );-- const { step } = entry;- const stateColor =- {- failed: cssVar.colorError,- passed: cssVar.colorSuccess,- uncertain: cssVar.colorWarning,- }[step.state as string] ?? cssVar.colorTextQuaternary;-- return (- <Flexbox horizontal gap={12} key={entry.key}>- <Flexbox align={'center'} style={{ flex: 'none', width: 9 }}>- <span- className={styles.stepDot}- style={{- background: isCurrent ? stateColor : cssVar.colorBgContainer,- borderColor: isCurrent ? stateColor : cssVar.colorTextQuaternary,- }}- />- {!isLast && <div className={styles.stepRail} />}- </Flexbox>- <Flexbox flex={1} gap={6} style={{ minWidth: 0, paddingBlockEnd: isLast ? 0 : 20 }}>- {onRound ? (- <Tooltip title={t('acceptance.history.jump', { round: step.roundIndex })}>- <Text- strong- style={{ cursor: 'pointer', fontSize: 12, lineHeight: '19px' }}- onClick={() => onRound(step.roundIndex)}- >- {t('acceptance.round', { round: step.roundIndex })}- </Text>- </Tooltip>- ) : (- <Text strong style={{ fontSize: 12, lineHeight: '19px' }}>- {t('acceptance.round', { round: step.roundIndex })}- </Text>- )}- <Text style={{ fontSize: 12 }}>{step.title}</Text>- {step.evidence.length > 0 && (- <Flexbox horizontal gap={8} wrap={'wrap'}>- {step.evidence.map((item) =>- item.fileUrl && IMAGE_EVIDENCE.has(item.type) ? (- <Flexbox className={styles.evidenceImage} key={item.id}>- <Image- alt={item.description ?? item.type}- loading={'lazy'}- src={item.fileUrl}- style={{ borderRadius: 0, maxHeight: 160, maxWidth: 280, width: 'auto' }}- variant={'borderless'}- />- </Flexbox>- ) : item.fileUrl && item.type === 'video' ? (- // A player, never an <Image>: pointing an image box at an- // mp4 renders a broken thumbnail, not the clip.- <video- controls- key={item.id}- src={item.fileUrl}- style={{ borderRadius: 8, maxHeight: 160, maxWidth: 280 }}- />- ) : item.fileUrl && item.type === 'audio' ? (- <div key={item.id} style={{ width: '100%' }}>- <AudioPlayer- fullWidth- alt={item.description ?? item.type}- downloadFileName={item.fileName ?? 'audio'}- url={item.fileUrl}- />- </div>- ) : item.content ? (- <div- className={styles.evidenceText}- key={item.id}- style={{ maxHeight: 120, maxWidth: 420 }}- >- {item.content}- </div>- ) : null,- )}- </Flexbox>- )}- </Flexbox>- </Flexbox>- );- })}- {check.result?.suggestion && (- <Flexbox horizontal gap={12} style={{ marginBlockStart: 12 }}>- <Text fontSize={12} style={{ flex: 'none', minWidth: 64 }} type={'secondary'}>- {t('acceptance.detail.suggestion')}- </Text>- <Text fontSize={12} type={'secondary'}>- {check.result.suggestion}- </Text>- </Flexbox>- )}- </Flexbox>- );-});--export const AcceptanceCheckRow = memo<{- canReview: boolean;- check: AcceptanceCheck;- detailMode?: boolean;- expanded: boolean;- /** Answer a model proposal WITHOUT ruling on the check itself. */- onDismissProposal?: (input: ProposalDismissInput) => Promise<void>;- onReview: (input: CheckReviewInput) => Promise<boolean>;- onRound?: (round: number) => void;- /** Open an agent judge's verification run (its trace IS the argument). */- onOpenTrace?: (verifierOperationId: string) => void | Promise<void>;- onToggle: () => void;- reviewPending: boolean;-}>(- ({- canReview,- check,- detailMode,- expanded,- onDismissProposal,- onOpenTrace,- onReview,- onRound,- onToggle,- reviewPending,- }) => {- const { t } = useTranslation('verify');- const { md: desktop = true } = useResponsive();- // The judging narrative stays collapsed: level one is title + evidence.- const [historyOpen, setHistoryOpen] = useState(false);- const [seqCopied, setSeqCopied] = useState(false);- const [accepting, setAccepting] = useState(false);- const [ignoring, setIgnoring] = useState(false);- const [rejecting, setRejecting] = useState(false);- const [reviewComment, setReviewComment] = useState('');- // The proposal starts folded: it is a suggestion, and an open panel on every- // unreviewed check would push the evidence the reviewer came for below the fold.- const [proposalOpen, setProposalOpen] = useState(false);- const meta = STATE_META[check.state];- const title = checkDisplayTitle(check.title, t('acceptance.checks.holisticTitle'));- const counts = evidenceCounts(check.evidence);- const visualization = readVisualizationManifest(check.result?.metadata);-- const reviewState = userReviewState(check);- // The decision is stamped on the check's result row — a never-executed- // check has no evidence to judge, so it exposes no review actions.- const reviewable = canReview && Boolean(check.result);- const activeReview =- check.userReview && !check.userReview.stale- ? check.reviews.at(-1) // the standing verdict is always the newest entry- : undefined;- const historyReviews = check.reviews.filter((entry) => entry !== activeReview);- const evidenceById = collectEvidenceById(check);-- // Regions the proposal wants drawn on the evidence images already in this- // row. Numbered across the whole proposal (not per image), so "区域 2" in- // the card means the same box wherever it lives. Only while the card is- // open — boxes with no visible explanation read as a defect of the evidence.- const proposalOverlays = useMemo(() => {- if (!proposalOpen || !check.prediction) return undefined;- const map = new Map<- string,- { comment?: string; label?: number; rect: AcceptanceReviewAnnotation['rect'] }[]- >();- (check.prediction.annotations ?? []).forEach((annotation, index) => {- const bucket = map.get(annotation.evidenceId) ?? [];- bucket.push({ comment: annotation.comment, label: index + 1, rect: annotation.rect });- map.set(annotation.evidenceId, bucket);- });- return map.size > 0 ? map : undefined;- }, [proposalOpen, check.prediction]);- const hasHistory = check.revisions > 1 || historyReviews.length > 0;-- /**- * @param fromProposal - when set, the modal opens prefilled with the- * model's note and regions, and the submitted result is diffed against it- * so the signal records WHICH part of the proposal was wrong.- */- const openReject = (fromProposal?: CheckProposal, initialEvidenceId?: string) =>- openCheckRejectModal({- initialEvidenceId,- previousAttachments:- activeReview?.action === 'reject'- ? activeReview.attachments- ?.filter((item) => item.url)- .map((item) => ({ id: item.id, name: item.name, url: item.url! }))- : undefined,- previousAnnotations:- activeReview?.action === 'reject' ? activeReview.annotations : undefined,- previousComment: activeReview?.action === 'reject' ? activeReview.comment : undefined,- checkDescription: check.planItem?.description,- checkTitle: `C${check.seq} · ${title}`,- draftKey: `${check.result?.id ?? 'unexecuted'}:${check.id}`,- evidence: check.evidence- .filter((item) => isAnnotatable(item))- .map((item) => ({ fileUrl: item.fileUrl!, id: item.id })),- initialAnnotations: fromProposal?.annotations ?? undefined,- initialComment: fromProposal?.comment ?? reviewComment,- onConfirm: async ({ annotations, comment, fileIds }) => {- const ok = await onReview({- action: 'reject',- annotations: annotations.length > 0 ? annotations : undefined,- checkItemIds: [check.id],- comment: comment || undefined,- fileIds: fileIds.length > 0 ? fileIds : undefined,- ...(fromProposal- ? {- proposal: {- adjudication: 'confirmed' as const,- edit: classifyProposalEdit(fromProposal, { annotations, comment }),- predictionId: fromProposal.id,- },- }- : {}),- });- if (ok) {- setReviewComment('');- if (shouldCollapseAfterReview(ok, expanded)) onToggle();- }- return ok;- },- });-- /**- * Dismissing a proposal is NOT a review of the check — the check stays- * pending and the reviewer still has to judge it. Only the model's opinion- * is being answered, so this writes the outcome without touching- * `user_decision`.- */- const handleAdjudicate = async (adjudication: 'not-an-issue' | 'misidentified') => {- if (!check.prediction) return;- await onDismissProposal?.({- adjudication,- checkItemId: check.id,- predictionId: check.prediction.id,- });- };-- // Accepting settles the check — the row folds itself away once the write- // lands, so the reviewer's eye moves on to what still needs judgment.- const handleAccept = async (event: { stopPropagation: () => void }) => {- event.stopPropagation();- setAccepting(true);- const comment = reviewComment.trim();- const ok = await onReview({- action: 'accept',- checkItemIds: [check.id],- comment: comment || undefined,- });- setAccepting(false);- if (ok) setReviewComment('');- if (shouldCollapseAfterReview(ok, expanded)) onToggle();- };-- const handleReject = async (event: { stopPropagation: () => void }) => {- event.stopPropagation();- const comment = reviewComment.trim();- if (!comment) return;- setRejecting(true);- const ok = await onReview({- action: 'reject',- checkItemIds: [check.id],- comment,- });- setRejecting(false);- if (ok) setReviewComment('');- if (shouldCollapseAfterReview(ok, expanded)) onToggle();- };-- const handleIgnore = async (event: { stopPropagation: () => void }) => {- event.stopPropagation();- setIgnoring(true);- const ok = await onReview({ action: 'ignore', checkItemIds: [check.id] });- setIgnoring(false);- if (shouldCollapseAfterReview(ok, expanded)) onToggle();- };-- // The user's standing verdict owns the head slot: a reject replaces the- // verifier's mark outright (that check IS sent back, whatever the verifier- // said); passed + user-accepted merges into the double-check receipt.- const headIcon =- reviewState === 'rejected'- ? MessageSquareX- : reviewState === 'ignored'- ? Ban- : check.state === 'passed' && reviewState === 'accepted'- ? CheckCheck- : meta.icon;- const headColor =- reviewState === 'rejected'- ? cssVar.colorError- : reviewState === 'ignored'- ? cssVar.colorTextQuaternary- : meta.color;-- const headIconNode = (- <Icon- color={headColor}- icon={headIcon}- size={16}- style={{ alignSelf: 'flex-start', flex: 'none', marginBlockStart: 3 }}- />- );-- return (- <Flexbox className={detailMode ? undefined : styles.row} data-check-row={check.id}>- {!detailMode && (- <Flexbox- horizontal- align={'flex-start'}- aria-expanded={expanded}- className={styles.rowHeader}- data-expanded={expanded ? '' : undefined}- gap={10}- role={'button'}- tabIndex={0}- onClick={onToggle}- onKeyDown={(event) => {- if (- event.target === event.currentTarget &&- (event.key === 'Enter' || event.key === ' ')- ) {- event.preventDefault();- onToggle();- }- }}- >- {reviewState === 'rejected' ? (- <Tooltip title={t('acceptance.review.rejectedHint')}>{headIconNode}</Tooltip>- ) : (- headIconNode- )}- <Tooltip- title={seqCopied ? t('acceptance.checks.copied') : t('acceptance.checks.copySeq')}- >- <span- className={cx(styles.seqChip, styles.seqChipClickable)}- onClick={(event) => {- event.stopPropagation();- void copyToClipboard(`C${check.seq}`);- setSeqCopied(true);- setTimeout(() => setSeqCopied(false), 1500);- }}- >- C{check.seq}- </span>- </Tooltip>- <Flexbox- horizontal- align={'center'}- flex={1}- gap={8}- style={{ minWidth: 0 }}- wrap={expanded ? 'wrap' : 'nowrap'}- >- <Text- className={expanded || !desktop ? undefined : styles.titleEllipsis}- style={{ fontSize: desktop ? 13 : 14, minWidth: 0 }}- >- {title}- </Text>- {!check.required && (- <Tooltip title={t('acceptance.checks.notRequiredHint')}>- <Tag size={'small'}>{t('acceptance.checks.notRequired')}</Tag>- </Tooltip>- )}- {/* The verdict pair travels WITH the title, not adrift at the row's- far right: the claim you judge and the judgement you give land in- one glance, so a long checklist needs no eye round-trip across the- row (and no mis-click onto a neighbour's buttons). */}- {desktop && reviewable && reviewState === 'pending' && (- <Flexbox- horizontal- align={'center'}- className={cx(styles.rowActions, 'acceptance-row-actions')}- gap={2}- style={{- // The accept spinner must stay visible after the pointer leaves.- ...(accepting ? { opacity: 1 } : undefined),- flex: 'none',- }}- >- <ActionIcon- disabled={reviewPending && !accepting}- icon={Check}- loading={accepting}- size={'small'}- title={t('acceptance.review.accept')}- onClick={handleAccept}- />- <ActionIcon- disabled={reviewPending && !ignoring}- icon={Ban}- loading={ignoring}- size={'small'}- title={t('acceptance.review.ignore')}- onClick={handleIgnore}- />- <ActionIcon- disabled={reviewPending}- icon={MessageSquareX}- size={'small'}- title={t('acceptance.review.reject')}- onClick={(event) => {- event.stopPropagation();- openReject();- }}- />- </Flexbox>- )}- </Flexbox>- <Flexbox- horizontal- align={'center'}- className={cx(styles.rowMeta, 'acceptance-row-meta')}- gap={6}- >- {/* An accept on a NON-passed verdict can't merge into the head icon- (the failed/uncertain mark must stay visible) — mark it here. */}- {reviewState === 'accepted' && check.state !== 'passed' && (- <Tooltip- title={t('acceptance.review.acceptedNote', {- time: dayjs(check.userReview!.createdAt).format('MM-DD HH:mm'),- })}- >- <Icon color={cssVar.colorTextQuaternary} icon={BadgeCheck} size={14} />- </Tooltip>- )}- {visualization && <VisualizationDeltaBadge manifest={visualization} />}- {EVIDENCE_BADGES.map(({ icon, key, labelKey }) =>- counts[key] ? (- <Tooltip key={key} title={t(labelKey, { count: counts[key] })}>- <Flexbox- horizontal- align={'center'}- gap={3}- style={{ color: cssVar.colorTextTertiary, fontSize: 11 }}- >- <Icon icon={icon} size={13} />- {counts[key] > 1 ? counts[key] : null}- </Flexbox>- </Tooltip>- ) : null,- )}- {/* The iteration mark stays compact — [↻ N]; the words (verified N- rounds · introduced in round X) live in its tooltip. Clicking- jumps to the round the concern first appeared in. */}- {onRound && check.revisions > 1 && (- <Tooltip- title={[- check.titleChanged- ? t('acceptance.checks.iterated', { count: check.revisions })- : t('acceptance.checks.rerun', { count: check.revisions }),- check.resultRound !== undefined &&- check.resultRound !== null &&- check.introducedAtRound !== check.resultRound- ? t('acceptance.checks.introduced', { round: check.introducedAtRound })- : null,- ]- .filter(Boolean)- .join(' · ')}- >- <span- className={cx(styles.chip, styles.chipClickable)}- onClick={(event) => {- event.stopPropagation();- onRound(check.introducedAtRound);- }}- >- <Icon icon={Repeat} size={10} /> {check.revisions}- </span>- </Tooltip>- )}- {onRound && check.resultRound !== undefined && check.resultRound !== null && (- <Tooltip title={t('acceptance.checks.finalRoundHint')}>- <span- className={cx(styles.chip, styles.chipClickable)}- onClick={(event) => {- event.stopPropagation();- onRound(check.resultRound!);- }}- >- {t('acceptance.round', { round: check.resultRound })}- </span>- </Tooltip>- )}- </Flexbox>- <Flexbox align={'center'} height={22}>- <Icon- color={cssVar.colorTextQuaternary}- icon={ChevronRight}- size={14}- style={{- transform: expanded ? 'rotate(90deg)' : 'none',- transition: 'transform 0.2s',- }}- />- </Flexbox>- </Flexbox>- )}-- {expanded && (- <Flexbox- gap={10}- paddingBlock={detailMode ? 0 : '0 14px'}- paddingInline={detailMode ? 0 : 16}- >- {/* The model's proposal leads the detail: it is a claim about this- check that the reviewer is being asked to rule on, so it belongs- above the verifier's narrative rather than buried under it.- Suppressed once a verdict exists — see the bundle read, which- already drops it; this guard covers the optimistic window. */}- {check.prediction && reviewable && !activeReview && (- <ProposalCard- open={proposalOpen}- pending={reviewPending}- proposal={check.prediction}- onAdjudicate={handleAdjudicate}- onConfirm={() => openReject(check.prediction ?? undefined)}- onToggle={setProposalOpen}- />- )}- {/* The verifier's account of what it saw. Clamping it to two lines- hid the middle of the argument behind an ellipsis with no way to- open it — in a detail view there is nothing to preview. */}- {check.result?.toulmin?.evidence && (- <Text fontSize={12} style={{ whiteSpace: 'pre-wrap' }} type={'secondary'}>- {check.result.toulmin.evidence}- </Text>- )}- {/* An agent judge's argument is its run, not a paragraph — link the- trace instead of trying to summarize it inline. `onOpenTrace`- gates the render, not just the click: a caller that forgets to- pass it would otherwise get a button whose optional call silently- does nothing — exactly how this shipped dead in the portal. */}- {check.planItem?.verifierType === 'agent' &&- check.result?.verifierOperationId &&- onOpenTrace && (- <Flexbox horizontal>- <Button- icon={<Icon icon={Route} />}- size={'small'}- type={'text'}- onClick={(event) => {- event.stopPropagation();- void onOpenTrace(check.result!.verifierOperationId!);- }}- >- {t('acceptance.checks.viewTrace')}- </Button>- </Flexbox>- )}- {visualization && <VisualizationRenderer manifest={visualization} />}- <EvidenceList- evidence={check.evidence}- overlays={proposalOverlays}- onReviewEvidence={canReview ? (id) => openReject(undefined, id) : undefined}- />-- {check.state === 'not_executed' && (- <Flexbox- horizontal- align={'center'}- gap={8}- paddingBlock={8}- paddingInline={10}- style={{- background: cssVar.colorFillQuaternary,- borderRadius: cssVar.borderRadius,- width: '100%',- }}- >- <Icon- color={cssVar.colorTextQuaternary}- icon={CircleDashed}- size={15}- style={{ flex: 'none' }}- />- <Text fontSize={12} type={'secondary'}>- {t('acceptance.focus.verifierDescription.notExecuted')}- </Text>- </Flexbox>- )}-- {/* The verifier's record slot. An LLM judge's whole product IS its- reasoning, so when it exists it IS the record shown here — in the- same slot the empty-evidence note otherwise occupies (the two are- the same statement: "here is what the verifier left behind"). An- executed check with neither still SAYS so — a silent blank under- the verdict reads as a rendering bug, not as a fact. */}- {check.state !== 'not_executed' &&- check.result &&- (check.result.toulmin?.reasoning ? (- <Flexbox- gap={4}- paddingBlock={8}- paddingInline={10}- style={{- background: cssVar.colorFillQuaternary,- borderRadius: cssVar.borderRadius,- width: '100%',- }}- >- <Text fontSize={11} type={'secondary'}>- {t('acceptance.checks.judgeReason')}- </Text>- <Text fontSize={12} style={{ whiteSpace: 'pre-wrap' }}>- {check.result.toulmin.reasoning}- </Text>- </Flexbox>- ) : !hasRenderableEvidence(check.evidence.length, visualization) ? (- <Flexbox- paddingBlock={6}- paddingInline={10}- style={{- background: cssVar.colorFillQuaternary,- borderRadius: cssVar.borderRadius,- width: '100%',- }}- >- <Text fontSize={12} type={'secondary'}>- {t('acceptance.evidence.empty')}- </Text>- </Flexbox>- ) : null)}-- {/* The user's standing feedback hangs right under the evidence it- judges. BOTH verdicts keep an undo path — a mis-click is the most- likely way either happens, and a send-back the user didn't mean- otherwise costs a whole repair round to walk back. */}- {activeReview &&- (activeReview.action === 'accept' ? (- <Flexbox horizontal align={'center'} gap={8}>- <AcceptedNote review={activeReview} />- {reviewable && (- <Button- disabled={reviewPending}- size={'small'}- type={'text'}- onClick={(event) => {- event.stopPropagation();- openReject();- }}- >- {t('acceptance.review.revertToReject')}- </Button>- )}- </Flexbox>- ) : activeReview.action === 'ignore' ? (- <Flexbox horizontal align={'center'} gap={8}>- <IgnoredNote review={activeReview} />- {reviewable && (- <>- <Button- disabled={reviewPending}- size={'small'}- type={'text'}- onClick={(event) => {- event.stopPropagation();- openReject();- }}- >- {t('acceptance.review.revertToReject')}- </Button>- <Button- disabled={reviewPending && !accepting}- loading={accepting}- size={'small'}- type={'text'}- onClick={handleAccept}- >- {t('acceptance.review.revertToAccept')}- </Button>- </>- )}- </Flexbox>- ) : (- <Flexbox gap={6}>- <FeedbackCard evidenceById={evidenceById} review={activeReview} />- {/* The mirror of the accept escape: take the send-back back.- A fresh accept supersedes the reject, so the check leaves- 待修复 and the feedback drops out of the next round's input. */}- {reviewable && (- <Flexbox horizontal>- <Button- disabled={reviewPending && !accepting}- loading={accepting}- size={'small'}- type={'text'}- onClick={handleAccept}- >- {t('acceptance.review.revertToAccept')}- </Button>- </Flexbox>- )}- </Flexbox>- ))}-- {/* Confirm (plain filled) anchors the right edge; reject is the- quiet text escape next to it. */}- {reviewable &&- !activeReview &&- (detailMode ? (- <Flexbox gap={10} style={{ marginBlockStart: 6 }}>- {hasAnnotatableEvidence(check) && (- <Button- outdent- icon={<Icon icon={Images} />}- style={{ alignSelf: 'flex-start' }}- type={'text'}- onClick={(event) => {- event.stopPropagation();- openReject();- }}- >- {t('acceptance.review.annotate')}- </Button>- )}- <TextArea- autoSize={{ maxRows: 8, minRows: 3 }}- placeholder={t('acceptance.review.detailPlaceholder')}- value={reviewComment}- onChange={(event) => setReviewComment(event.target.value)}- />- <Flexbox horizontal gap={8}>- <Button- block- disabled={reviewPending || !reviewComment.trim()}- loading={rejecting}- size={'large'}- style={{ flex: 1 }}- onClick={handleReject}- >- {t('acceptance.review.reject')}- </Button>- <Button- block- disabled={reviewPending && !accepting}- icon={<Icon icon={Check} />}- loading={accepting}- size={'large'}- style={{ flex: 1 }}- type={'fill'}- onClick={handleAccept}- >- {t('acceptance.review.accept')}- </Button>- </Flexbox>- </Flexbox>- ) : (- <Flexbox horizontal gap={4} justify={'flex-end'}>- <Button- disabled={reviewPending && !ignoring}- loading={ignoring}- size={'small'}- type={'text'}- onClick={handleIgnore}- >- {t('acceptance.review.ignore')}- </Button>- <Button- disabled={reviewPending}- size={'small'}- type={'text'}- onClick={(event) => {- event.stopPropagation();- openReject();- }}- >- {t('acceptance.review.reject')}- </Button>- <Button- disabled={reviewPending && !accepting}- icon={<Icon icon={Check} />}- loading={accepting}- size={'small'}- type={'fill'}- onClick={handleAccept}- >- {t('acceptance.review.accept')}- </Button>- </Flexbox>- ))}-- {hasHistory && (- <span- className={styles.historyToggle}- onClick={() => setHistoryOpen((open) => !open)}- >- <Icon- icon={ChevronRight}- size={12}- style={{- transform: historyOpen ? 'rotate(90deg)' : 'none',- transition: 'transform 0.2s',- }}- />- {t('acceptance.checks.iterationHistory', { count: check.revisions })}- </span>- )}- {historyOpen && hasHistory && (- <IterationTimeline- check={check}- evidenceById={evidenceById}- historyReviews={historyReviews}- onRound={onRound}- />- )}- </Flexbox>- )}- </Flexbox>- );- },-);--interface FocusedCheckDetailsProps {- canReview: boolean;- check: AcceptanceCheck;- /** Answer a model proposal without ruling on the check itself. */- onDismissProposal?: (input: ProposalDismissInput) => Promise<void>;- /** Open an agent judge's verification run (its trace IS the argument). */- onOpenTrace?: (verifierOperationId: string) => void | Promise<void>;- onReview: (input: CheckReviewInput) => Promise<boolean>;- onRound?: (round: number) => void;- reviewPending: boolean;-}--/** Full check content for the dedicated second-level acceptance workspace. */-export const FocusedCheckDetails = memo<FocusedCheckDetailsProps>(- ({ canReview, check, onDismissProposal, onOpenTrace, onReview, onRound, reviewPending }) => (- <AcceptanceCheckRow- detailMode- expanded- canReview={canReview}- check={check}- reviewPending={reviewPending}- onDismissProposal={onDismissProposal}- onOpenTrace={onOpenTrace}- onReview={onReview}- onRound={onRound}- onToggle={() => {}}- />- ),-);--FocusedCheckDetails.displayName = 'FocusedCheckDetails';--/**- * The filter maps the reviewer's WORKFLOW, not the verifier's taxonomy — each- * tab is the user's own disposition on a check, so the verifier's verdict alone- * never moves a check between tabs:- * - pending (未验收): awaiting your review — whatever the verifier returned- * (passed-but-unconfirmed, uncertain ❓, failed, or never executed). The row- * icon still carries the verifier verdict; the tab is about YOUR call.- * - needsFix (待修复): you rejected it. The only bucket that is a decision you- * made — so every 待修复 item carries your feedback (待修复 stays in step with- * 反馈, instead of inflating with checks you never sent back).- * - accepted (已验收): you signed it off.- *- * An uncertain/failed check the verifier flagged but you have NOT rejected is- * still 未验收: the verifier is unsure or the run is red, so it needs your eyes- * — not an automatic "needs fix" label you never asked for.- */-export type CheckFilter = 'all' | 'pending' | 'needsFix' | 'accepted' | 'ignored';--export const checkFilterState = (check: AcceptanceCheck): Exclude<CheckFilter, 'all'> => {- const review = userReviewState(check);- if (review === 'accepted') return 'accepted';- if (review === 'ignored') return 'ignored';- if (review === 'rejected') return 'needsFix';- return 'pending';-};--/** Keep the verifier's result separate from the user's acceptance workflow state. */-export const focusedCheckStates = (check: AcceptanceCheck) => ({- review: checkFilterState(check),- verifier: check.state,- verifierLabel: check.state === 'not_executed' ? ('notExecuted' as const) : check.state,-});--interface CheckGroup {- checks: AcceptanceCheck[];- key: string;- label: string;-}--/**- * Group by the harness-authored business `category`. Product surfaces describe- * where a check ran, not what user requirement it verifies, so they must never- * become acceptance sections.- */-export const groupChecks = (checks: AcceptanceCheck[], otherLabel: string): CheckGroup[] => {- const groups = new Map<string, CheckGroup>();- for (const check of checks) {- const category = check.category?.trim();- const key = category ? `category:${category}` : 'uncategorized';- const label = category || otherLabel;- const group = groups.get(key) ?? { checks: [], key, label };- group.checks.push(check);- groups.set(key, group);- }- return [...groups.values()];-};--interface CheckListProps {- /** Whether the viewer may review checks (the aggregate's owner). */- canReview: boolean;- checks: AcceptanceCheck[];- collapsedGroups: Set<string>;- /** The latest round index — arbitrates group-feedback staleness. */- currentRound: number;- expanded: Set<string>;- filter: CheckFilter;- /** Group-scoped feedback entries recorded on the aggregate. */- groupFeedback: AcceptanceGroupFeedback[];- /** Answer a model proposal without ruling on the check itself. */- onDismissProposal?: (input: ProposalDismissInput) => Promise<void>;- /** Record group-scoped feedback; resolves true when the write landed. */- onGroupFeedback: (category: string, comment: string, fileIds: string[]) => Promise<boolean>;- /** Open an agent judge's verification run (its trace IS the argument). */- onOpenTrace?: (verifierOperationId: string) => void | Promise<void>;- /** Record the user's verdict; resolves true when the write landed. */- onReview: (input: CheckReviewInput) => Promise<boolean>;- onRound?: (round: number) => void;- onToggleGroup: (key: string) => void;- onToggleGroupItems: (ids: string[], open: boolean) => void;- onToggleItem: (id: string) => void;- reviewPending: boolean;-}--/** The union check list: one joined card, collapsible business groups. */-const CheckList = memo<CheckListProps>(- ({- canReview,- checks,- collapsedGroups,- currentRound,- expanded,- filter,- groupFeedback,- onDismissProposal,- onGroupFeedback,- onReview,- onOpenTrace,- onRound,- onToggleGroup,- onToggleGroupItems,- onToggleItem,- reviewPending,- }) => {- const { t } = useTranslation('verify');- const hydrated = useIsHydrated();- const [acceptingGroup, setAcceptingGroup] = useState<string | null>(null);-- const visible = (check: AcceptanceCheck) =>- filter === 'all' || checkFilterState(check) === filter;-- const visibleRows = checks- .filter(visible)- .sort(- (a, b) =>- SEVERITY[a.state] - SEVERITY[b.state] ||- (hasVisualEvidence(b) ? 1 : 0) - (hasVisualEvidence(a) ? 1 : 0) ||- a.introducedAtRound - b.introducedAtRound,- );- const groups = groupChecks(checks, t('acceptance.group.uncategorized'))- .map((group) => ({- ...group,- rows: group.checks- .filter(visible)- .sort(- (a, b) =>- SEVERITY[a.state] - SEVERITY[b.state] ||- (hasVisualEvidence(b) ? 1 : 0) - (hasVisualEvidence(a) ? 1 : 0) ||- a.introducedAtRound - b.introducedAtRound,- ),- }))- .filter((group) => group.rows.length > 0);-- // A filter that matches nothing must read as "this bucket is empty", not as- // a blank bordered card — each filter gets its own reassuring line. But an- // EMPTY pending bucket where every check is signed off isn't "nothing here"- // — it's the finish line, so it earns a celebration instead of a flat line.- if (visibleRows.length === 0) {- const allAccepted = filter === 'pending' && isGroupFullyAccepted(checks);- return (- <Flexbox align={'center'} className={styles.emptyCard} gap={12} justify={'center'}>- {allAccepted ? (- <>- <Icon- className={styles.celebrateIcon}- color={cssVar.colorSuccess}- icon={PartyPopper}- size={40}- />- <Flexbox align={'center'} gap={4}>- <Text strong style={{ color: cssVar.colorSuccess, fontSize: 15 }}>- {t('acceptance.checks.allAccepted.title')}- </Text>- <Text fontSize={13} type={'secondary'}>- {t('acceptance.checks.allAccepted.desc')}- </Text>- </Flexbox>- </>- ) : (- <Empty- icon={CircleDashed}- description={t(- filter === 'all'- ? 'acceptance.checks.empty'- : `acceptance.checks.emptyFilter.${filter}`,- )}- />- )}- </Flexbox>- );- }-- if (!shouldGroupChecks(checks.length)) {- return (- <Flexbox className={styles.groupCard}>- {visibleRows.map((check) => (- <AcceptanceCheckRow- canReview={canReview}- check={check}- expanded={expanded.has(check.id)}- key={check.id}- reviewPending={reviewPending}- onDismissProposal={onDismissProposal}- onOpenTrace={onOpenTrace}- onReview={onReview}- onRound={onRound}- onToggle={() => onToggleItem(check.id)}- />- ))}- </Flexbox>- );- }-- return (- <Flexbox className={styles.groupCard}>- {groups.map(({ checks: groupChecks_, key, label, rows }, groupIndex) => {- const passed = groupChecks_.filter((check) => check.state === 'passed').length;- const collapsed = collapsedGroups.has(key);- const anyItemOpen = rows.some((check) => expanded.has(check.id));- // Only executed checks can be stamped — see the row-level gating.- const reviewableChecks = groupChecks_.filter((check) => check.result);- const unaccepted = reviewableChecks.filter(- (check) => !['accepted', 'ignored'].includes(userReviewState(check)),- );- // The header counts what the REVIEWER cares about: how many they- // signed off, how many the verifier flagged, how many they sent- // back — not the verifier's pass tally alone.- const acceptedCount = reviewableChecks.filter(- (check) => userReviewState(check) === 'accepted',- ).length;- const rejectedCount = reviewableChecks.filter(- (check) => userReviewState(check) === 'rejected',- ).length;- const ignoredCount = reviewableChecks.filter(- (check) => userReviewState(check) === 'ignored',- ).length;- const exceptionCount = groupChecks_.filter((check) => isException(check)).length;- // Everything passed AND the user signed all of it off — the ratio- // itself turns into the green receipt, no separate right-side note.- const allVerified = passed === groupChecks_.length && isGroupFullyAccepted(groupChecks_);- // Group-scoped feedback targets the raw category ('' = uncategorized).- const rawCategory = key === 'uncategorized' ? '' : label;- const feedbackEntries = groupFeedback.filter((entry) => entry.category === rawCategory);-- return (- <Fragment key={key}>- <Flexbox- horizontal- align={'center'}- className={styles.groupHeader}- gap={8}- style={{- borderBlockStart:- groupIndex > 0 ? `1px solid ${cssVar.colorBorderSecondary}` : 'none',- }}- onClick={() => onToggleGroup(key)}- >- <Text strong style={{ fontSize: 13 }}>- {label}- </Text>- {allVerified ? (- <Flexbox- horizontal- align={'center'}- gap={4}- style={{ color: cssVar.colorSuccess, fontSize: 12 }}- >- <Icon icon={BadgeCheck} size={13} />- {t('acceptance.group.allVerified', { passed, total: groupChecks_.length })}- </Flexbox>- ) : (- <Flexbox horizontal align={'center'} gap={8}>- <Text fontSize={12} type={'secondary'}>- {t('acceptance.group.acceptedRatio', {- accepted: acceptedCount,- total: groupChecks_.length,- })}- </Text>- {exceptionCount > 0 && (- <Text style={{ color: cssVar.colorError, fontSize: 12 }}>- {t('acceptance.group.failedCount', { count: exceptionCount })}- </Text>- )}- {rejectedCount > 0 && (- <Text style={{ color: cssVar.colorError, fontSize: 12 }}>- {t('acceptance.group.rejectedCount', { count: rejectedCount })}- </Text>- )}- {ignoredCount > 0 && (- <Text fontSize={12} type={'secondary'}>- {t('acceptance.group.ignoredCount', { count: ignoredCount })}- </Text>- )}- </Flexbox>- )}- {/* Bulk accept sits by the ratio it settles, hover-revealed —- a full-width column of always-on buttons begs misclicks. */}- {canReview &&- reviewableChecks.length > 0 &&- (unaccepted.length > 0 ? (- <Button- className={'acceptance-group-actions'}- disabled={reviewPending && acceptingGroup !== key}- icon={<Icon icon={BadgeCheck} />}- loading={acceptingGroup === key}- size={'small'}- // The spinner must stay visible after the pointer leaves.- style={acceptingGroup === key ? { opacity: 1 } : undefined}- type={'text'}- onClick={async (event) => {- event.stopPropagation();- setAcceptingGroup(key);- const ok = await onReview({- action: 'accept',- checkItemIds: unaccepted.map((check) => check.id),- });- setAcceptingGroup(null);- // A fully signed-off group is settled business — fold it.- if (ok && !collapsed) onToggleGroup(key);- }}- >- {t('acceptance.review.acceptAll')}- </Button>- ) : allVerified || ignoredCount > 0 ? null : (- // Fully signed off but not all green — the mixed-verdict- // receipt that can't fold into the ratio text.- <Flexbox- horizontal- align={'center'}- gap={4}- style={{ color: cssVar.colorSuccess, fontSize: 12 }}- >- <Icon icon={BadgeCheck} size={13} />- {t('acceptance.review.acceptAllDone')}- </Flexbox>- ))}- <Flexbox flex={1} />- {/* Group-scoped feedback — the channel for concerns that- belong to no single check yet must reach the next round.- Lives with the other group-level controls by the chevron. */}- {canReview && (- <span className={'acceptance-group-actions'}>- <ActionIcon- icon={MessageSquareText}- size={'small'}- title={t('acceptance.group.feedbackAction')}- onClick={(event) => {- event.stopPropagation();- openGroupFeedbackModal({- groupLabel: label,- onConfirm: (comment, fileIds) =>- onGroupFeedback(rawCategory, comment, fileIds),- });- }}- />- </span>- )}- {collapsed ? (- // Fixed-size placeholder keeps the header height stable across toggles.- <div style={{ height: 24, width: 24 }} />- ) : (- <ActionIcon- icon={anyItemOpen ? ChevronsDownUp : ChevronsUpDown}- size={'small'}- title={- anyItemOpen- ? t('acceptance.group.collapseItems')- : t('acceptance.group.expandItems')- }- onClick={(event) => {- event.stopPropagation();- // Expanding a group is "show me what still needs judgment"- // — rows the user already accepted are settled business- // and stay folded (they open individually on demand).- // Collapsing folds everything, accepted or not.- onToggleGroupItems(- anyItemOpen- ? rows.map((check) => check.id)- : rows- .filter((check) => userReviewState(check) !== 'accepted')- .map((check) => check.id),- !anyItemOpen,- );- }}- />- )}- <Icon- color={cssVar.colorTextQuaternary}- icon={ChevronRight}- size={14}- style={{- transform: collapsed ? 'none' : 'rotate(90deg)',- transition: 'transform 0.2s',- }}- />- </Flexbox>- {/* Group feedback trail — newest first; entries consumed by a- later round stay readable but visually recede. */}- {!collapsed && feedbackEntries.length > 0 && (- <Flexbox gap={10} paddingBlock={10} paddingInline={16}>- {[...feedbackEntries].reverse().map((entry) => {- const stale = entry.roundIndex < currentRound;- return (- <Flexbox- gap={4}- key={`${entry.createdAt}-${entry.roundIndex}`}- style={stale ? { opacity: 0.55 } : undefined}- >- <Flexbox horizontal align={'center'} gap={6}>- <Icon- color={stale ? cssVar.colorTextQuaternary : cssVar.colorError}- icon={MessageSquareText}- size={13}- />- <Text- style={{- color: stale ? cssVar.colorTextTertiary : cssVar.colorError,- fontSize: 12,- }}- >- {t('acceptance.group.feedbackLabel')}- </Text>- <Text fontSize={12} type={'secondary'}>- {hydrated ? dayjs(entry.createdAt).format('MM-DD HH:mm') : null}- </Text>- </Flexbox>- <Text style={{ fontSize: 12 }}>{entry.comment}</Text>- <AttachmentThumbs attachments={entry.attachments} />- </Flexbox>- );- })}- </Flexbox>- )}- {!collapsed &&- rows.map((check) => (- <AcceptanceCheckRow- canReview={canReview}- check={check}- expanded={expanded.has(check.id)}- key={check.id}- reviewPending={reviewPending}- onDismissProposal={onDismissProposal}- onOpenTrace={onOpenTrace}- onReview={onReview}- onRound={onRound}- onToggle={() => onToggleItem(check.id)}- />- ))}- </Fragment>- );- })}- </Flexbox>- );- },-);--CheckList.displayName = 'AcceptanceCheckList';--export default CheckList;diff --git a/src/features/Acceptance/Viewer/AcceptanceCheckInventory.tsx b/src/features/Acceptance/Viewer/Checks/AcceptanceCheckInventory.tsxsimilarity index 95%rename from src/features/Acceptance/Viewer/AcceptanceCheckInventory.tsxrename to src/features/Acceptance/Viewer/Checks/AcceptanceCheckInventory.tsxindex 81442e98b66..51b2253b7fa 100644--- a/src/features/Acceptance/Viewer/AcceptanceCheckInventory.tsx+++ b/src/features/Acceptance/Viewer/Checks/AcceptanceCheckInventory.tsx@@ -14,23 +14,24 @@ import { mutate as globalMutate } from '@/libs/swr';import { isAcceptanceListKey } from '@/libs/swr/keys';import { verifyService } from '@/services/verify';-import AcceptanceInteractionCost from './AcceptanceInteractionCost';-import { useAcceptanceScope } from './AcceptanceScope';-import CheckList, {+import { useAcceptanceScope } from '../AcceptanceScope';+import { hasVisualEvidence } from '../Evidence/evidence';+import AcceptanceInteractionCost from '../History/AcceptanceInteractionCost';+import { checksForTurn } from '../turnChecks';+import { useAcceptanceBundle } from '../useAcceptanceBundle';+import { useAcceptanceTurn } from '../useAcceptanceTurn';+import { canReviewAcceptance } from '../visibility';+import CheckList from './CheckList';+import {type CheckFilter,checkFilterState,groupChecks,- hasVisualEvidence,isException,isGroupFullyAccepted,shouldGroupChecks,userReviewState,-} from './CheckList';+} from './checkState';import { EMPTY_ID_SET, setAggregateEntry } from './expandState';-import { checksForTurn } from './turnChecks';-import { useAcceptanceBundle } from './useAcceptanceBundle';-import { useAcceptanceTurn } from './useAcceptanceTurn';-import { canReviewAcceptance } from './visibility';interface AcceptanceCheckInventoryProps {children?: ReactNode;diff --git a/src/features/Acceptance/Viewer/AcceptanceCheckOwnerToolbar.tsx b/src/features/Acceptance/Viewer/Checks/AcceptanceCheckOwnerToolbar.tsxsimilarity index 96%rename from src/features/Acceptance/Viewer/AcceptanceCheckOwnerToolbar.tsxrename to src/features/Acceptance/Viewer/Checks/AcceptanceCheckOwnerToolbar.tsxindex 69dddbc382a..da719eb1580 100644--- a/src/features/Acceptance/Viewer/AcceptanceCheckOwnerToolbar.tsx+++ b/src/features/Acceptance/Viewer/Checks/AcceptanceCheckOwnerToolbar.tsx@@ -9,11 +9,11 @@ import { mutate as globalMutate } from '@/libs/swr';import { isAcceptanceListKey } from '@/libs/swr/keys';import { verifyService } from '@/services/verify';-import { useAcceptanceScope } from './AcceptanceScope';+import { useAcceptanceScope } from '../AcceptanceScope';+import { hasVisualEvidence } from '../Evidence/evidence';+import { countAwaitingPrediction, summarizePredictRound } from '../History/predictRound';+import { useAcceptanceBundle } from '../useAcceptanceBundle';import { openAddCheckModal } from './AddCheckModal';-import { hasVisualEvidence } from './CheckList';-import { countAwaitingPrediction, summarizePredictRound } from './predictRound';-import { useAcceptanceBundle } from './useAcceptanceBundle';/** How long to wait between bundle re-fetches while the batch runs. */const PREDICT_POLL_INTERVAL_MS = 4000;diff --git a/src/features/Acceptance/Viewer/AddCheckModal.tsx b/src/features/Acceptance/Viewer/Checks/AddCheckModal.tsxsimilarity index 99%rename from src/features/Acceptance/Viewer/AddCheckModal.tsxrename to src/features/Acceptance/Viewer/Checks/AddCheckModal.tsxindex fb968451372..36b4c4b52ee 100644--- a/src/features/Acceptance/Viewer/AddCheckModal.tsx+++ b/src/features/Acceptance/Viewer/Checks/AddCheckModal.tsx@@ -16,7 +16,7 @@ import { Check, CircleDashed, Plus } from 'lucide-react';import { memo, useMemo, useState } from 'react';import { useTranslation } from 'react-i18next';-import { useRubricCriteria, useRubrics } from '../hooks';+import { useRubricCriteria, useRubrics } from '../../hooks';interface AddCheckContentProps {existingIds: string[];diff --git a/src/features/Acceptance/Viewer/Checks/CheckHistory.tsx b/src/features/Acceptance/Viewer/Checks/CheckHistory.tsxnew file mode 100644index 00000000000..946909c7688--- /dev/null+++ b/src/features/Acceptance/Viewer/Checks/CheckHistory.tsx@@ -0,0 +1,300 @@+'use client';++import type { AcceptanceReviewAnnotation } from '@lobechat/types';+import { Flexbox, Icon, Image, Tooltip } from '@lobehub/ui';+import { Text } from '@lobehub/ui/base-ui';+import { cssVar } from 'antd-style';+import dayjs from 'dayjs';+import { BadgeCheck, Ban, MessageSquareX } from 'lucide-react';+import { memo } from 'react';+import { useTranslation } from 'react-i18next';++import AudioPlayer from '@/features/AudioPlayer';+import { useIsHydrated } from '@/hooks/useIsHydrated';++import { AnnotatedImage } from '../Evidence/Annotation';+import { AttachmentThumbs } from '../Evidence/attachments';+import { IMAGE_EVIDENCE, imageRatio } from '../Evidence/evidence';+import { styles as evidenceStyles } from '../Evidence/styles';+import { styles } from './styles';+import type { AcceptanceCheck, AcceptanceCheckReviewEntry, AcceptanceEvidence } from './types';++/**+ * The user's acceptance, rendered as one quiet gray line — a signature, not an+ * event card: the verdict icon stays the row's headline, this is metadata.+ */+export const AcceptedNote = memo<{ review: AcceptanceCheckReviewEntry }>(({ review }) => {+ const { t } = useTranslation('verify');+ const hydrated = useIsHydrated();+ return (+ <Flexbox horizontal align={'center'} gap={6}>+ <Icon color={cssVar.colorTextQuaternary} icon={BadgeCheck} size={13} />+ <Text fontSize={12} type={'secondary'}>+ {t('acceptance.review.acceptedNote', {+ time: hydrated ? dayjs(review.createdAt).format('MM-DD HH:mm') : '',+ })}+ </Text>+ </Flexbox>+ );+});++export const IgnoredNote = memo<{ review: AcceptanceCheckReviewEntry }>(({ review }) => {+ const { t } = useTranslation('verify');+ const hydrated = useIsHydrated();+ return (+ <Flexbox horizontal align={'center'} gap={6}>+ <Icon color={cssVar.colorTextQuaternary} icon={Ban} size={13} />+ <Text fontSize={12} type={'secondary'}>+ {t('acceptance.review.ignoredNote', {+ time: hydrated ? dayjs(review.createdAt).format('MM-DD HH:mm') : '',+ })}+ </Text>+ </Flexbox>+ );+});++/**+ * One reject-feedback event: a small red marker line, then the note and the+ * circled regions as plain content — no background wash. Used both as the+ * standing feedback under the row's evidence and inside the iteration history.+ */+export const FeedbackCard = memo<{+ evidenceById: Map<string, AcceptanceEvidence>;+ review: AcceptanceCheckReviewEntry;+}>(({ evidenceById, review }) => {+ const { t } = useTranslation('verify');+ const hydrated = useIsHydrated();+ if (review.action === 'accept') return <AcceptedNote review={review} />;+ if (review.action === 'ignore') return <IgnoredNote review={review} />;++ const groups = new Map<+ string,+ { comment?: string; rect: AcceptanceReviewAnnotation['rect'] }[]+ >();+ for (const annotation of review.annotations ?? []) {+ const bucket = groups.get(annotation.evidenceId) ?? [];+ bucket.push({ comment: annotation.comment, rect: annotation.rect });+ groups.set(annotation.evidenceId, bucket);+ }++ return (+ <Flexbox gap={8}>+ <Flexbox horizontal align={'center'} gap={6}>+ <Icon color={cssVar.colorError} icon={MessageSquareX} size={13} />+ <Text style={{ color: cssVar.colorError, fontSize: 12 }}>+ {t('acceptance.review.feedbackLabel')}+ </Text>+ <Text fontSize={12} type={'secondary'}>+ {hydrated ? dayjs(review.createdAt).format('MM-DD HH:mm') : null}+ </Text>+ </Flexbox>+ {review.comment && <Text style={{ fontSize: 12 }}>{review.comment}</Text>}+ <AttachmentThumbs attachments={review.attachments} />+ {[...groups.entries()].map(([evidenceId, annotations]) => {+ const evidence = evidenceById.get(evidenceId);+ // The evidence may be gone (deleted round) — the notes stay readable.+ if (!evidence?.fileUrl)+ return annotations+ .filter((annotation) => annotation.comment)+ .map((annotation, index) => (+ <Text fontSize={12} key={`${evidenceId}-${index}`} type={'secondary'}>+ {annotation.comment}+ </Text>+ ));+ return (+ <AnnotatedImage+ annotations={annotations}+ key={evidenceId}+ src={evidence.fileUrl}+ imageStyle={{+ // Known dimensions reserve the box up front (explicit height ++ // ratio-derived width) — no height jump when the row expands+ // and the screenshot streams in.+ aspectRatio: imageRatio(evidence),+ height: evidence.fileHeight ? Math.min(evidence.fileHeight, 240) : undefined,+ maxHeight: 240,+ }}+ />+ );+ })}+ </Flexbox>+ );+});++/** Everything a check knows about its evidence, keyed by id — annotation lookups. */+export const collectEvidenceById = (check: AcceptanceCheck): Map<string, AcceptanceEvidence> => {+ const map = new Map<string, AcceptanceEvidence>();+ for (const entry of check.timeline) for (const item of entry.evidence) map.set(item.id, item);+ for (const item of check.evidence) map.set(item.id, item);+ return map;+};++/** A step of the merged history: an executed round, or a user feedback event. */+type HistoryStep =+ | { key: string; kind: 'review'; review: AcceptanceCheckReviewEntry; roundIndex: number }+ | { key: string; kind: 'run'; roundIndex: number; step: AcceptanceCheck['timeline'][number] };++/**+ * The iteration-history timeline (newest first): each executed step's round,+ * the wording THAT round used, and its evidence — plus the user's feedback+ * events, slotted after the round they judged — how the check evolved.+ */+export const IterationTimeline = memo<{+ check: AcceptanceCheck;+ evidenceById: Map<string, AcceptanceEvidence>;+ historyReviews: AcceptanceCheckReviewEntry[];+ onRound?: (round: number) => void;+}>(({ check, evidenceById, historyReviews, onRound }) => {+ const { t } = useTranslation('verify');++ const merged: HistoryStep[] = [+ ...check.timeline.map<HistoryStep>((step) => ({+ key: `run-${step.roundIndex}-${step.resultId}`,+ kind: 'run',+ roundIndex: step.roundIndex,+ step,+ })),+ ...historyReviews.map<HistoryStep>((review) => ({+ key: `review-${review.id}`,+ kind: 'review',+ review,+ roundIndex: review.roundIndex,+ })),+ ]+ .sort(+ (a, b) =>+ a.roundIndex - b.roundIndex ||+ // Within a round the run comes first — feedback judges its result.+ (a.kind === 'review' ? 1 : 0) - (b.kind === 'review' ? 1 : 0) ||+ (a.kind === 'review' && b.kind === 'review'+ ? new Date(a.review.createdAt).getTime() - new Date(b.review.createdAt).getTime()+ : 0),+ )+ .reverse();++ return (+ <Flexbox>+ {merged.map((entry, index) => {+ const isCurrent = index === 0;+ const isLast = index === merged.length - 1;++ if (entry.kind === 'review')+ return (+ <Flexbox horizontal gap={12} key={entry.key}>+ <Flexbox align={'center'} style={{ flex: 'none', width: 9 }}>+ <span+ className={styles.stepDot}+ style={{+ borderColor:+ entry.review.action === 'accept'+ ? cssVar.colorSuccess+ : entry.review.action === 'ignore'+ ? cssVar.colorTextQuaternary+ : cssVar.colorError,+ }}+ />+ {!isLast && <div className={styles.stepRail} />}+ </Flexbox>+ <Flexbox flex={1} gap={6} style={{ minWidth: 0, paddingBlockEnd: isLast ? 0 : 20 }}>+ <FeedbackCard evidenceById={evidenceById} review={entry.review} />+ </Flexbox>+ </Flexbox>+ );++ const { step } = entry;+ const stateColor =+ {+ failed: cssVar.colorError,+ passed: cssVar.colorSuccess,+ uncertain: cssVar.colorWarning,+ }[step.state as string] ?? cssVar.colorTextQuaternary;++ return (+ <Flexbox horizontal gap={12} key={entry.key}>+ <Flexbox align={'center'} style={{ flex: 'none', width: 9 }}>+ <span+ className={styles.stepDot}+ style={{+ background: isCurrent ? stateColor : cssVar.colorBgContainer,+ borderColor: isCurrent ? stateColor : cssVar.colorTextQuaternary,+ }}+ />+ {!isLast && <div className={styles.stepRail} />}+ </Flexbox>+ <Flexbox flex={1} gap={6} style={{ minWidth: 0, paddingBlockEnd: isLast ? 0 : 20 }}>+ {onRound ? (+ <Tooltip title={t('acceptance.history.jump', { round: step.roundIndex })}>+ <Text+ strong+ style={{ cursor: 'pointer', fontSize: 12, lineHeight: '19px' }}+ onClick={() => onRound(step.roundIndex)}+ >+ {t('acceptance.round', { round: step.roundIndex })}+ </Text>+ </Tooltip>+ ) : (+ <Text strong style={{ fontSize: 12, lineHeight: '19px' }}>+ {t('acceptance.round', { round: step.roundIndex })}+ </Text>+ )}+ <Text style={{ fontSize: 12 }}>{step.title}</Text>+ {step.evidence.length > 0 && (+ <Flexbox horizontal gap={8} wrap={'wrap'}>+ {step.evidence.map((item) =>+ item.fileUrl && IMAGE_EVIDENCE.has(item.type) ? (+ <Flexbox className={evidenceStyles.evidenceImage} key={item.id}>+ <Image+ alt={item.description ?? item.type}+ loading={'lazy'}+ src={item.fileUrl}+ style={{ borderRadius: 0, maxHeight: 160, maxWidth: 280, width: 'auto' }}+ variant={'borderless'}+ />+ </Flexbox>+ ) : item.fileUrl && item.type === 'video' ? (+ // A player, never an <Image>: pointing an image box at an+ // mp4 renders a broken thumbnail, not the clip.+ <video+ controls+ key={item.id}+ src={item.fileUrl}+ style={{ borderRadius: 8, maxHeight: 160, maxWidth: 280 }}+ />+ ) : item.fileUrl && item.type === 'audio' ? (+ <div key={item.id} style={{ width: '100%' }}>+ <AudioPlayer+ fullWidth+ alt={item.description ?? item.type}+ downloadFileName={item.fileName ?? 'audio'}+ url={item.fileUrl}+ />+ </div>+ ) : item.content ? (+ <div+ className={evidenceStyles.evidenceText}+ key={item.id}+ style={{ maxHeight: 120, maxWidth: 420 }}+ >+ {item.content}+ </div>+ ) : null,+ )}+ </Flexbox>+ )}+ </Flexbox>+ </Flexbox>+ );+ })}+ {check.result?.suggestion && (+ <Flexbox horizontal gap={12} style={{ marginBlockStart: 12 }}>+ <Text fontSize={12} style={{ flex: 'none', minWidth: 64 }} type={'secondary'}>+ {t('acceptance.detail.suggestion')}+ </Text>+ <Text fontSize={12} type={'secondary'}>+ {check.result.suggestion}+ </Text>+ </Flexbox>+ )}+ </Flexbox>+ );+});diff --git a/src/features/Acceptance/Viewer/CheckList.test.ts b/src/features/Acceptance/Viewer/Checks/CheckList.test.tssimilarity index 98%rename from src/features/Acceptance/Viewer/CheckList.test.tsrename to src/features/Acceptance/Viewer/Checks/CheckList.test.tsindex dfca4f9275c..55083a48694 100644--- a/src/features/Acceptance/Viewer/CheckList.test.ts+++ b/src/features/Acceptance/Viewer/Checks/CheckList.test.ts@@ -1,17 +1,6 @@import { describe, expect, it } from 'vitest';-import {- type AcceptanceCheck,- checkFilterState,- focusedCheckStates,- groupChecks,- hasAnnotatableEvidence,- hasVisualEvidence,- isCheckWorkActionable,- shouldCollapseAfterReview,- shouldGroupChecks,- userReviewState,-} from './CheckList';+import { hasAnnotatableEvidence, hasVisualEvidence } from '../Evidence/evidence';import {canDismissRejectModal,CHECK_REJECT_MODAL_SIZE,@@ -21,7 +10,17 @@ import {rejectModalTitle,serializeReviewAnnotations,TEXT_REJECT_MODAL_WIDTH,-} from './CheckRejectModal';+} from '../Review/CheckRejectModal';+import {+ checkFilterState,+ focusedCheckStates,+ groupChecks,+ isCheckWorkActionable,+ shouldCollapseAfterReview,+ shouldGroupChecks,+ userReviewState,+} from './checkState';+import { type AcceptanceCheck } from './types';const check = (id: string, category: string | null, surface: AcceptanceCheck['surface']) =>({ category, id, surface }) as AcceptanceCheck;diff --git a/src/features/Acceptance/Viewer/Checks/CheckList.tsx b/src/features/Acceptance/Viewer/Checks/CheckList.tsxnew file mode 100644index 00000000000..9689ad9a89c--- /dev/null+++ b/src/features/Acceptance/Viewer/Checks/CheckList.tsx@@ -0,0 +1,419 @@+'use client';++import type { AcceptanceGroupFeedback } from '@lobechat/types';+import { Empty, Flexbox, Icon } from '@lobehub/ui';+import { ActionIcon, Button, Text } from '@lobehub/ui/base-ui';+import { cssVar } from 'antd-style';+import dayjs from 'dayjs';+import {+ BadgeCheck,+ ChevronRight,+ ChevronsDownUp,+ ChevronsUpDown,+ CircleDashed,+ MessageSquareText,+ PartyPopper,+} from 'lucide-react';+import { Fragment, memo, useState } from 'react';+import { useTranslation } from 'react-i18next';++import { useIsHydrated } from '@/hooks/useIsHydrated';++import { AttachmentThumbs } from '../Evidence/attachments';+import { hasVisualEvidence } from '../Evidence/evidence';+import { openGroupFeedbackModal } from '../Review/modals';+import { AcceptanceCheckRow } from './CheckRow';+import type { CheckFilter } from './checkState';+import {+ checkFilterState,+ groupChecks,+ isException,+ isGroupFullyAccepted,+ SEVERITY,+ shouldGroupChecks,+ userReviewState,+} from './checkState';+import { styles } from './styles';+import type { AcceptanceCheck, CheckReviewInput, ProposalDismissInput } from './types';++interface CheckListProps {+ /** Whether the viewer may review checks (the aggregate's owner). */+ canReview: boolean;+ checks: AcceptanceCheck[];+ collapsedGroups: Set<string>;+ /** The latest round index — arbitrates group-feedback staleness. */+ currentRound: number;+ expanded: Set<string>;+ filter: CheckFilter;+ /** Group-scoped feedback entries recorded on the aggregate. */+ groupFeedback: AcceptanceGroupFeedback[];+ /** Answer a model proposal without ruling on the check itself. */+ onDismissProposal?: (input: ProposalDismissInput) => Promise<void>;+ /** Record group-scoped feedback; resolves true when the write landed. */+ onGroupFeedback: (category: string, comment: string, fileIds: string[]) => Promise<boolean>;+ /** Open an agent judge's verification run (its trace IS the argument). */+ onOpenTrace?: (verifierOperationId: string) => void | Promise<void>;+ /** Record the user's verdict; resolves true when the write landed. */+ onReview: (input: CheckReviewInput) => Promise<boolean>;+ onRound?: (round: number) => void;+ onToggleGroup: (key: string) => void;+ onToggleGroupItems: (ids: string[], open: boolean) => void;+ onToggleItem: (id: string) => void;+ reviewPending: boolean;+}++/** The union check list: one joined card, collapsible business groups. */+const CheckList = memo<CheckListProps>(+ ({+ canReview,+ checks,+ collapsedGroups,+ currentRound,+ expanded,+ filter,+ groupFeedback,+ onDismissProposal,+ onGroupFeedback,+ onReview,+ onOpenTrace,+ onRound,+ onToggleGroup,+ onToggleGroupItems,+ onToggleItem,+ reviewPending,+ }) => {+ const { t } = useTranslation('verify');+ const hydrated = useIsHydrated();+ const [acceptingGroup, setAcceptingGroup] = useState<string | null>(null);++ const visible = (check: AcceptanceCheck) =>+ filter === 'all' || checkFilterState(check) === filter;++ const visibleRows = checks+ .filter(visible)+ .sort(+ (a, b) =>+ SEVERITY[a.state] - SEVERITY[b.state] ||+ (hasVisualEvidence(b) ? 1 : 0) - (hasVisualEvidence(a) ? 1 : 0) ||+ a.introducedAtRound - b.introducedAtRound,+ );+ const groups = groupChecks(checks, t('acceptance.group.uncategorized'))+ .map((group) => ({+ ...group,+ rows: group.checks+ .filter(visible)+ .sort(+ (a, b) =>+ SEVERITY[a.state] - SEVERITY[b.state] ||+ (hasVisualEvidence(b) ? 1 : 0) - (hasVisualEvidence(a) ? 1 : 0) ||+ a.introducedAtRound - b.introducedAtRound,+ ),+ }))+ .filter((group) => group.rows.length > 0);++ // A filter that matches nothing must read as "this bucket is empty", not as+ // a blank bordered card — each filter gets its own reassuring line. But an+ // EMPTY pending bucket where every check is signed off isn't "nothing here"+ // — it's the finish line, so it earns a celebration instead of a flat line.+ if (visibleRows.length === 0) {+ const allAccepted = filter === 'pending' && isGroupFullyAccepted(checks);+ return (+ <Flexbox align={'center'} className={styles.emptyCard} gap={12} justify={'center'}>+ {allAccepted ? (+ <>+ <Icon+ className={styles.celebrateIcon}+ color={cssVar.colorSuccess}+ icon={PartyPopper}+ size={40}+ />+ <Flexbox align={'center'} gap={4}>+ <Text strong style={{ color: cssVar.colorSuccess, fontSize: 15 }}>+ {t('acceptance.checks.allAccepted.title')}+ </Text>+ <Text fontSize={13} type={'secondary'}>+ {t('acceptance.checks.allAccepted.desc')}+ </Text>+ </Flexbox>+ </>+ ) : (+ <Empty+ icon={CircleDashed}+ description={t(+ filter === 'all'+ ? 'acceptance.checks.empty'+ : `acceptance.checks.emptyFilter.${filter}`,+ )}+ />+ )}+ </Flexbox>+ );+ }++ if (!shouldGroupChecks(checks.length)) {+ return (+ <Flexbox className={styles.groupCard}>+ {visibleRows.map((check) => (+ <AcceptanceCheckRow+ canReview={canReview}+ check={check}+ expanded={expanded.has(check.id)}+ key={check.id}+ reviewPending={reviewPending}+ onDismissProposal={onDismissProposal}+ onOpenTrace={onOpenTrace}+ onReview={onReview}+ onRound={onRound}+ onToggle={() => onToggleItem(check.id)}+ />+ ))}+ </Flexbox>+ );+ }++ return (+ <Flexbox className={styles.groupCard}>+ {groups.map(({ checks: groupChecks_, key, label, rows }, groupIndex) => {+ const passed = groupChecks_.filter((check) => check.state === 'passed').length;+ const collapsed = collapsedGroups.has(key);+ const anyItemOpen = rows.some((check) => expanded.has(check.id));+ // Only executed checks can be stamped — see the row-level gating.+ const reviewableChecks = groupChecks_.filter((check) => check.result);+ const unaccepted = reviewableChecks.filter(+ (check) => !['accepted', 'ignored'].includes(userReviewState(check)),+ );+ // The header counts what the REVIEWER cares about: how many they+ // signed off, how many the verifier flagged, how many they sent+ // back — not the verifier's pass tally alone.+ const acceptedCount = reviewableChecks.filter(+ (check) => userReviewState(check) === 'accepted',+ ).length;+ const rejectedCount = reviewableChecks.filter(+ (check) => userReviewState(check) === 'rejected',+ ).length;+ const ignoredCount = reviewableChecks.filter(+ (check) => userReviewState(check) === 'ignored',+ ).length;+ const exceptionCount = groupChecks_.filter((check) => isException(check)).length;+ // Everything passed AND the user signed all of it off — the ratio+ // itself turns into the green receipt, no separate right-side note.+ const allVerified = passed === groupChecks_.length && isGroupFullyAccepted(groupChecks_);+ // Group-scoped feedback targets the raw category ('' = uncategorized).+ const rawCategory = key === 'uncategorized' ? '' : label;+ const feedbackEntries = groupFeedback.filter((entry) => entry.category === rawCategory);++ return (+ <Fragment key={key}>+ <Flexbox+ horizontal+ align={'center'}+ className={styles.groupHeader}+ gap={8}+ style={{+ borderBlockStart:+ groupIndex > 0 ? `1px solid ${cssVar.colorBorderSecondary}` : 'none',+ }}+ onClick={() => onToggleGroup(key)}+ >+ <Text strong style={{ fontSize: 13 }}>+ {label}+ </Text>+ {allVerified ? (+ <Flexbox+ horizontal+ align={'center'}+ gap={4}+ style={{ color: cssVar.colorSuccess, fontSize: 12 }}+ >+ <Icon icon={BadgeCheck} size={13} />+ {t('acceptance.group.allVerified', { passed, total: groupChecks_.length })}+ </Flexbox>+ ) : (+ <Flexbox horizontal align={'center'} gap={8}>+ <Text fontSize={12} type={'secondary'}>+ {t('acceptance.group.acceptedRatio', {+ accepted: acceptedCount,+ total: groupChecks_.length,+ })}+ </Text>+ {exceptionCount > 0 && (+ <Text style={{ color: cssVar.colorError, fontSize: 12 }}>+ {t('acceptance.group.failedCount', { count: exceptionCount })}+ </Text>+ )}+ {rejectedCount > 0 && (+ <Text style={{ color: cssVar.colorError, fontSize: 12 }}>+ {t('acceptance.group.rejectedCount', { count: rejectedCount })}+ </Text>+ )}+ {ignoredCount > 0 && (+ <Text fontSize={12} type={'secondary'}>+ {t('acceptance.group.ignoredCount', { count: ignoredCount })}+ </Text>+ )}+ </Flexbox>+ )}+ {/* Bulk accept sits by the ratio it settles, hover-revealed —+ a full-width column of always-on buttons begs misclicks. */}+ {canReview &&+ reviewableChecks.length > 0 &&+ (unaccepted.length > 0 ? (+ <Button+ className={'acceptance-group-actions'}+ disabled={reviewPending && acceptingGroup !== key}+ icon={<Icon icon={BadgeCheck} />}+ loading={acceptingGroup === key}+ size={'small'}+ // The spinner must stay visible after the pointer leaves.+ style={acceptingGroup === key ? { opacity: 1 } : undefined}+ type={'text'}+ onClick={async (event) => {+ event.stopPropagation();+ setAcceptingGroup(key);+ const ok = await onReview({+ action: 'accept',+ checkItemIds: unaccepted.map((check) => check.id),+ });+ setAcceptingGroup(null);+ // A fully signed-off group is settled business — fold it.+ if (ok && !collapsed) onToggleGroup(key);+ }}+ >+ {t('acceptance.review.acceptAll')}+ </Button>+ ) : allVerified || ignoredCount > 0 ? null : (+ // Fully signed off but not all green — the mixed-verdict+ // receipt that can't fold into the ratio text.+ <Flexbox+ horizontal+ align={'center'}+ gap={4}+ style={{ color: cssVar.colorSuccess, fontSize: 12 }}+ >+ <Icon icon={BadgeCheck} size={13} />+ {t('acceptance.review.acceptAllDone')}+ </Flexbox>+ ))}+ <Flexbox flex={1} />+ {/* Group-scoped feedback — the channel for concerns that+ belong to no single check yet must reach the next round.+ Lives with the other group-level controls by the chevron. */}+ {canReview && (+ <span className={'acceptance-group-actions'}>+ <ActionIcon+ icon={MessageSquareText}+ size={'small'}+ title={t('acceptance.group.feedbackAction')}+ onClick={(event) => {+ event.stopPropagation();+ openGroupFeedbackModal({+ groupLabel: label,+ onConfirm: (comment, fileIds) =>+ onGroupFeedback(rawCategory, comment, fileIds),+ });+ }}+ />+ </span>+ )}+ {collapsed ? (+ // Fixed-size placeholder keeps the header height stable across toggles.+ <div style={{ height: 24, width: 24 }} />+ ) : (+ <ActionIcon+ icon={anyItemOpen ? ChevronsDownUp : ChevronsUpDown}+ size={'small'}+ title={+ anyItemOpen+ ? t('acceptance.group.collapseItems')+ : t('acceptance.group.expandItems')+ }+ onClick={(event) => {+ event.stopPropagation();+ // Expanding a group is "show me what still needs judgment"+ // — rows the user already accepted are settled business+ // and stay folded (they open individually on demand).+ // Collapsing folds everything, accepted or not.+ onToggleGroupItems(+ anyItemOpen+ ? rows.map((check) => check.id)+ : rows+ .filter((check) => userReviewState(check) !== 'accepted')+ .map((check) => check.id),+ !anyItemOpen,+ );+ }}+ />+ )}+ <Icon+ color={cssVar.colorTextQuaternary}+ icon={ChevronRight}+ size={14}+ style={{+ transform: collapsed ? 'none' : 'rotate(90deg)',+ transition: 'transform 0.2s',+ }}+ />+ </Flexbox>+ {/* Group feedback trail — newest first; entries consumed by a+ later round stay readable but visually recede. */}+ {!collapsed && feedbackEntries.length > 0 && (+ <Flexbox gap={10} paddingBlock={10} paddingInline={16}>+ {[...feedbackEntries].reverse().map((entry) => {+ const stale = entry.roundIndex < currentRound;+ return (+ <Flexbox+ gap={4}+ key={`${entry.createdAt}-${entry.roundIndex}`}+ style={stale ? { opacity: 0.55 } : undefined}+ >+ <Flexbox horizontal align={'center'} gap={6}>+ <Icon+ color={stale ? cssVar.colorTextQuaternary : cssVar.colorError}+ icon={MessageSquareText}+ size={13}+ />+ <Text+ style={{+ color: stale ? cssVar.colorTextTertiary : cssVar.colorError,+ fontSize: 12,+ }}+ >+ {t('acceptance.group.feedbackLabel')}+ </Text>+ <Text fontSize={12} type={'secondary'}>+ {hydrated ? dayjs(entry.createdAt).format('MM-DD HH:mm') : null}+ </Text>+ </Flexbox>+ <Text style={{ fontSize: 12 }}>{entry.comment}</Text>+ <AttachmentThumbs attachments={entry.attachments} />+ </Flexbox>+ );+ })}+ </Flexbox>+ )}+ {!collapsed &&+ rows.map((check) => (+ <AcceptanceCheckRow+ canReview={canReview}+ check={check}+ expanded={expanded.has(check.id)}+ key={check.id}+ reviewPending={reviewPending}+ onDismissProposal={onDismissProposal}+ onOpenTrace={onOpenTrace}+ onReview={onReview}+ onRound={onRound}+ onToggle={() => onToggleItem(check.id)}+ />+ ))}+ </Fragment>+ );+ })}+ </Flexbox>+ );+ },+);++CheckList.displayName = 'AcceptanceCheckList';++export default CheckList;diff --git a/src/features/Acceptance/Viewer/Checks/CheckRow.tsx b/src/features/Acceptance/Viewer/Checks/CheckRow.tsxnew file mode 100644index 00000000000..22befe8b9a0--- /dev/null+++ b/src/features/Acceptance/Viewer/Checks/CheckRow.tsx@@ -0,0 +1,767 @@+'use client';++import type { AcceptanceReviewAnnotation } from '@lobechat/types';+import { copyToClipboard, Flexbox, Icon, TextArea, Tooltip } from '@lobehub/ui';+import { ActionIcon, Button, Tag, Text } from '@lobehub/ui/base-ui';+import { cssVar, cx, useResponsive } from 'antd-style';+import dayjs from 'dayjs';+import {+ AudioLines,+ BadgeCheck,+ Ban,+ Check,+ CheckCheck,+ ChevronRight,+ CircleDashed,+ FileText,+ Film,+ Images,+ MessageSquareX,+ Repeat,+ Route,+} from 'lucide-react';+import { memo, useMemo, useState } from 'react';+import { useTranslation } from 'react-i18next';++import { hasRenderableEvidence, readVisualizationManifest } from '../../Report/visualization';+import { VisualizationDeltaBadge, VisualizationRenderer } from '../../Report/VisualizationRenderer';+import { checkDisplayTitle } from '../../utils';+import { evidenceCounts, hasAnnotatableEvidence, isAnnotatable } from '../Evidence/evidence';+import { EvidenceList } from '../Evidence/EvidenceList';+import { openCheckRejectModal } from '../Review/CheckRejectModal';+import type { CheckProposal } from '../Review/proposal';+import { classifyProposalEdit } from '../Review/proposal';+import ProposalCard from '../Review/ProposalCard';+import {+ AcceptedNote,+ collectEvidenceById,+ FeedbackCard,+ IgnoredNote,+ IterationTimeline,+} from './CheckHistory';+import { shouldCollapseAfterReview, userReviewState } from './checkState';+import { STATE_META } from './checkStatus';+import { styles } from './styles';+import type { AcceptanceCheck, CheckReviewInput, ProposalDismissInput } from './types';++const EVIDENCE_BADGES = [+ { icon: Images, key: 'image', labelKey: 'acceptance.evidence.image' },+ { icon: Film, key: 'video', labelKey: 'acceptance.evidence.video' },+ { icon: AudioLines, key: 'audio', labelKey: 'acceptance.evidence.audio' },+ { icon: FileText, key: 'file', labelKey: 'acceptance.evidence.file' },+] as const;++export const AcceptanceCheckRow = memo<{+ canReview: boolean;+ check: AcceptanceCheck;+ detailMode?: boolean;+ expanded: boolean;+ /** Answer a model proposal WITHOUT ruling on the check itself. */+ onDismissProposal?: (input: ProposalDismissInput) => Promise<void>;+ onReview: (input: CheckReviewInput) => Promise<boolean>;+ onRound?: (round: number) => void;+ /** Open an agent judge's verification run (its trace IS the argument). */+ onOpenTrace?: (verifierOperationId: string) => void | Promise<void>;+ onToggle: () => void;+ reviewPending: boolean;+}>(+ ({+ canReview,+ check,+ detailMode,+ expanded,+ onDismissProposal,+ onOpenTrace,+ onReview,+ onRound,+ onToggle,+ reviewPending,+ }) => {+ const { t } = useTranslation('verify');+ const { md: desktop = true } = useResponsive();+ // The judging narrative stays collapsed: level one is title + evidence.+ const [historyOpen, setHistoryOpen] = useState(false);+ const [seqCopied, setSeqCopied] = useState(false);+ const [accepting, setAccepting] = useState(false);+ const [ignoring, setIgnoring] = useState(false);+ const [rejecting, setRejecting] = useState(false);+ const [reviewComment, setReviewComment] = useState('');+ // The proposal starts folded: it is a suggestion, and an open panel on every+ // unreviewed check would push the evidence the reviewer came for below the fold.+ const [proposalOpen, setProposalOpen] = useState(false);+ const meta = STATE_META[check.state];+ const title = checkDisplayTitle(check.title, t('acceptance.checks.holisticTitle'));+ const counts = evidenceCounts(check.evidence);+ const visualization = readVisualizationManifest(check.result?.metadata);++ const reviewState = userReviewState(check);+ // The decision is stamped on the check's result row — a never-executed+ // check has no evidence to judge, so it exposes no review actions.+ const reviewable = canReview && Boolean(check.result);+ const activeReview =+ check.userReview && !check.userReview.stale+ ? check.reviews.at(-1) // the standing verdict is always the newest entry+ : undefined;+ const historyReviews = check.reviews.filter((entry) => entry !== activeReview);+ const evidenceById = collectEvidenceById(check);++ // Regions the proposal wants drawn on the evidence images already in this+ // row. Numbered across the whole proposal (not per image), so "区域 2" in+ // the card means the same box wherever it lives. Only while the card is+ // open — boxes with no visible explanation read as a defect of the evidence.+ const proposalOverlays = useMemo(() => {+ if (!proposalOpen || !check.prediction) return undefined;+ const map = new Map<+ string,+ { comment?: string; label?: number; rect: AcceptanceReviewAnnotation['rect'] }[]+ >();+ (check.prediction.annotations ?? []).forEach((annotation, index) => {+ const bucket = map.get(annotation.evidenceId) ?? [];+ bucket.push({ comment: annotation.comment, label: index + 1, rect: annotation.rect });+ map.set(annotation.evidenceId, bucket);+ });+ return map.size > 0 ? map : undefined;+ }, [proposalOpen, check.prediction]);+ const hasHistory = check.revisions > 1 || historyReviews.length > 0;++ /**+ * @param fromProposal - when set, the modal opens prefilled with the+ * model's note and regions, and the submitted result is diffed against it+ * so the signal records WHICH part of the proposal was wrong.+ */+ const openReject = (fromProposal?: CheckProposal, initialEvidenceId?: string) =>+ openCheckRejectModal({+ initialEvidenceId,+ previousAttachments:+ activeReview?.action === 'reject'+ ? activeReview.attachments+ ?.filter((item) => item.url)+ .map((item) => ({ id: item.id, name: item.name, url: item.url! }))+ : undefined,+ previousAnnotations:+ activeReview?.action === 'reject' ? activeReview.annotations : undefined,+ previousComment: activeReview?.action === 'reject' ? activeReview.comment : undefined,+ checkDescription: check.planItem?.description,+ checkTitle: `C${check.seq} · ${title}`,+ draftKey: `${check.result?.id ?? 'unexecuted'}:${check.id}`,+ evidence: check.evidence+ .filter((item) => isAnnotatable(item))+ .map((item) => ({ fileUrl: item.fileUrl!, id: item.id })),+ initialAnnotations: fromProposal?.annotations ?? undefined,+ initialComment: fromProposal?.comment ?? reviewComment,+ onConfirm: async ({ annotations, comment, fileIds }) => {+ const ok = await onReview({+ action: 'reject',+ annotations: annotations.length > 0 ? annotations : undefined,+ checkItemIds: [check.id],+ comment: comment || undefined,+ fileIds: fileIds.length > 0 ? fileIds : undefined,+ ...(fromProposal+ ? {+ proposal: {+ adjudication: 'confirmed' as const,+ edit: classifyProposalEdit(fromProposal, { annotations, comment }),+ predictionId: fromProposal.id,+ },+ }+ : {}),+ });+ if (ok) {+ setReviewComment('');+ if (shouldCollapseAfterReview(ok, expanded)) onToggle();+ }+ return ok;+ },+ });++ /**+ * Dismissing a proposal is NOT a review of the check — the check stays+ * pending and the reviewer still has to judge it. Only the model's opinion+ * is being answered, so this writes the outcome without touching+ * `user_decision`.+ */+ const handleAdjudicate = async (adjudication: 'not-an-issue' | 'misidentified') => {+ if (!check.prediction) return;+ await onDismissProposal?.({+ adjudication,+ checkItemId: check.id,+ predictionId: check.prediction.id,+ });+ };++ // Accepting settles the check — the row folds itself away once the write+ // lands, so the reviewer's eye moves on to what still needs judgment.+ const handleAccept = async (event: { stopPropagation: () => void }) => {+ event.stopPropagation();+ setAccepting(true);+ const comment = reviewComment.trim();+ const ok = await onReview({+ action: 'accept',+ checkItemIds: [check.id],+ comment: comment || undefined,+ });+ setAccepting(false);+ if (ok) setReviewComment('');+ if (shouldCollapseAfterReview(ok, expanded)) onToggle();+ };++ const handleReject = async (event: { stopPropagation: () => void }) => {+ event.stopPropagation();+ const comment = reviewComment.trim();+ if (!comment) return;+ setRejecting(true);+ const ok = await onReview({+ action: 'reject',+ checkItemIds: [check.id],+ comment,+ });+ setRejecting(false);+ if (ok) setReviewComment('');+ if (shouldCollapseAfterReview(ok, expanded)) onToggle();+ };++ const handleIgnore = async (event: { stopPropagation: () => void }) => {+ event.stopPropagation();+ setIgnoring(true);+ const ok = await onReview({ action: 'ignore', checkItemIds: [check.id] });+ setIgnoring(false);+ if (shouldCollapseAfterReview(ok, expanded)) onToggle();+ };++ // The user's standing verdict owns the head slot: a reject replaces the+ // verifier's mark outright (that check IS sent back, whatever the verifier+ // said); passed + user-accepted merges into the double-check receipt.+ const headIcon =+ reviewState === 'rejected'+ ? MessageSquareX+ : reviewState === 'ignored'+ ? Ban+ : check.state === 'passed' && reviewState === 'accepted'+ ? CheckCheck+ : meta.icon;+ const headColor =+ reviewState === 'rejected'+ ? cssVar.colorError+ : reviewState === 'ignored'+ ? cssVar.colorTextQuaternary+ : meta.color;++ const headIconNode = (+ <Icon+ color={headColor}+ icon={headIcon}+ size={16}+ style={{ alignSelf: 'flex-start', flex: 'none', marginBlockStart: 3 }}+ />+ );++ return (+ <Flexbox className={detailMode ? undefined : styles.row} data-check-row={check.id}>+ {!detailMode && (+ <Flexbox+ horizontal+ align={'flex-start'}+ aria-expanded={expanded}+ className={styles.rowHeader}+ data-expanded={expanded ? '' : undefined}+ gap={10}+ role={'button'}+ tabIndex={0}+ onClick={onToggle}+ onKeyDown={(event) => {+ if (+ event.target === event.currentTarget &&+ (event.key === 'Enter' || event.key === ' ')+ ) {+ event.preventDefault();+ onToggle();+ }+ }}+ >+ {reviewState === 'rejected' ? (+ <Tooltip title={t('acceptance.review.rejectedHint')}>{headIconNode}</Tooltip>+ ) : (+ headIconNode+ )}+ <Tooltip+ title={seqCopied ? t('acceptance.checks.copied') : t('acceptance.checks.copySeq')}+ >+ <span+ className={cx(styles.seqChip, styles.seqChipClickable)}+ onClick={(event) => {+ event.stopPropagation();+ void copyToClipboard(`C${check.seq}`);+ setSeqCopied(true);+ setTimeout(() => setSeqCopied(false), 1500);+ }}+ >+ C{check.seq}+ </span>+ </Tooltip>+ <Flexbox+ horizontal+ align={'center'}+ flex={1}+ gap={8}+ style={{ minWidth: 0 }}+ wrap={expanded ? 'wrap' : 'nowrap'}+ >+ <Text+ className={expanded || !desktop ? undefined : styles.titleEllipsis}+ style={{ fontSize: desktop ? 13 : 14, minWidth: 0 }}+ >+ {title}+ </Text>+ {!check.required && (+ <Tooltip title={t('acceptance.checks.notRequiredHint')}>+ <Tag size={'small'}>{t('acceptance.checks.notRequired')}</Tag>+ </Tooltip>+ )}+ {/* The verdict pair travels WITH the title, not adrift at the row's+ far right: the claim you judge and the judgement you give land in+ one glance, so a long checklist needs no eye round-trip across the+ row (and no mis-click onto a neighbour's buttons). */}+ {desktop && reviewable && reviewState === 'pending' && (+ <Flexbox+ horizontal+ align={'center'}+ className={cx(styles.rowActions, 'acceptance-row-actions')}+ gap={2}+ style={{+ // The accept spinner must stay visible after the pointer leaves.+ ...(accepting ? { opacity: 1 } : undefined),+ flex: 'none',+ }}+ >+ <ActionIcon+ disabled={reviewPending && !accepting}+ icon={Check}+ loading={accepting}+ size={'small'}+ title={t('acceptance.review.accept')}+ onClick={handleAccept}+ />+ <ActionIcon+ disabled={reviewPending && !ignoring}+ icon={Ban}+ loading={ignoring}+ size={'small'}+ title={t('acceptance.review.ignore')}+ onClick={handleIgnore}+ />+ <ActionIcon+ disabled={reviewPending}+ icon={MessageSquareX}+ size={'small'}+ title={t('acceptance.review.reject')}+ onClick={(event) => {+ event.stopPropagation();+ openReject();+ }}+ />+ </Flexbox>+ )}+ </Flexbox>+ <Flexbox+ horizontal+ align={'center'}+ className={cx(styles.rowMeta, 'acceptance-row-meta')}+ gap={6}+ >+ {/* An accept on a NON-passed verdict can't merge into the head icon+ (the failed/uncertain mark must stay visible) — mark it here. */}+ {reviewState === 'accepted' && check.state !== 'passed' && (+ <Tooltip+ title={t('acceptance.review.acceptedNote', {+ time: dayjs(check.userReview!.createdAt).format('MM-DD HH:mm'),+ })}+ >+ <Icon color={cssVar.colorTextQuaternary} icon={BadgeCheck} size={14} />+ </Tooltip>+ )}+ {visualization && <VisualizationDeltaBadge manifest={visualization} />}+ {EVIDENCE_BADGES.map(({ icon, key, labelKey }) =>+ counts[key] ? (+ <Tooltip key={key} title={t(labelKey, { count: counts[key] })}>+ <Flexbox+ horizontal+ align={'center'}+ gap={3}+ style={{ color: cssVar.colorTextTertiary, fontSize: 11 }}+ >+ <Icon icon={icon} size={13} />+ {counts[key] > 1 ? counts[key] : null}+ </Flexbox>+ </Tooltip>+ ) : null,+ )}+ {/* The iteration mark stays compact — [↻ N]; the words (verified N+ rounds · introduced in round X) live in its tooltip. Clicking+ jumps to the round the concern first appeared in. */}+ {onRound && check.revisions > 1 && (+ <Tooltip+ title={[+ check.titleChanged+ ? t('acceptance.checks.iterated', { count: check.revisions })+ : t('acceptance.checks.rerun', { count: check.revisions }),+ check.resultRound !== undefined &&+ check.resultRound !== null &&+ check.introducedAtRound !== check.resultRound+ ? t('acceptance.checks.introduced', { round: check.introducedAtRound })+ : null,+ ]+ .filter(Boolean)+ .join(' · ')}+ >+ <span+ className={cx(styles.chip, styles.chipClickable)}+ onClick={(event) => {+ event.stopPropagation();+ onRound(check.introducedAtRound);+ }}+ >+ <Icon icon={Repeat} size={10} /> {check.revisions}+ </span>+ </Tooltip>+ )}+ {onRound && check.resultRound !== undefined && check.resultRound !== null && (+ <Tooltip title={t('acceptance.checks.finalRoundHint')}>+ <span+ className={cx(styles.chip, styles.chipClickable)}+ onClick={(event) => {+ event.stopPropagation();+ onRound(check.resultRound!);+ }}+ >+ {t('acceptance.round', { round: check.resultRound })}+ </span>+ </Tooltip>+ )}+ </Flexbox>+ <Flexbox align={'center'} height={22}>+ <Icon+ color={cssVar.colorTextQuaternary}+ icon={ChevronRight}+ size={14}+ style={{+ transform: expanded ? 'rotate(90deg)' : 'none',+ transition: 'transform 0.2s',+ }}+ />+ </Flexbox>+ </Flexbox>+ )}++ {expanded && (+ <Flexbox+ gap={10}+ paddingBlock={detailMode ? 0 : '0 14px'}+ paddingInline={detailMode ? 0 : 16}+ >+ {/* The model's proposal leads the detail: it is a claim about this+ check that the reviewer is being asked to rule on, so it belongs+ above the verifier's narrative rather than buried under it.+ Suppressed once a verdict exists — see the bundle read, which+ already drops it; this guard covers the optimistic window. */}+ {check.prediction && reviewable && !activeReview && (+ <ProposalCard+ open={proposalOpen}+ pending={reviewPending}+ proposal={check.prediction}+ onAdjudicate={handleAdjudicate}+ onConfirm={() => openReject(check.prediction ?? undefined)}+ onToggle={setProposalOpen}+ />+ )}+ {/* The verifier's account of what it saw. Clamping it to two lines+ hid the middle of the argument behind an ellipsis with no way to+ open it — in a detail view there is nothing to preview. */}+ {check.result?.toulmin?.evidence && (+ <Text fontSize={12} style={{ whiteSpace: 'pre-wrap' }} type={'secondary'}>+ {check.result.toulmin.evidence}+ </Text>+ )}+ {/* An agent judge's argument is its run, not a paragraph — link the+ trace instead of trying to summarize it inline. `onOpenTrace`+ gates the render, not just the click: a caller that forgets to+ pass it would otherwise get a button whose optional call silently+ does nothing — exactly how this shipped dead in the portal. */}+ {check.planItem?.verifierType === 'agent' &&+ check.result?.verifierOperationId &&+ onOpenTrace && (+ <Flexbox horizontal>+ <Button+ icon={<Icon icon={Route} />}+ size={'small'}+ type={'text'}+ onClick={(event) => {+ event.stopPropagation();+ void onOpenTrace(check.result!.verifierOperationId!);+ }}+ >+ {t('acceptance.checks.viewTrace')}+ </Button>+ </Flexbox>+ )}+ {visualization && <VisualizationRenderer manifest={visualization} />}+ <EvidenceList+ evidence={check.evidence}+ overlays={proposalOverlays}+ onReviewEvidence={canReview ? (id) => openReject(undefined, id) : undefined}+ />++ {check.state === 'not_executed' && (+ <Flexbox+ horizontal+ align={'center'}+ gap={8}+ paddingBlock={8}+ paddingInline={10}+ style={{+ background: cssVar.colorFillQuaternary,+ borderRadius: cssVar.borderRadius,+ width: '100%',+ }}+ >+ <Icon+ color={cssVar.colorTextQuaternary}+ icon={CircleDashed}+ size={15}+ style={{ flex: 'none' }}+ />+ <Text fontSize={12} type={'secondary'}>+ {t('acceptance.focus.verifierDescription.notExecuted')}+ </Text>+ </Flexbox>+ )}++ {/* The verifier's record slot. An LLM judge's whole product IS its+ reasoning, so when it exists it IS the record shown here — in the+ same slot the empty-evidence note otherwise occupies (the two are+ the same statement: "here is what the verifier left behind"). An+ executed check with neither still SAYS so — a silent blank under+ the verdict reads as a rendering bug, not as a fact. */}+ {check.state !== 'not_executed' &&+ check.result &&+ (check.result.toulmin?.reasoning ? (+ <Flexbox+ gap={4}+ paddingBlock={8}+ paddingInline={10}+ style={{+ background: cssVar.colorFillQuaternary,+ borderRadius: cssVar.borderRadius,+ width: '100%',+ }}+ >+ <Text fontSize={11} type={'secondary'}>+ {t('acceptance.checks.judgeReason')}+ </Text>+ <Text fontSize={12} style={{ whiteSpace: 'pre-wrap' }}>+ {check.result.toulmin.reasoning}+ </Text>+ </Flexbox>+ ) : !hasRenderableEvidence(check.evidence.length, visualization) ? (+ <Flexbox+ paddingBlock={6}+ paddingInline={10}+ style={{+ background: cssVar.colorFillQuaternary,+ borderRadius: cssVar.borderRadius,+ width: '100%',+ }}+ >+ <Text fontSize={12} type={'secondary'}>+ {t('acceptance.evidence.empty')}+ </Text>+ </Flexbox>+ ) : null)}++ {/* The user's standing feedback hangs right under the evidence it+ judges. BOTH verdicts keep an undo path — a mis-click is the most+ likely way either happens, and a send-back the user didn't mean+ otherwise costs a whole repair round to walk back. */}+ {activeReview &&+ (activeReview.action === 'accept' ? (+ <Flexbox horizontal align={'center'} gap={8}>+ <AcceptedNote review={activeReview} />+ {reviewable && (+ <Button+ disabled={reviewPending}+ size={'small'}+ type={'text'}+ onClick={(event) => {+ event.stopPropagation();+ openReject();+ }}+ >+ {t('acceptance.review.revertToReject')}+ </Button>+ )}+ </Flexbox>+ ) : activeReview.action === 'ignore' ? (+ <Flexbox horizontal align={'center'} gap={8}>+ <IgnoredNote review={activeReview} />+ {reviewable && (+ <>+ <Button+ disabled={reviewPending}+ size={'small'}+ type={'text'}+ onClick={(event) => {+ event.stopPropagation();+ openReject();+ }}+ >+ {t('acceptance.review.revertToReject')}+ </Button>+ <Button+ disabled={reviewPending && !accepting}+ loading={accepting}+ size={'small'}+ type={'text'}+ onClick={handleAccept}+ >+ {t('acceptance.review.revertToAccept')}+ </Button>+ </>+ )}+ </Flexbox>+ ) : (+ <Flexbox gap={6}>+ <FeedbackCard evidenceById={evidenceById} review={activeReview} />+ {/* The mirror of the accept escape: take the send-back back.+ A fresh accept supersedes the reject, so the check leaves+ 待修复 and the feedback drops out of the next round's input. */}+ {reviewable && (+ <Flexbox horizontal>+ <Button+ disabled={reviewPending && !accepting}+ loading={accepting}+ size={'small'}+ type={'text'}+ onClick={handleAccept}+ >+ {t('acceptance.review.revertToAccept')}+ </Button>+ </Flexbox>+ )}+ </Flexbox>+ ))}++ {/* Confirm (plain filled) anchors the right edge; reject is the+ quiet text escape next to it. */}+ {reviewable &&+ !activeReview &&+ (detailMode ? (+ <Flexbox gap={10} style={{ marginBlockStart: 6 }}>+ {hasAnnotatableEvidence(check) && (+ <Button+ outdent+ icon={<Icon icon={Images} />}+ style={{ alignSelf: 'flex-start' }}+ type={'text'}+ onClick={(event) => {+ event.stopPropagation();+ openReject();+ }}+ >+ {t('acceptance.review.annotate')}+ </Button>+ )}+ <TextArea+ autoSize={{ maxRows: 8, minRows: 3 }}+ placeholder={t('acceptance.review.detailPlaceholder')}+ value={reviewComment}+ onChange={(event) => setReviewComment(event.target.value)}+ />+ <Flexbox horizontal gap={8}>+ <Button+ block+ disabled={reviewPending || !reviewComment.trim()}+ loading={rejecting}+ size={'large'}+ style={{ flex: 1 }}+ onClick={handleReject}+ >+ {t('acceptance.review.reject')}+ </Button>+ <Button+ block+ disabled={reviewPending && !accepting}+ icon={<Icon icon={Check} />}+ loading={accepting}+ size={'large'}+ style={{ flex: 1 }}+ type={'fill'}+ onClick={handleAccept}+ >+ {t('acceptance.review.accept')}+ </Button>+ </Flexbox>+ </Flexbox>+ ) : (+ <Flexbox horizontal gap={4} justify={'flex-end'}>+ <Button+ disabled={reviewPending && !ignoring}+ loading={ignoring}+ size={'small'}+ type={'text'}+ onClick={handleIgnore}+ >+ {t('acceptance.review.ignore')}+ </Button>+ <Button+ disabled={reviewPending}+ size={'small'}+ type={'text'}+ onClick={(event) => {+ event.stopPropagation();+ openReject();+ }}+ >+ {t('acceptance.review.reject')}+ </Button>+ <Button+ disabled={reviewPending && !accepting}+ icon={<Icon icon={Check} />}+ loading={accepting}+ size={'small'}+ type={'fill'}+ onClick={handleAccept}+ >+ {t('acceptance.review.accept')}+ </Button>+ </Flexbox>+ ))}++ {hasHistory && (+ <span+ className={styles.historyToggle}+ onClick={() => setHistoryOpen((open) => !open)}+ >+ <Icon+ icon={ChevronRight}+ size={12}+ style={{+ transform: historyOpen ? 'rotate(90deg)' : 'none',+ transition: 'transform 0.2s',+ }}+ />+ {t('acceptance.checks.iterationHistory', { count: check.revisions })}+ </span>+ )}+ {historyOpen && hasHistory && (+ <IterationTimeline+ check={check}+ evidenceById={evidenceById}+ historyReviews={historyReviews}+ onRound={onRound}+ />+ )}+ </Flexbox>+ )}+ </Flexbox>+ );+ },+);diff --git a/src/features/Acceptance/Viewer/Checks/checkState.ts b/src/features/Acceptance/Viewer/Checks/checkState.tsnew file mode 100644index 00000000000..7f03bd88388--- /dev/null+++ b/src/features/Acceptance/Viewer/Checks/checkState.ts@@ -0,0 +1,85 @@+import type { AcceptanceCheck, AcceptanceCheckState } from './types';++export const CHECK_GROUPING_THRESHOLD = 10;++/** Small checklists stay flat; grouping only earns its hierarchy once the list grows beyond 10. */+export const shouldGroupChecks = (checkCount: number) => checkCount > CHECK_GROUPING_THRESHOLD;++/** The user's standing verdict on a check — `pending` means "awaiting your confirmation". */+export type UserReviewState = 'accepted' | 'ignored' | 'pending' | 'rejected';++export const userReviewState = (check: AcceptanceCheck): UserReviewState => {+ const review = check.userReview;+ if (!review || review.stale) return 'pending';+ if (review.action === 'accept') return 'accepted';+ if (review.action === 'ignore') return 'ignored';+ return 'rejected';+};++/** Accepted and ignored checks are terminal — there is no remaining work to send back. */+export const isCheckWorkActionable = (check: AcceptanceCheck): boolean =>+ ['pending', 'rejected'].includes(userReviewState(check));++/** A successful review decision moves the reviewer forward by folding the finished row. */+export const shouldCollapseAfterReview = (succeeded: boolean, expanded: boolean): boolean =>+ succeeded && expanded;++/** Every reviewable check in the group is user-accepted — settled business. */+export const isGroupFullyAccepted = (checks: AcceptanceCheck[]): boolean => {+ const reviewable = checks.filter((check) => check.result);+ return (+ reviewable.length > 0 && reviewable.every((check) => userReviewState(check) === 'accepted')+ );+};++/** Unresolved-first ordering — exceptions are what the decision hinges on. */+export const SEVERITY: Record<AcceptanceCheckState, number> = {+ failed: 0,+ not_executed: 2,+ passed: 3,+ uncertain: 1,+};++export const isException = (check: AcceptanceCheck) =>+ check.state === 'failed' || check.state === 'uncertain';++export type CheckFilter = 'all' | 'pending' | 'needsFix' | 'accepted' | 'ignored';++export const checkFilterState = (check: AcceptanceCheck): Exclude<CheckFilter, 'all'> => {+ const review = userReviewState(check);+ if (review === 'accepted') return 'accepted';+ if (review === 'ignored') return 'ignored';+ if (review === 'rejected') return 'needsFix';+ return 'pending';+};++/** Keep the verifier's result separate from the user's acceptance workflow state. */+export const focusedCheckStates = (check: AcceptanceCheck) => ({+ review: checkFilterState(check),+ verifier: check.state,+ verifierLabel: check.state === 'not_executed' ? ('notExecuted' as const) : check.state,+});++interface CheckGroup {+ checks: AcceptanceCheck[];+ key: string;+ label: string;+}++/**+ * Group by the harness-authored business `category`. Product surfaces describe+ * where a check ran, not what user requirement it verifies, so they must never+ * become acceptance sections.+ */+export const groupChecks = (checks: AcceptanceCheck[], otherLabel: string): CheckGroup[] => {+ const groups = new Map<string, CheckGroup>();+ for (const check of checks) {+ const category = check.category?.trim();+ const key = category ? `category:${category}` : 'uncategorized';+ const label = category || otherLabel;+ const group = groups.get(key) ?? { checks: [], key, label };+ group.checks.push(check);+ groups.set(key, group);+ }+ return [...groups.values()];+};diff --git a/src/features/Acceptance/Viewer/Checks/checkStatus.ts b/src/features/Acceptance/Viewer/Checks/checkStatus.tsnew file mode 100644index 00000000000..05210354a80--- /dev/null+++ b/src/features/Acceptance/Viewer/Checks/checkStatus.ts@@ -0,0 +1,28 @@+import { cssVar } from 'antd-style';+import { Check, CheckCheck, CircleDashed, HelpCircle, MessageSquareX, XCircle } from 'lucide-react';++import { userReviewState } from './checkState';+import type { AcceptanceCheck, AcceptanceCheckState } from './types';++export const STATE_META: Record<AcceptanceCheckState, { color: string; icon: typeof Check }> = {+ failed: { color: cssVar.colorError, icon: XCircle },+ not_executed: { color: cssVar.colorTextQuaternary, icon: CircleDashed },+ passed: { color: cssVar.colorSuccess, icon: Check },+ 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;+};diff --git a/src/features/Acceptance/Viewer/checkWork.test.ts b/src/features/Acceptance/Viewer/Checks/checkWork.test.tssimilarity index 100%rename from src/features/Acceptance/Viewer/checkWork.test.tsrename to src/features/Acceptance/Viewer/Checks/checkWork.test.tsdiff --git a/src/features/Acceptance/Viewer/checkWork.ts b/src/features/Acceptance/Viewer/Checks/checkWork.tssimilarity index 100%rename from src/features/Acceptance/Viewer/checkWork.tsrename to src/features/Acceptance/Viewer/Checks/checkWork.tsdiff --git a/src/features/Acceptance/Viewer/expandState.test.ts b/src/features/Acceptance/Viewer/Checks/expandState.test.tssimilarity index 100%rename from src/features/Acceptance/Viewer/expandState.test.tsrename to src/features/Acceptance/Viewer/Checks/expandState.test.tsdiff --git a/src/features/Acceptance/Viewer/expandState.ts b/src/features/Acceptance/Viewer/Checks/expandState.tssimilarity index 100%rename from src/features/Acceptance/Viewer/expandState.tsrename to src/features/Acceptance/Viewer/Checks/expandState.tsdiff --git a/src/features/Acceptance/Viewer/Checks/styles.ts b/src/features/Acceptance/Viewer/Checks/styles.tsnew file mode 100644index 00000000000..92d45845877--- /dev/null+++ b/src/features/Acceptance/Viewer/Checks/styles.ts@@ -0,0 +1,170 @@+import { createStaticStyles, cssVar } from 'antd-style';++export const styles = createStaticStyles(({ css }) => ({+ chip: css`+ padding-inline: 6px;+ border-radius: 4px;++ font-size: 11px;+ line-height: 18px;+ color: ${cssVar.colorTextTertiary};+ white-space: nowrap;++ background: ${cssVar.colorFillTertiary};+ `,+ chipClickable: css`+ cursor: pointer;++ &:hover {+ color: ${cssVar.colorText};+ background: ${cssVar.colorFillSecondary};+ }+ `,+ emptyCard: css`+ padding-block: 48px;+ padding-inline: 16px;+ border: 1px solid ${cssVar.colorBorderSecondary};+ border-radius: ${cssVar.borderRadiusLG};++ background: ${cssVar.colorBgContainer};+ `,+ celebrateIcon: css`+ @keyframes acceptance-celebrate-pop {+ 0% {+ transform: scale(0.6);+ opacity: 0;+ }++ 60% {+ transform: scale(1.15);+ }++ 100% {+ transform: scale(1);+ opacity: 1;+ }+ }++ animation: acceptance-celebrate-pop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both;+ `,+ groupCard: css`+ background: ${cssVar.colorBgContainer};+ `,+ groupHeader: css`+ cursor: pointer;+ padding-block: 10px;+ padding-inline: 16px;+ background: ${cssVar.colorFillQuaternary};++ .acceptance-group-actions {+ opacity: 0;+ transition: opacity 0.2s;+ }++ &:hover {+ .acceptance-group-actions {+ opacity: 1;+ }+ }+ `,+ historyToggle: css`+ cursor: pointer;++ display: inline-flex;+ gap: 4px;+ align-items: center;++ width: fit-content;++ font-size: 12px;+ color: ${cssVar.colorTextTertiary};++ &:hover {+ color: ${cssVar.colorText};+ }+ `,+ row: css`+ border-block-start: 1px solid ${cssVar.colorBorderSecondary};++ /* The list opens flush with the content above it. Grouped lists are+ unaffected: their first child is the group header, so rows are never+ first. */+ &:first-child {+ border-block-start: none;+ }+ `,+ seqChip: css`+ flex: none;++ font-family: ${cssVar.fontFamilyCode};+ font-size: 11px;+ line-height: 22px;+ color: ${cssVar.colorTextSecondary};+ letter-spacing: 0.02em;+ `,+ seqChipClickable: css`+ cursor: copy;++ &:hover {+ color: ${cssVar.colorText};+ }+ `,+ rowActions: css`+ opacity: 0;+ transition: opacity 0.2s;+ `,+ rowMeta: css`+ transition: opacity 0.2s;++ @media (hover: hover) and (pointer: fine) {+ pointer-events: none;+ opacity: 0;+ }+ `,+ rowHeader: css`+ cursor: pointer;+ padding-block: 12px;+ padding-inline: 16px;++ &:hover,+ &:focus-within {+ .acceptance-row-actions {+ opacity: 1;+ }++ .acceptance-row-meta {+ pointer-events: auto;+ opacity: 1;+ }+ }++ /* The hover wash marks the collapsed row as a click target. An OPEN row is+ in reading mode — a gray band flashing between the white body and the+ white page just severs the title from its content, so no wash there. */+ &:not([data-expanded]):hover {+ background: ${cssVar.colorFillQuaternary};+ }+ `,+ stepDot: css`+ flex: none;++ width: 9px;+ height: 9px;+ margin-block-start: 5px;+ border: 2px solid;+ border-radius: 50%;++ background: ${cssVar.colorBgContainer};+ `,+ stepRail: css`+ flex: 1;+ width: 1px;+ margin-block-start: 6px;+ background: ${cssVar.colorBorderSecondary};+ `,+ titleEllipsis: css`+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;+ `,+}));diff --git a/src/features/Acceptance/Viewer/Checks/types.ts b/src/features/Acceptance/Viewer/Checks/types.tsnew file mode 100644index 00000000000..b7630acd5ba--- /dev/null+++ b/src/features/Acceptance/Viewer/Checks/types.ts@@ -0,0 +1,32 @@+import type {+ AcceptanceRejectIntent,+ AcceptanceReviewAnnotation,+ ReviewAdjudication,+ ReviewProposalEdit,+} from '@lobechat/types';++import type { AcceptanceBundle } from '@/services/verify';++export type AcceptanceCheck = AcceptanceBundle['checks'][number];+export type AcceptanceCheckState = AcceptanceCheck['state'];+export type AcceptanceEvidence = AcceptanceCheck['evidence'][number];+export type AcceptanceCheckReviewEntry = AcceptanceCheck['reviews'][number];++export interface CheckReviewInput {+ action: 'accept' | 'ignore' | 'reject';+ annotations?: AcceptanceReviewAnnotation[];+ checkItemIds: string[];+ comment?: string;+ fileIds?: string[];+ /** Present when this decision answered a model proposal. */+ proposal?: { adjudication: ReviewAdjudication; edit?: ReviewProposalEdit; predictionId: string };+ /** Which of the three jobs a reject is doing. */+ rejectIntent?: AcceptanceRejectIntent;+}++/** Answering a model proposal without ruling on the check. */+export interface ProposalDismissInput {+ adjudication: 'misidentified' | 'not-an-issue';+ checkItemId: string;+ predictionId: string;+}diff --git a/src/features/Acceptance/Viewer/AcceptanceOriginTopic.tsx b/src/features/Acceptance/Viewer/Conversation/AcceptanceOriginTopic.tsxsimilarity index 93%rename from src/features/Acceptance/Viewer/AcceptanceOriginTopic.tsxrename to src/features/Acceptance/Viewer/Conversation/AcceptanceOriginTopic.tsxindex 4acf75e2075..ac3e4224ab8 100644--- a/src/features/Acceptance/Viewer/AcceptanceOriginTopic.tsx+++ b/src/features/Acceptance/Viewer/Conversation/AcceptanceOriginTopic.tsx@@ -6,9 +6,9 @@ import { MessagesSquare } from 'lucide-react';import { useCallback } from 'react';import { useTranslation } from 'react-i18next';-import { useAcceptanceScope } from './AcceptanceScope';+import { useAcceptanceScope } from '../AcceptanceScope';+import { useAcceptanceBundle } from '../useAcceptanceBundle';import { useOriginConversation } from './originConversation';-import { useAcceptanceBundle } from './useAcceptanceBundle';const styles = createStaticStyles(({ css }) => ({chip: css`diff --git a/src/features/Acceptance/Viewer/TopicPanel.test.ts b/src/features/Acceptance/Viewer/Conversation/TopicPanel.test.tssimilarity index 100%rename from src/features/Acceptance/Viewer/TopicPanel.test.tsrename to src/features/Acceptance/Viewer/Conversation/TopicPanel.test.tsdiff --git a/src/features/Acceptance/Viewer/TopicPanel.tsx b/src/features/Acceptance/Viewer/Conversation/TopicPanel.tsxsimilarity index 100%rename from src/features/Acceptance/Viewer/TopicPanel.tsxrename to src/features/Acceptance/Viewer/Conversation/TopicPanel.tsxdiff --git a/src/features/Acceptance/Viewer/originConversation.test.ts b/src/features/Acceptance/Viewer/Conversation/originConversation.test.tssimilarity index 100%rename from src/features/Acceptance/Viewer/originConversation.test.tsrename to src/features/Acceptance/Viewer/Conversation/originConversation.test.tsdiff --git a/src/features/Acceptance/Viewer/originConversation.tsx b/src/features/Acceptance/Viewer/Conversation/originConversation.tsxsimilarity index 100%rename from src/features/Acceptance/Viewer/originConversation.tsxrename to src/features/Acceptance/Viewer/Conversation/originConversation.tsxdiff --git a/src/features/Acceptance/Viewer/AcceptanceResources.tsx b/src/features/Acceptance/Viewer/Evidence/AcceptanceResources.tsxsimilarity index 96%rename from src/features/Acceptance/Viewer/AcceptanceResources.tsxrename to src/features/Acceptance/Viewer/Evidence/AcceptanceResources.tsxindex cdb94be0ad0..2fb1b455f25 100644--- a/src/features/Acceptance/Viewer/AcceptanceResources.tsx+++ b/src/features/Acceptance/Viewer/Evidence/AcceptanceResources.tsx@@ -9,10 +9,10 @@ import { useTranslation } from 'react-i18next';import { useIsHydrated } from '@/hooks/useIsHydrated';-import { useAcceptanceScope } from './AcceptanceScope';-import { checksForTurn } from './turnChecks';-import { useAcceptanceBundle } from './useAcceptanceBundle';-import { useAcceptanceTurn } from './useAcceptanceTurn';+import { useAcceptanceScope } from '../AcceptanceScope';+import { checksForTurn } from '../turnChecks';+import { useAcceptanceBundle } from '../useAcceptanceBundle';+import { useAcceptanceTurn } from '../useAcceptanceTurn';const styles = createStaticStyles(({ css }) => ({/**diff --git a/src/features/Acceptance/Viewer/Annotation.tsx b/src/features/Acceptance/Viewer/Evidence/Annotation.tsxsimilarity index 100%rename from src/features/Acceptance/Viewer/Annotation.tsxrename to src/features/Acceptance/Viewer/Evidence/Annotation.tsxdiff --git a/src/features/Acceptance/Viewer/Evidence/EvidenceList.tsx b/src/features/Acceptance/Viewer/Evidence/EvidenceList.tsxnew file mode 100644index 00000000000..19cfb05c35f--- /dev/null+++ b/src/features/Acceptance/Viewer/Evidence/EvidenceList.tsx@@ -0,0 +1,298 @@+'use client';++import type { AcceptanceReviewAnnotation } from '@lobechat/types';+import { Flexbox, Image } from '@lobehub/ui';+import { useResponsive } from 'antd-style';+import { memo } from 'react';++import AudioPlayer from '@/features/AudioPlayer';++import {+ EvidenceComparisonCard,+ meaningfulEvidenceCaption,+ readEvidenceComparison,+} from '../../Report/EvidenceComparisonCard';+import {+ CollapsibleMarkdownEvidence,+ EvidenceFileCard,+ markdownTextEvidenceTypes,+} from '../../Report/MarkdownEvidence';+import type { AcceptanceEvidence } from '../Checks/types';+import { AnnotatedImage } from '../Evidence/Annotation';+import { ScreenshotTiles } from '../Evidence/ScreenshotTiles';+import { IMAGE_EVIDENCE, imageRatio, isVisual } from './evidence';+import { styles } from './styles';++/** Flat media for a comparison side — the card frames it, so no own border/radius. */+const comparisonContent = (item: AcceptanceEvidence) => {+ if (item.type === 'video')+ return <video controls src={item.fileUrl!} style={{ display: 'block', width: '100%' }} />;+ if (item.type === 'audio')+ return (+ <AudioPlayer+ fullWidth+ alt={item.description ?? item.fileName ?? item.type}+ downloadFileName={item.fileName ?? 'audio'}+ url={item.fileUrl!}+ />+ );+ if (item.type === 'screenshot' && item.fileUrl)+ return (+ <ScreenshotTiles+ flat+ alt={item.description ?? item.fileName ?? item.type}+ fileHeight={item.fileHeight}+ fileWidth={item.fileWidth}+ src={item.fileUrl}+ />+ );+ return (+ <Image+ preview+ alt={item.description ?? item.fileName ?? item.type}+ loading={'lazy'}+ src={item.fileUrl!}+ style={{ aspectRatio: imageRatio(item), borderRadius: 0, width: '100%' }}+ variant={'borderless'}+ />+ );+};++export const EvidenceList = memo<{+ evidence: AcceptanceEvidence[];+ onReviewEvidence?: (id: string) => void;+ /**+ * Regions to draw over an evidence image, keyed by evidence id. Used by the+ * AI proposal: rather than the card rendering its own copy of the screenshot+ * (which showed the same image twice in one row), the boxes land on the image+ * that is already here.+ */+ overlays?: Map<+ string,+ { comment?: string; label?: number; rect: AcceptanceReviewAnnotation['rect'] }[]+ >;+}>(({ evidence, overlays, onReviewEvidence }) => {+ const { md = true } = useResponsive();+ const sorted = [...evidence].sort((a, b) => (isVisual(b) ? 1 : 0) - (isVisual(a) ? 1 : 0));+ if (sorted.length === 0) return null;++ // Before/after pairs render as one fused comparison card (same component as+ // the verify report). Only complete pairs fuse; a lone half stays a plain+ // artifact, matching the ingest CLI's warning semantics.+ const groups = new Map<string, Partial<Record<'after' | 'before', AcceptanceEvidence>>>();+ for (const item of sorted) {+ if (!isVisual(item)) continue;+ const comparison = readEvidenceComparison(item.metadata);+ if (!comparison) continue;+ const group = groups.get(comparison.id) ?? {};+ group[comparison.role] = item;+ groups.set(comparison.id, group);+ }+ const pairedIds = new Set(+ [...groups.values()]+ .filter((group) => group.before && group.after)+ .flatMap((group) => [group.before!.id, group.after!.id]),+ );++ const comparisonSide = (item: AcceptanceEvidence) => ({+ caption:+ readEvidenceComparison(item.metadata)?.label ??+ meaningfulEvidenceCaption(item.description) ??+ undefined,+ content: comparisonContent(item),+ });++ const consumedScreenshotIds = new Set<string>();++ return (+ <Flexbox gap={12}>+ {sorted.map((item) => {+ if (consumedScreenshotIds.has(item.id)) return null;+ if (pairedIds.has(item.id) && (md || !onReviewEvidence)) {+ const comparison = readEvidenceComparison(item.metadata)!;+ // The pair renders once, anchored at its `before` half.+ if (comparison.role !== 'before') return null;+ const group = groups.get(comparison.id)!;+ return (+ <EvidenceComparisonCard+ after={comparisonSide(group.after!)}+ before={comparisonSide(group.before!)}+ key={comparison.id}+ layout={comparison.layout}+ />+ );+ }++ const description = meaningfulEvidenceCaption(item.description);+ const caption = description && <span className={styles.caption}>{description}</span>;+ if (item.fileUrl && item.type === 'video')+ return (+ <Flexbox gap={4} key={item.id} style={{ maxWidth: '100%', width: 'fit-content' }}>+ <video+ controls+ src={item.fileUrl}+ style={{ borderRadius: 8, maxHeight: 360, maxWidth: '100%', width: 'auto' }}+ />+ {caption}+ </Flexbox>+ );+ if (item.fileUrl && item.type === 'audio')+ return (+ <Flexbox gap={4} key={item.id} width={'100%'}>+ {/* The conversation's own waveform player — one audio dialect across+ the product, with the download the reviewer needs to keep the clip. */}+ <AudioPlayer+ fullWidth+ alt={item.description ?? item.fileName ?? item.type}+ downloadFileName={item.fileName ?? 'audio'}+ url={item.fileUrl}+ />+ {caption}+ </Flexbox>+ );+ if (!md && onReviewEvidence && item.fileUrl && IMAGE_EVIDENCE.has(item.type)) {+ return (+ <button+ key={item.id}+ type={'button'}+ style={{+ padding: 0,+ width: '100%',+ border: 0,+ background: 'none',+ textAlign: 'start',+ cursor: 'pointer',+ }}+ onClick={() => onReviewEvidence(item.id)}+ >+ <img+ alt={item.description ?? item.fileName ?? item.type}+ loading={'lazy'}+ src={item.fileUrl}+ style={{+ display: 'block',+ maxWidth: '100%',+ width: '100%',+ height: 180,+ objectFit: 'cover',+ objectPosition: 'top',+ borderRadius: 8,+ }}+ />+ {caption}+ </button>+ );+ }+ const overlay = overlays?.get(item.id);+ if (item.fileUrl && item.type === 'screenshot') {+ const run = [item];+ const start = sorted.indexOf(item);+ for (let index = start + 1; index < sorted.length; index++) {+ const next = sorted[index]!;+ if (pairedIds.has(next.id) || !next.fileUrl || next.type !== 'screenshot') break;+ run.push(next);+ consumedScreenshotIds.add(next.id);+ }+ return (+ <Flexbox+ horizontal+ align={'flex-start'}+ gap={12}+ key={item.id}+ style={{ maxWidth: '100%' }}+ wrap={'wrap'}+ >+ {run.map((shot) => {+ const shotCaption = meaningfulEvidenceCaption(shot.description);+ return (+ <ScreenshotTiles+ alt={shot.description ?? shot.fileName ?? shot.type}+ annotations={overlays?.get(shot.id)}+ fileHeight={shot.fileHeight}+ fileWidth={shot.fileWidth}+ key={shot.id}+ src={shot.fileUrl!}+ caption={+ shotCaption ? (+ <span className={styles.caption}>{shotCaption}</span>+ ) : undefined+ }+ />+ );+ })}+ </Flexbox>+ );+ }+ if (item.fileUrl && IMAGE_EVIDENCE.has(item.type)) {+ return (+ <Flexbox gap={4} key={item.id} style={{ maxWidth: '100%', width: 'fit-content' }}>+ {overlay?.length ? (+ <AnnotatedImage+ annotations={overlay}+ showComments={false}+ src={item.fileUrl}+ imageStyle={+ item.fileWidth && item.fileHeight+ ? { aspectRatio: imageRatio(item), maxWidth: '100%', width: item.fileWidth }+ : undefined+ }+ />+ ) : (+ <Flexbox+ className={styles.evidenceImage}+ style={+ item.fileWidth && item.fileHeight+ ? { aspectRatio: imageRatio(item), maxWidth: '100%', width: item.fileWidth }+ : undefined+ }+ >+ <Image+ alt={item.description ?? item.fileName ?? item.type}+ loading={'lazy'}+ src={item.fileUrl}+ variant={'borderless'}+ style={{+ borderRadius: 0,+ maxWidth: '100%',+ width: item.fileWidth && item.fileHeight ? '100%' : undefined,+ }}+ />+ </Flexbox>+ )}+ {caption}+ </Flexbox>+ );+ }+ if (item.content && markdownTextEvidenceTypes.has(item.type))+ return (+ // An authored alt/description becomes the fold row's title itself —+ // the supplement below the row duplicated it one line later.+ <CollapsibleMarkdownEvidence+ key={item.id}+ title={item.description?.trim() || item.fileName?.trim() || undefined}+ >+ {item.content}+ </CollapsibleMarkdownEvidence>+ );+ if (item.content)+ return (+ <Flexbox gap={4} key={item.id}>+ <div className={styles.evidenceText}>{item.content}</div>+ {caption}+ </Flexbox>+ );+ if (item.fileUrl && markdownTextEvidenceTypes.has(item.type))+ return (+ <EvidenceFileCard+ markdown+ description={item.description}+ fileName={item.fileName}+ key={item.id}+ url={item.fileUrl}+ />+ );+ return null;+ })}+ </Flexbox>+ );+});diff --git a/src/features/Acceptance/Viewer/MobileEvidenceReview.tsx b/src/features/Acceptance/Viewer/Evidence/MobileEvidenceReview.tsxsimilarity index 100%rename from src/features/Acceptance/Viewer/MobileEvidenceReview.tsxrename to src/features/Acceptance/Viewer/Evidence/MobileEvidenceReview.tsxdiff --git a/src/features/Acceptance/Viewer/ScreenshotTiles.tsx b/src/features/Acceptance/Viewer/Evidence/ScreenshotTiles.tsxsimilarity index 100%rename from src/features/Acceptance/Viewer/ScreenshotTiles.tsxrename to src/features/Acceptance/Viewer/Evidence/ScreenshotTiles.tsxdiff --git a/src/features/Acceptance/Viewer/attachments.test.tsx b/src/features/Acceptance/Viewer/Evidence/attachments.test.tsxsimilarity index 100%rename from src/features/Acceptance/Viewer/attachments.test.tsxrename to src/features/Acceptance/Viewer/Evidence/attachments.test.tsxdiff --git a/src/features/Acceptance/Viewer/attachments.tsx b/src/features/Acceptance/Viewer/Evidence/attachments.tsxsimilarity index 100%rename from src/features/Acceptance/Viewer/attachments.tsxrename to src/features/Acceptance/Viewer/Evidence/attachments.tsxdiff --git a/src/features/Acceptance/Viewer/Evidence/evidence.ts b/src/features/Acceptance/Viewer/Evidence/evidence.tsnew file mode 100644index 00000000000..6e8d88f5677--- /dev/null+++ b/src/features/Acceptance/Viewer/Evidence/evidence.ts@@ -0,0 +1,33 @@+import type { AcceptanceCheck, AcceptanceEvidence } from '../Checks/types';++export const IMAGE_EVIDENCE = new Set(['gif', 'screenshot']);+/** Rendered by a `<video>` / `<audio>` element rather than an image box. */+const PLAYER_EVIDENCE = new Set(['audio', 'video']);+/** Everything that shows or plays inline — the deliverable itself, not a log about it. */+const MEDIA_EVIDENCE = new Set([...IMAGE_EVIDENCE, ...PLAYER_EVIDENCE]);+const ANNOTATABLE_EVIDENCE = IMAGE_EVIDENCE;++export const isVisual = (item: AcceptanceEvidence) =>+ Boolean(item.fileUrl) && MEDIA_EVIDENCE.has(item.type);++export const hasVisualEvidence = (check: AcceptanceCheck) => check.evidence.some(isVisual);++export const isAnnotatable = (item: AcceptanceEvidence) =>+ Boolean(item.fileUrl) && ANNOTATABLE_EVIDENCE.has(item.type);++export const hasAnnotatableEvidence = (check: AcceptanceCheck) =>+ check.evidence.some(isAnnotatable);++export const evidenceCounts = (evidence: AcceptanceEvidence[]) => {+ const counts = { audio: 0, file: 0, image: 0, video: 0 };+ for (const item of evidence) {+ if (item.type === 'video' && item.fileUrl) counts.video += 1;+ else if (item.type === 'audio' && item.fileUrl) counts.audio += 1;+ else if (isVisual(item)) counts.image += 1;+ else counts.file += 1;+ }+ return counts;+};++export const imageRatio = (item: AcceptanceEvidence): string | undefined =>+ item.fileWidth && item.fileHeight ? `${item.fileWidth} / ${item.fileHeight}` : undefined;diff --git a/src/features/Acceptance/Viewer/screenshotSlices.test.ts b/src/features/Acceptance/Viewer/Evidence/screenshotSlices.test.tssimilarity index 100%rename from src/features/Acceptance/Viewer/screenshotSlices.test.tsrename to src/features/Acceptance/Viewer/Evidence/screenshotSlices.test.tsdiff --git a/src/features/Acceptance/Viewer/screenshotSlices.ts b/src/features/Acceptance/Viewer/Evidence/screenshotSlices.tssimilarity index 100%rename from src/features/Acceptance/Viewer/screenshotSlices.tsrename to src/features/Acceptance/Viewer/Evidence/screenshotSlices.tsdiff --git a/src/features/Acceptance/Viewer/Evidence/styles.ts b/src/features/Acceptance/Viewer/Evidence/styles.tsnew file mode 100644index 00000000000..f59d88d46b8--- /dev/null+++ b/src/features/Acceptance/Viewer/Evidence/styles.ts@@ -0,0 +1,31 @@+import { createStaticStyles, cssVar } from 'antd-style';++export const styles = createStaticStyles(({ css }) => ({+ caption: css`+ align-self: center;+ font-size: 12px;+ color: ${cssVar.colorTextTertiary};+ `,+ evidenceImage: css`+ overflow: hidden;++ width: fit-content;+ max-width: 100%;+ border: 1px solid ${cssVar.colorBorderSecondary};+ border-radius: ${cssVar.borderRadiusLG};+ `,+ evidenceText: css`+ overflow: auto;++ max-height: 200px;+ padding-block: 8px;+ padding-inline: 12px;+ border-radius: ${cssVar.borderRadius};++ font-family: ${cssVar.fontFamilyCode};+ font-size: 12px;+ white-space: pre-wrap;++ background: ${cssVar.colorFillQuaternary};+ `,+}));diff --git a/src/features/Acceptance/Viewer/useAnnotationGesture.test.ts b/src/features/Acceptance/Viewer/Evidence/useAnnotationGesture.test.tssimilarity index 100%rename from src/features/Acceptance/Viewer/useAnnotationGesture.test.tsrename to src/features/Acceptance/Viewer/Evidence/useAnnotationGesture.test.tsdiff --git a/src/features/Acceptance/Viewer/useAnnotationGesture.ts b/src/features/Acceptance/Viewer/Evidence/useAnnotationGesture.tssimilarity index 100%rename from src/features/Acceptance/Viewer/useAnnotationGesture.tsrename to src/features/Acceptance/Viewer/Evidence/useAnnotationGesture.tsdiff --git a/src/features/Acceptance/Viewer/AcceptanceFlow.tsx b/src/features/Acceptance/Viewer/Flow/AcceptanceFlow.tsxsimilarity index 81%rename from src/features/Acceptance/Viewer/AcceptanceFlow.tsxrename to src/features/Acceptance/Viewer/Flow/AcceptanceFlow.tsxindex 8c134daa9e0..394c794f92e 100644--- a/src/features/Acceptance/Viewer/AcceptanceFlow.tsx+++ b/src/features/Acceptance/Viewer/Flow/AcceptanceFlow.tsx@@ -5,20 +5,23 @@ import '@xyflow/react/dist/style.css';import { Empty, Flexbox } from '@lobehub/ui';import { Button, Select, Text } from '@lobehub/ui/base-ui';import { MarkerType, ReactFlowProvider } from '@xyflow/react';-import { createStaticStyles, cssVar } from 'antd-style';+import { createStaticStyles, cssVar, useResponsive } from 'antd-style';import { use, useState } from 'react';import { createPortal } from 'react-dom';import { useTranslation } from 'react-i18next';-import { useAcceptanceScope } from './AcceptanceScope';+import { useAcceptanceScope } from '../AcceptanceScope';+import { acceptanceContentLayout } from '../layout';+import { AcceptancePlanReview } from '../Plan/AcceptancePlanReview';+import { useAcceptanceBundle } from '../useAcceptanceBundle';import { FlowCanvas } from './FlowCanvas';import { buildFlowGraph } from './flowGraph';import { FlowGroup } from './FlowGroup';import { getFlowRoundViews } from './flowNavigation';import { FlowNode } from './FlowNode';-import { FlowPanelHostContext, FlowResults } from './FlowResults';-import { acceptanceContentLayout } from './layout';-import { useAcceptanceBundle } from './useAcceptanceBundle';+import { FlowOutline } from './FlowOutline';+import { FlowPanelHostContext } from './FlowPanelHost';+import { FlowResults } from './FlowResults';const styles = createStaticStyles(({ css }) => ({toolbar: css`@@ -32,6 +35,9 @@ const nodeTypes = { state: FlowNode, flowGroup: FlowGroup };export function AcceptanceFlow() {const { t } = useTranslation('verify');const panelHost = use(FlowPanelHostContext);+ const { md = true } = useResponsive();+ const [display, setDisplay] = useState<'graph' | 'outline'>();+ const showOutline = (display ?? (md ? 'graph' : 'outline')) === 'outline';const { acceptanceId } = useAcceptanceScope();const { data, mutate } = useAcceptanceBundle(acceptanceId);const [roundKey, setRoundKey] = useState<string>();@@ -122,19 +128,17 @@ export function AcceptanceFlow() {))}</Flexbox><Flexbox horizontal align="center" gap={8}>- <Button size="small" type="text" onClick={() => setCollapsed(new Set())}>- {t('flow.expandAll')}- </Button>+ <AcceptancePlanReview runId={candidates[0]?.run?.verifyRunId} /><Buttonsize="small"type="text"- onClick={() => setCollapsed(new Set(graph.groups.keys()))}+ onClick={() => setDisplay(showOutline ? 'graph' : 'outline')}>- {t('flow.collapseAll')}+ {t(showOutline ? 'flow.graphView' : 'flow.outlineView')}</Button><Selectsize="small"- style={{ minWidth: 120 }}+ style={{ width: 120, flexShrink: 0 }}value={activeKey}options={keys.map((key) => ({value: key,@@ -151,15 +155,19 @@ export function AcceptanceFlow() {/></Flexbox></Flexbox>- <ReactFlowProvider key={activeKey}>- <FlowCanvas- edges={graphEdges}- nodeTypes={nodeTypes}- nodes={graph.nodes}- viewKey={focus ?? activeKey}- onSelect={setSelected}- />- </ReactFlowProvider>+ {showOutline ? (+ <FlowOutline edges={graphEdges} nodes={graph.nodes} onSelect={setSelected} />+ ) : (+ <ReactFlowProvider key={activeKey}>+ <FlowCanvas+ edges={graphEdges}+ nodeTypes={nodeTypes}+ nodes={graph.nodes}+ viewKey={focus ?? activeKey}+ onSelect={setSelected}+ />+ </ReactFlowProvider>+ )}{checkSelection &&panelHost &&createPortal(diff --git a/src/features/Acceptance/Viewer/FlowCanvas.tsx b/src/features/Acceptance/Viewer/Flow/FlowCanvas.tsxsimilarity index 100%rename from src/features/Acceptance/Viewer/FlowCanvas.tsxrename to src/features/Acceptance/Viewer/Flow/FlowCanvas.tsxdiff --git a/src/features/Acceptance/Viewer/FlowEdge.tsx b/src/features/Acceptance/Viewer/Flow/FlowEdge.tsxsimilarity index 100%rename from src/features/Acceptance/Viewer/FlowEdge.tsxrename to src/features/Acceptance/Viewer/Flow/FlowEdge.tsxdiff --git a/src/features/Acceptance/Viewer/FlowGroup.tsx b/src/features/Acceptance/Viewer/Flow/FlowGroup.tsxsimilarity index 93%rename from src/features/Acceptance/Viewer/FlowGroup.tsxrename to src/features/Acceptance/Viewer/Flow/FlowGroup.tsxindex 69626517a85..6934497dfbf 100644--- a/src/features/Acceptance/Viewer/FlowGroup.tsx+++ b/src/features/Acceptance/Viewer/Flow/FlowGroup.tsx@@ -30,10 +30,9 @@ const styles = createStaticStyles(({ css }) => ({background: ${cssVar.colorBgContainer};`,header: css`- height: 46px;+ height: 36px;padding-inline: 16px;- border-block-end: 1px solid ${cssVar.colorBorderSecondary};- background: ${cssVar.colorFillQuaternary};+ background: transparent;`,handle: css`width: 1px;@@ -82,11 +81,11 @@ export function FlowGroup({ data }: { data: FlowGraphData }) {</Button>)}<Icon icon={statusIcon} size={18} style={{ color: flowStateColor(data.state) }} />- <Text ellipsis strong style={{ flex: 1 }}>+ <Text ellipsis fontSize={13} style={{ flex: 1 }}>{data.title}</Text><Text fontSize={12} type="secondary">- {t('flow.groupProgress', { passed: data.passed, total: data.total })}+ {`${data.passed}/${data.total}`}</Text>{Boolean(data.reviewed) && (<Text fontSize={12} type="secondary">diff --git a/src/features/Acceptance/Viewer/FlowNode.tsx b/src/features/Acceptance/Viewer/Flow/FlowNode.tsxsimilarity index 100%rename from src/features/Acceptance/Viewer/FlowNode.tsxrename to src/features/Acceptance/Viewer/Flow/FlowNode.tsxdiff --git a/src/features/Acceptance/Viewer/Flow/FlowOutline.tsx b/src/features/Acceptance/Viewer/Flow/FlowOutline.tsxnew file mode 100644index 00000000000..1af0d91d293--- /dev/null+++ b/src/features/Acceptance/Viewer/Flow/FlowOutline.tsx@@ -0,0 +1,139 @@+import { Flexbox, Icon } from '@lobehub/ui';+import { Button, Text } from '@lobehub/ui/base-ui';+import type { Edge, Node } from '@xyflow/react';+import { createStaticStyles, cssVar } from 'antd-style';+import {+ ArrowRight,+ CheckCircle2,+ ChevronDown,+ ChevronRight,+ CircleDashed,+ CircleDot,+ CircleHelp,+ CirclePause,+ CircleX,+} from 'lucide-react';+import { useTranslation } from 'react-i18next';++import type { FlowGraphData } from './flowGraph';+import { flowStateColor } from './FlowNode';++const styles = createStaticStyles(({ css }) => ({+ item: css`+ width: 100%;+ height: auto;+ min-height: 44px;+ padding-block: 10px;+ padding-inline: 12px;++ text-align: start;+ white-space: normal;+ `,+ branch: css`+ justify-content: flex-start;++ width: 100%;+ height: auto;+ min-height: 44px;+ padding-block: 8px;+ padding-inline: 12px;++ color: ${cssVar.colorTextSecondary};+ text-align: start;+ white-space: normal;+ `,+ group: css`+ padding-inline-start: 8px;+ border-inline-start: 1px solid ${cssVar.colorBorderSecondary};+ `,+}));++/** A readable traversal of the same graph, including every branch and its target. */+export function FlowOutline({+ nodes,+ edges,+ onSelect,+}: {+ nodes: Node<FlowGraphData>[];+ edges: Edge[];+ onSelect: (id: string) => void;+}) {+ const { t } = useTranslation('verify');+ const renderNode = (node: Node<FlowGraphData>) => {+ const { data } = node;+ const group = node.type === 'flowGroup';+ const glyph =+ data.state === 'passed'+ ? CheckCircle2+ : data.state === 'failed'+ ? CircleX+ : data.state === 'blocked'+ ? CirclePause+ : data.state === 'uncertain'+ ? CircleHelp+ : data.state === 'partial'+ ? CircleDot+ : CircleDashed;+ return (+ <Flexbox gap={4} key={node.id}>+ <Button+ aria-expanded={group ? !data.collapsed : undefined}+ className={styles.item}+ type={data.selected ? 'default' : 'text'}+ onClick={() => (group ? data.onToggle?.() : onSelect(node.id))}+ >+ <Flexbox horizontal align="center" gap={10} width="100%">+ {group && <Icon icon={data.collapsed ? ChevronRight : ChevronDown} size={14} />}+ <Icon+ aria-label={t(`flow.state.${data.state ?? 'pending'}`)}+ icon={glyph}+ size={18}+ style={{ color: flowStateColor(data.state), flex: 'none' }}+ />+ <Flexbox flex={1} gap={4} style={{ minWidth: 0 }}>+ <Text strong={group} style={{ overflowWrap: 'anywhere' }}>+ {data.title}+ </Text>+ {!group && (+ <Text fontSize={13} style={{ overflowWrap: 'anywhere' }} type="secondary">+ {String(data.expected ?? '')}+ </Text>+ )}+ </Flexbox>+ {group ? (+ <Text fontSize={12} type="secondary">+ {data.passed}/{data.total}+ </Text>+ ) : (+ <Icon icon={ChevronRight} size={16} />+ )}+ </Flexbox>+ </Button>+ {group && !data.collapsed && (+ <Flexbox className={styles.group} gap={12}>+ {nodes.filter((child) => child.parentId === node.id).map(renderNode)}+ </Flexbox>+ )}+ {edges+ .filter((edge) => edge.source === node.id)+ .map((edge) => (+ <Button+ className={styles.branch}+ key={edge.id}+ type="text"+ onClick={() => onSelect(edge.id)}+ >+ <Flexbox horizontal align="center" gap={8}>+ <Icon icon={ArrowRight} size={14} style={{ flex: 'none' }} />+ <span>+ {String(edge.label ?? '')} →{' '}+ {nodes.find((target) => target.id === edge.target)?.data.title}+ </span>+ </Flexbox>+ </Button>+ ))}+ </Flexbox>+ );+ };+ return <Flexbox gap={24}>{nodes.filter((node) => !node.parentId).map(renderNode)}</Flexbox>;+}diff --git a/src/features/Acceptance/Viewer/Flow/FlowPanelHost.ts b/src/features/Acceptance/Viewer/Flow/FlowPanelHost.tsnew file mode 100644index 00000000000..0a5a8dece2c--- /dev/null+++ b/src/features/Acceptance/Viewer/Flow/FlowPanelHost.ts@@ -0,0 +1,3 @@+import { createContext } from 'react';++export const FlowPanelHostContext = createContext<HTMLDivElement | null>(null);diff --git a/src/features/Acceptance/Viewer/FlowResults.tsx b/src/features/Acceptance/Viewer/Flow/FlowResults.tsxsimilarity index 97%rename from src/features/Acceptance/Viewer/FlowResults.tsxrename to src/features/Acceptance/Viewer/Flow/FlowResults.tsxindex caf1209857b..7d73313a800 100644--- a/src/features/Acceptance/Viewer/FlowResults.tsx+++ b/src/features/Acceptance/Viewer/Flow/FlowResults.tsx@@ -4,18 +4,16 @@ import { Flexbox, Icon, TextArea } from '@lobehub/ui';import { ActionIcon, Button, Select, Text, toast } from '@lobehub/ui/base-ui';import { createStaticStyles, cssVar } from 'antd-style';import { ClipboardCheck, History, X } from 'lucide-react';-import { createContext, useState } from 'react';+import { useState } from 'react';import { useTranslation } from 'react-i18next';import { type AcceptanceBundle, verifyService } from '@/services/verify';-import { AttachmentThumbs } from './attachments';-import { EvidenceList } from './CheckList';-import { openCheckRejectModal } from './CheckRejectModal';+import { AttachmentThumbs } from '../Evidence/attachments';+import { EvidenceList } from '../Evidence/EvidenceList';+import { openCheckRejectModal } from '../Review/CheckRejectModal';import { flowStateColor } from './FlowNode';-export const FlowPanelHostContext = createContext<HTMLDivElement | null>(null);-type FlowVersion = AcceptanceBundle['flows'][number]['versions'][number];type FlowAttempt = FlowVersion['runs'][number]['attempts'][number];diff --git a/src/features/Acceptance/Viewer/FlowVersionDiff.tsx b/src/features/Acceptance/Viewer/Flow/FlowVersionDiff.tsxsimilarity index 100%rename from src/features/Acceptance/Viewer/FlowVersionDiff.tsxrename to src/features/Acceptance/Viewer/Flow/FlowVersionDiff.tsxdiff --git a/src/features/Acceptance/Viewer/flowDiff.test.ts b/src/features/Acceptance/Viewer/Flow/flowDiff.test.tssimilarity index 100%rename from src/features/Acceptance/Viewer/flowDiff.test.tsrename to src/features/Acceptance/Viewer/Flow/flowDiff.test.tsdiff --git a/src/features/Acceptance/Viewer/flowDiff.ts b/src/features/Acceptance/Viewer/Flow/flowDiff.tssimilarity index 100%rename from src/features/Acceptance/Viewer/flowDiff.tsrename to src/features/Acceptance/Viewer/Flow/flowDiff.tsdiff --git a/src/features/Acceptance/Viewer/flowGraph.test.ts b/src/features/Acceptance/Viewer/Flow/flowGraph.test.tssimilarity index 100%rename from src/features/Acceptance/Viewer/flowGraph.test.tsrename to src/features/Acceptance/Viewer/Flow/flowGraph.test.tsdiff --git a/src/features/Acceptance/Viewer/flowGraph.ts b/src/features/Acceptance/Viewer/Flow/flowGraph.tssimilarity index 100%rename from src/features/Acceptance/Viewer/flowGraph.tsrename to src/features/Acceptance/Viewer/Flow/flowGraph.tsdiff --git a/src/features/Acceptance/Viewer/flowNavigation.test.ts b/src/features/Acceptance/Viewer/Flow/flowNavigation.test.tssimilarity index 77%rename from src/features/Acceptance/Viewer/flowNavigation.test.tsrename to src/features/Acceptance/Viewer/Flow/flowNavigation.test.tsindex f3109046812..ece4c5141cb 100644--- a/src/features/Acceptance/Viewer/flowNavigation.test.ts+++ b/src/features/Acceptance/Viewer/Flow/flowNavigation.test.ts@@ -70,3 +70,17 @@ it('keeps each business flow selectable when they share a verification round', (for (const view of views)expect(views.find((candidate) => candidate.id === view.id)?.version).toBe(view.version);});++it('opens a proposed flow first while preserving an explicit user tab choice', () => {+ expect(resolveAcceptanceTab(undefined, 3, true)).toBe('flow');+ expect(resolveAcceptanceTab('checks', 3, true)).toBe('checks');+ expect(resolveAcceptanceTab(undefined, 3, false)).toBe('checks');+ expect(resolveAcceptanceTab(undefined, 0, true)).toBe('checks');+});++it('falls back from draft and selected flows when the surface does not offer flows', () => {+ expect(resolveAcceptanceTab(undefined, 3, true, false)).toBe('checks');+ expect(resolveAcceptanceTab('flow', 3, false, false)).toBe('checks');+ expect(resolveAcceptanceTab('resources', 3, true, false)).toBe('resources');+ expect(resolveAcceptanceTab('flow', 3, false, true)).toBe('flow');+});diff --git a/src/features/Acceptance/Viewer/flowNavigation.ts b/src/features/Acceptance/Viewer/Flow/flowNavigation.tssimilarity index 77%rename from src/features/Acceptance/Viewer/flowNavigation.tsrename to src/features/Acceptance/Viewer/Flow/flowNavigation.tsindex 41e8dc1cb22..c00fe6d6f0e 100644--- a/src/features/Acceptance/Viewer/flowNavigation.ts+++ b/src/features/Acceptance/Viewer/Flow/flowNavigation.ts@@ -1,6 +1,6 @@import type { verifyService } from '@/services/verify';-import type { AcceptanceTabKey } from './AcceptanceTabs';+import type { AcceptanceTabKey } from '../Header/AcceptanceTabs';type Bundle = Awaited<ReturnType<typeof verifyService.getAcceptanceBundle>>;export type FlowVersion = Bundle['flows'][number]['versions'][number];@@ -11,8 +11,15 @@ export const getFlowNodeCount = (flows: Bundle['flows'] = []) =>0,);-export const resolveAcceptanceTab = (tab: AcceptanceTabKey, nodeCount: number) =>- tab === 'flow' && nodeCount === 0 ? 'checks' : tab;+export const resolveAcceptanceTab = (+ tab: AcceptanceTabKey | undefined,+ nodeCount: number,+ reviewingPlan = false,+ flowAvailable = true,+): AcceptanceTabKey => {+ const selected = tab ?? (reviewingPlan ? 'flow' : 'checks');+ return selected === 'flow' && (!flowAvailable || nodeCount === 0) ? 'checks' : selected;+};/** Round numbers come from the same acceptance ledger as the checklist. */export const getFlowRoundViews = (flows: Bundle['flows'] = [], rounds: Bundle['rounds'] = []) => {diff --git a/src/features/Acceptance/Viewer/flowNodeState.test.ts b/src/features/Acceptance/Viewer/Flow/flowNodeState.test.tssimilarity index 100%rename from src/features/Acceptance/Viewer/flowNodeState.test.tsrename to src/features/Acceptance/Viewer/Flow/flowNodeState.test.tsdiff --git a/src/features/Acceptance/Viewer/flowNodeState.ts b/src/features/Acceptance/Viewer/Flow/flowNodeState.tssimilarity index 100%rename from src/features/Acceptance/Viewer/flowNodeState.tsrename to src/features/Acceptance/Viewer/Flow/flowNodeState.tsdiff --git a/src/features/Acceptance/Viewer/AcceptanceEnterFocus.tsx b/src/features/Acceptance/Viewer/Focus/AcceptanceEnterFocus.tsxsimilarity index 80%rename from src/features/Acceptance/Viewer/AcceptanceEnterFocus.tsxrename to src/features/Acceptance/Viewer/Focus/AcceptanceEnterFocus.tsxindex b773742a6de..801031d256c 100644--- a/src/features/Acceptance/Viewer/AcceptanceEnterFocus.tsx+++ b/src/features/Acceptance/Viewer/Focus/AcceptanceEnterFocus.tsx@@ -6,11 +6,11 @@ import { ChevronRight } from 'lucide-react';import { useTranslation } from 'react-i18next';import { useNavigate, useSearchParams } from 'react-router';-import { useAcceptanceScope } from './AcceptanceScope';-import { acceptanceCheckPath } from './routes';-import { checksForTurn } from './turnChecks';-import { useAcceptanceBundle } from './useAcceptanceBundle';-import { readAcceptanceTurn } from './useAcceptanceTurn';+import { useAcceptanceScope } from '../AcceptanceScope';+import { acceptanceCheckPath } from '../routes';+import { checksForTurn } from '../turnChecks';+import { useAcceptanceBundle } from '../useAcceptanceBundle';+import { readAcceptanceTurn } from '../useAcceptanceTurn';const AcceptanceEnterFocus = () => {const { t } = useTranslation('verify');diff --git a/src/features/Acceptance/Viewer/AcceptanceFocusReview.tsx b/src/features/Acceptance/Viewer/Focus/AcceptanceFocusReview.tsxsimilarity index 98%rename from src/features/Acceptance/Viewer/AcceptanceFocusReview.tsxrename to src/features/Acceptance/Viewer/Focus/AcceptanceFocusReview.tsxindex b94b61c2a8c..475618322f1 100644--- a/src/features/Acceptance/Viewer/AcceptanceFocusReview.tsx+++ b/src/features/Acceptance/Viewer/Focus/AcceptanceFocusReview.tsx@@ -24,17 +24,15 @@ import { useTranslation } from 'react-i18next';import NavItem from '@/features/NavPanel/components/NavItem';-import AcceptanceStatusPill from './AcceptanceStatusPill';+import { checkFilterState, focusedCheckStates, isCheckWorkActionable } from '../Checks/checkState';import {type AcceptanceCheck,- checkFilterState,type CheckReviewInput,- FocusedCheckDetails,- focusedCheckStates,- isCheckWorkActionable,type ProposalDismissInput,-} from './CheckList';-import { acceptanceFocusedLayout, acceptanceScrollLayout } from './layout';+} from '../Checks/types';+import AcceptanceStatusPill from '../Header/AcceptanceStatusPill';+import { acceptanceFocusedLayout, acceptanceScrollLayout } from '../layout';+import { FocusedCheckDetails } from './FocusedCheckDetails';const styles = createStaticStyles(({ css }) => ({mobileNavigation: css`diff --git a/src/features/Acceptance/Viewer/AcceptanceFocusWorkspace.tsx b/src/features/Acceptance/Viewer/Focus/AcceptanceFocusWorkspace.tsxsimilarity index 90%rename from src/features/Acceptance/Viewer/AcceptanceFocusWorkspace.tsxrename to src/features/Acceptance/Viewer/Focus/AcceptanceFocusWorkspace.tsxindex 943f0aea36f..7814736e63b 100644--- a/src/features/Acceptance/Viewer/AcceptanceFocusWorkspace.tsx+++ b/src/features/Acceptance/Viewer/Focus/AcceptanceFocusWorkspace.tsx@@ -9,15 +9,15 @@ import { mutate as globalMutate } from '@/libs/swr';import { isAcceptanceListKey } from '@/libs/swr/keys';import { verifyService } from '@/services/verify';+import { useAcceptanceScope } from '../AcceptanceScope';+import { openAddCheckModal } from '../Checks/AddCheckModal';+import { copyCheckRepairPrompt } from '../Checks/checkWork';+import { acceptanceCheckPath, acceptanceOverviewPath } from '../routes';+import { checksForTurn } from '../turnChecks';+import { useAcceptanceBundle } from '../useAcceptanceBundle';+import { useAcceptanceTurn } from '../useAcceptanceTurn';+import { canReviewAcceptance } from '../visibility';import AcceptanceFocusReview from './AcceptanceFocusReview';-import { useAcceptanceScope } from './AcceptanceScope';-import { openAddCheckModal } from './AddCheckModal';-import { copyCheckRepairPrompt } from './checkWork';-import { acceptanceCheckPath, acceptanceOverviewPath } from './routes';-import { checksForTurn } from './turnChecks';-import { useAcceptanceBundle } from './useAcceptanceBundle';-import { useAcceptanceTurn } from './useAcceptanceTurn';-import { canReviewAcceptance } from './visibility';const AcceptanceFocusWorkspace = () => {const { t } = useTranslation('verify');diff --git a/src/features/Acceptance/Viewer/Focus/FocusedCheckDetails.tsx b/src/features/Acceptance/Viewer/Focus/FocusedCheckDetails.tsxnew file mode 100644index 00000000000..0c1f19cb8a5--- /dev/null+++ b/src/features/Acceptance/Viewer/Focus/FocusedCheckDetails.tsx@@ -0,0 +1,38 @@+'use client';++import { memo } from 'react';++import { AcceptanceCheckRow } from '../Checks/CheckRow';+import type { AcceptanceCheck, CheckReviewInput, ProposalDismissInput } from '../Checks/types';++interface FocusedCheckDetailsProps {+ canReview: boolean;+ check: AcceptanceCheck;+ /** Answer a model proposal without ruling on the check itself. */+ onDismissProposal?: (input: ProposalDismissInput) => Promise<void>;+ /** Open an agent judge's verification run (its trace IS the argument). */+ onOpenTrace?: (verifierOperationId: string) => void | Promise<void>;+ onReview: (input: CheckReviewInput) => Promise<boolean>;+ onRound?: (round: number) => void;+ reviewPending: boolean;+}++/** Full check content for the dedicated second-level acceptance workspace. */+export const FocusedCheckDetails = memo<FocusedCheckDetailsProps>(+ ({ canReview, check, onDismissProposal, onOpenTrace, onReview, onRound, reviewPending }) => (+ <AcceptanceCheckRow+ detailMode+ expanded+ canReview={canReview}+ check={check}+ reviewPending={reviewPending}+ onDismissProposal={onDismissProposal}+ onOpenTrace={onOpenTrace}+ onReview={onReview}+ onRound={onRound}+ onToggle={() => {}}+ />+ ),+);++FocusedCheckDetails.displayName = 'FocusedCheckDetails';diff --git a/src/features/Acceptance/Viewer/AcceptanceGoal.tsx b/src/features/Acceptance/Viewer/Header/AcceptanceGoal.tsxsimilarity index 96%rename from src/features/Acceptance/Viewer/AcceptanceGoal.tsxrename to src/features/Acceptance/Viewer/Header/AcceptanceGoal.tsxindex 696095913ac..f4855e96858 100644--- a/src/features/Acceptance/Viewer/AcceptanceGoal.tsx+++ b/src/features/Acceptance/Viewer/Header/AcceptanceGoal.tsx@@ -9,9 +9,9 @@ import { useTranslation } from 'react-i18next';import { useLocalStorageState } from '@/hooks/useLocalStorageState';-import { useAcceptanceScope } from './AcceptanceScope';-import { acceptanceCodingScope } from './codingScope';-import { useAcceptanceBundle } from './useAcceptanceBundle';+import { useAcceptanceScope } from '../AcceptanceScope';+import { acceptanceCodingScope } from '../History/codingScope';+import { useAcceptanceBundle } from '../useAcceptanceBundle';const GOAL_COLLAPSED_STORAGE_KEY = 'lobehub-acceptance-goal-collapsed';diff --git a/src/features/Acceptance/Viewer/AcceptanceGoalEdit.tsx b/src/features/Acceptance/Viewer/Header/AcceptanceGoalEdit.tsxsimilarity index 93%rename from src/features/Acceptance/Viewer/AcceptanceGoalEdit.tsxrename to src/features/Acceptance/Viewer/Header/AcceptanceGoalEdit.tsxindex dfe7056d50c..4e96b24ae71 100644--- a/src/features/Acceptance/Viewer/AcceptanceGoalEdit.tsx+++ b/src/features/Acceptance/Viewer/Header/AcceptanceGoalEdit.tsx@@ -8,8 +8,8 @@ import { mutate as globalMutate } from '@/libs/swr';import { isAcceptanceListKey } from '@/libs/swr/keys';import { verifyService } from '@/services/verify';-import { useAcceptanceScope } from './AcceptanceScope';-import { useAcceptanceBundle } from './useAcceptanceBundle';+import { useAcceptanceScope } from '../AcceptanceScope';+import { useAcceptanceBundle } from '../useAcceptanceBundle';const AcceptanceGoalEdit = () => {const { t } = useTranslation('verify');diff --git a/src/features/Acceptance/Viewer/AcceptanceIdentity.tsx b/src/features/Acceptance/Viewer/Header/AcceptanceIdentity.tsxsimilarity index 95%rename from src/features/Acceptance/Viewer/AcceptanceIdentity.tsxrename to src/features/Acceptance/Viewer/Header/AcceptanceIdentity.tsxindex d8b5b95e25e..091e28604d5 100644--- a/src/features/Acceptance/Viewer/AcceptanceIdentity.tsx+++ b/src/features/Acceptance/Viewer/Header/AcceptanceIdentity.tsx@@ -10,11 +10,11 @@ import { useTranslation } from 'react-i18next';import { useIsHydrated } from '@/hooks/useIsHydrated';-import { useAcceptanceScope } from './AcceptanceScope';+import { useAcceptanceScope } from '../AcceptanceScope';+import { acceptanceCodingScope } from '../History/codingScope';+import { useAcceptanceBundle } from '../useAcceptanceBundle';+import { formatAcceptanceCountsText } from '../verdict';import AcceptanceStatusPill from './AcceptanceStatusPill';-import { acceptanceCodingScope } from './codingScope';-import { useAcceptanceBundle } from './useAcceptanceBundle';-import { formatAcceptanceCountsText } from './verdict';const styles = createStaticStyles(({ css }) => ({statusRow: css`diff --git a/src/features/Acceptance/Viewer/AcceptanceSharedNotice.tsx b/src/features/Acceptance/Viewer/Header/AcceptanceSharedNotice.tsxsimilarity index 89%rename from src/features/Acceptance/Viewer/AcceptanceSharedNotice.tsxrename to src/features/Acceptance/Viewer/Header/AcceptanceSharedNotice.tsxindex bbafad87e88..a333cce84ee 100644--- a/src/features/Acceptance/Viewer/AcceptanceSharedNotice.tsx+++ b/src/features/Acceptance/Viewer/Header/AcceptanceSharedNotice.tsx@@ -8,9 +8,9 @@ import { useTranslation } from 'react-i18next';import { useAuthorInfo } from '@/business/client/hooks/useAuthorInfo';-import { useAcceptanceScope } from './AcceptanceScope';-import { useAcceptanceBundle } from './useAcceptanceBundle';-import { canReviewAcceptance } from './visibility';+import { useAcceptanceScope } from '../AcceptanceScope';+import { useAcceptanceBundle } from '../useAcceptanceBundle';+import { canReviewAcceptance } from '../visibility';/*** In-body notice for viewers who reached this acceptance through someonediff --git a/src/features/Acceptance/Viewer/AcceptanceStatusControl.tsx b/src/features/Acceptance/Viewer/Header/AcceptanceStatusControl.tsxsimilarity index 89%rename from src/features/Acceptance/Viewer/AcceptanceStatusControl.tsxrename to src/features/Acceptance/Viewer/Header/AcceptanceStatusControl.tsxindex 75a0001ca3a..3a6986c0774 100644--- a/src/features/Acceptance/Viewer/AcceptanceStatusControl.tsx+++ b/src/features/Acceptance/Viewer/Header/AcceptanceStatusControl.tsx@@ -10,11 +10,11 @@ import { mutate as globalMutate } from '@/libs/swr';import { isAcceptanceListKey } from '@/libs/swr/keys';import { verifyService } from '@/services/verify';-import { useAcceptanceScope } from './AcceptanceScope';+import { useAcceptanceScope } from '../AcceptanceScope';+import { getAcceptanceStatusActions } from '../statusActions';+import { useAcceptanceBundle } from '../useAcceptanceBundle';+import { canReviewAcceptance } from '../visibility';import AcceptanceStatusPill from './AcceptanceStatusPill';-import { getAcceptanceStatusActions } from './statusActions';-import { useAcceptanceBundle } from './useAcceptanceBundle';-import { canReviewAcceptance } from './visibility';const AcceptanceStatusControl = () => {const { t } = useTranslation('verify');diff --git a/src/features/Acceptance/Viewer/AcceptanceStatusPill.tsx b/src/features/Acceptance/Viewer/Header/AcceptanceStatusPill.tsxsimilarity index 96%rename from src/features/Acceptance/Viewer/AcceptanceStatusPill.tsxrename to src/features/Acceptance/Viewer/Header/AcceptanceStatusPill.tsxindex 7f5e173a00b..ecb51ebb61e 100644--- a/src/features/Acceptance/Viewer/AcceptanceStatusPill.tsx+++ b/src/features/Acceptance/Viewer/Header/AcceptanceStatusPill.tsx@@ -7,7 +7,7 @@ import { createStaticStyles, cssVar, cx } from 'antd-style';import { ChevronDown } from 'lucide-react';import { useTranslation } from 'react-i18next';-import { resolveAcceptanceVerdictMeta } from './verdict';+import { resolveAcceptanceVerdictMeta } from '../verdict';const styles = createStaticStyles(({ css }) => ({pill: css`diff --git a/src/features/Acceptance/Viewer/AcceptanceTabs.tsx b/src/features/Acceptance/Viewer/Header/AcceptanceTabs.tsxsimilarity index 75%rename from src/features/Acceptance/Viewer/AcceptanceTabs.tsxrename to src/features/Acceptance/Viewer/Header/AcceptanceTabs.tsxindex 34808332032..6f8e3d3919a 100644--- a/src/features/Acceptance/Viewer/AcceptanceTabs.tsx+++ b/src/features/Acceptance/Viewer/Header/AcceptanceTabs.tsx@@ -88,22 +88,24 @@ const AcceptanceTabs = ({return (<Flexbox horizontal align={'center'} gap={2}>- {tabs.filter((tab) => tab.key !== 'flow' || flowCount > 0).map((tab) => (- <Button- aria-pressed={tab.key === active}- className={cx(styles.tab, tab.key === active && styles.tabActive)}- key={tab.key}- style={{ minHeight: 44 }}- type={'text'}- onClick={() => onChange(tab.key)}- >- <Icon icon={tab.icon} size={14} style={{ color: cssVar.colorTextTertiary }} />- <Text fontSize={13} weight={tab.key === active ? 600 : 400}>- {tab.label}- </Text>- <Text className={styles.count}>{tab.count}</Text>- </Button>- ))}+ {tabs+ .filter((tab) => tab.key !== 'flow' || flowCount > 0)+ .map((tab) => (+ <Button+ aria-pressed={tab.key === active}+ className={cx(styles.tab, tab.key === active && styles.tabActive)}+ key={tab.key}+ style={{ minHeight: 44 }}+ type={'text'}+ onClick={() => onChange(tab.key)}+ >+ <Icon icon={tab.icon} size={14} style={{ color: cssVar.colorTextTertiary }} />+ <Text fontSize={13} weight={tab.key === active ? 600 : 400}>+ {tab.label}+ </Text>+ <Text className={styles.count}>{tab.count}</Text>+ </Button>+ ))}</Flexbox>);};diff --git a/src/features/Acceptance/Viewer/AcceptanceInteractionCost.tsx b/src/features/Acceptance/Viewer/History/AcceptanceInteractionCost.tsxsimilarity index 95%rename from src/features/Acceptance/Viewer/AcceptanceInteractionCost.tsxrename to src/features/Acceptance/Viewer/History/AcceptanceInteractionCost.tsxindex 1a227d3ae83..aebf727ef39 100644--- a/src/features/Acceptance/Viewer/AcceptanceInteractionCost.tsx+++ b/src/features/Acceptance/Viewer/History/AcceptanceInteractionCost.tsx@@ -9,8 +9,8 @@ import { useTranslation } from 'react-i18next';import type { AcceptanceBundle } from '@/services/verify';-import InteractionCostPanel from '../Report/InteractionCost';-import { formatSeconds } from '../Report/interactionCostModel';+import InteractionCostPanel from '../../Report/InteractionCost';+import { formatSeconds } from '../../Report/interactionCostModel';import { buildCheckLabels, selectPricedRound } from './interactionCost';/**diff --git a/src/features/Acceptance/Viewer/AcceptanceLedgerRail.tsx b/src/features/Acceptance/Viewer/History/AcceptanceLedgerRail.tsxsimilarity index 92%rename from src/features/Acceptance/Viewer/AcceptanceLedgerRail.tsxrename to src/features/Acceptance/Viewer/History/AcceptanceLedgerRail.tsxindex a2070ed57ab..b8e8268e40b 100644--- a/src/features/Acceptance/Viewer/AcceptanceLedgerRail.tsx+++ b/src/features/Acceptance/Viewer/History/AcceptanceLedgerRail.tsx@@ -7,16 +7,16 @@ import { PanelRightOpen } from 'lucide-react';import { useTranslation } from 'react-i18next';import { useParams, useSearchParams } from 'react-router';-import { AcceptanceDrawer } from '../AcceptanceDrawer';-import ReportViewer from '../Report/ReportViewer';-import { resolveRoundParam } from '../utils';-import { useAcceptanceScope } from './AcceptanceScope';-import { checkFilterState } from './CheckList';+import { AcceptanceDrawer } from '../../AcceptanceDrawer';+import ReportViewer from '../../Report/ReportViewer';+import { resolveRoundParam } from '../../utils';+import { useAcceptanceScope } from '../AcceptanceScope';+import { checkFilterState } from '../Checks/checkState';+import { originTopicPanelProps } from '../Conversation/originConversation';+import { useAcceptanceBundle } from '../useAcceptanceBundle';+import { canViewAcceptanceHistory } from '../visibility';import LedgerPanel, { type AcceptanceRound } from './LedgerPanel';-import { originTopicPanelProps } from './originConversation';-import { useAcceptanceBundle } from './useAcceptanceBundle';import { useAcceptanceRailState } from './useAcceptanceRailState';-import { canViewAcceptanceHistory } from './visibility';const styles = createStaticStyles(({ css }) => ({chipCount: css`diff --git a/src/features/Acceptance/Viewer/AcceptanceViewReportLink.tsx b/src/features/Acceptance/Viewer/History/AcceptanceViewReportLink.tsxsimilarity index 89%rename from src/features/Acceptance/Viewer/AcceptanceViewReportLink.tsxrename to src/features/Acceptance/Viewer/History/AcceptanceViewReportLink.tsxindex dd6c8b38612..391a2353124 100644--- a/src/features/Acceptance/Viewer/AcceptanceViewReportLink.tsx+++ b/src/features/Acceptance/Viewer/History/AcceptanceViewReportLink.tsx@@ -4,9 +4,9 @@ import { createStaticStyles, cssVar } from 'antd-style';import { useTranslation } from 'react-i18next';import { useSearchParams } from 'react-router';-import { useAcceptanceScope } from './AcceptanceScope';-import { useAcceptanceBundle } from './useAcceptanceBundle';-import { canViewAcceptanceHistory } from './visibility';+import { useAcceptanceScope } from '../AcceptanceScope';+import { useAcceptanceBundle } from '../useAcceptanceBundle';+import { canViewAcceptanceHistory } from '../visibility';const styles = createStaticStyles(({ css }) => ({link: css`diff --git a/src/features/Acceptance/Viewer/LedgerPanel.tsx b/src/features/Acceptance/Viewer/History/LedgerPanel.tsxsimilarity index 100%rename from src/features/Acceptance/Viewer/LedgerPanel.tsxrename to src/features/Acceptance/Viewer/History/LedgerPanel.tsxdiff --git a/src/features/Acceptance/Viewer/codingScope.ts b/src/features/Acceptance/Viewer/History/codingScope.tssimilarity index 100%rename from src/features/Acceptance/Viewer/codingScope.tsrename to src/features/Acceptance/Viewer/History/codingScope.tsdiff --git a/src/features/Acceptance/Viewer/interactionCost.test.ts b/src/features/Acceptance/Viewer/History/interactionCost.test.tssimilarity index 100%rename from src/features/Acceptance/Viewer/interactionCost.test.tsrename to src/features/Acceptance/Viewer/History/interactionCost.test.tsdiff --git a/src/features/Acceptance/Viewer/interactionCost.ts b/src/features/Acceptance/Viewer/History/interactionCost.tssimilarity index 94%rename from src/features/Acceptance/Viewer/interactionCost.tsrename to src/features/Acceptance/Viewer/History/interactionCost.tsindex 7a1cbf50c5b..9b36289c70e 100644--- a/src/features/Acceptance/Viewer/interactionCost.ts+++ b/src/features/Acceptance/Viewer/History/interactionCost.ts@@ -1,6 +1,6 @@import type { VerifyInteractionCost } from '@lobechat/types';-import { readInteractionCost } from '../Report/interactionCostModel';+import { readInteractionCost } from '../../Report/interactionCostModel';/** A round's cost plus the round it was measured in. */export interface PricedRound {diff --git a/src/features/Acceptance/Viewer/predictRound.test.ts b/src/features/Acceptance/Viewer/History/predictRound.test.tssimilarity index 100%rename from src/features/Acceptance/Viewer/predictRound.test.tsrename to src/features/Acceptance/Viewer/History/predictRound.test.tsdiff --git a/src/features/Acceptance/Viewer/predictRound.ts b/src/features/Acceptance/Viewer/History/predictRound.tssimilarity index 100%rename from src/features/Acceptance/Viewer/predictRound.tsrename to src/features/Acceptance/Viewer/History/predictRound.tsdiff --git a/src/features/Acceptance/Viewer/useAcceptanceRailState.test.ts b/src/features/Acceptance/Viewer/History/useAcceptanceRailState.test.tssimilarity index 96%rename from src/features/Acceptance/Viewer/useAcceptanceRailState.test.tsrename to src/features/Acceptance/Viewer/History/useAcceptanceRailState.test.tsindex 5fd39079664..a95698560c5 100644--- a/src/features/Acceptance/Viewer/useAcceptanceRailState.test.ts+++ b/src/features/Acceptance/Viewer/History/useAcceptanceRailState.test.ts@@ -4,7 +4,7 @@ import type { ReactNode } from 'react';import { createElement } from 'react';import { describe, expect, it } from 'vitest';-import { OriginConversationProvider } from './originConversation';+import { OriginConversationProvider } from '../Conversation/originConversation';import { useAcceptanceRailState } from './useAcceptanceRailState';const TopicPanel = () => null;diff --git a/src/features/Acceptance/Viewer/useAcceptanceRailState.ts b/src/features/Acceptance/Viewer/History/useAcceptanceRailState.tssimilarity index 92%rename from src/features/Acceptance/Viewer/useAcceptanceRailState.tsrename to src/features/Acceptance/Viewer/History/useAcceptanceRailState.tsindex f6bdaaf6f62..d0531dc405a 100644--- a/src/features/Acceptance/Viewer/useAcceptanceRailState.ts+++ b/src/features/Acceptance/Viewer/History/useAcceptanceRailState.ts@@ -1,6 +1,6 @@import { useEffect, useState } from 'react';-import { useOriginConversation } from './originConversation';+import { useOriginConversation } from '../Conversation/originConversation';export const useAcceptanceRailState = ({focused,diff --git a/src/features/Acceptance/Viewer/Plan/AcceptancePlanReview.tsx b/src/features/Acceptance/Viewer/Plan/AcceptancePlanReview.tsxnew file mode 100644index 00000000000..67a5070d685--- /dev/null+++ b/src/features/Acceptance/Viewer/Plan/AcceptancePlanReview.tsx@@ -0,0 +1,71 @@+'use client';++import { Flexbox } from '@lobehub/ui';+import { Button, toast } from '@lobehub/ui/base-ui';+import { useState } from 'react';+import { useTranslation } from 'react-i18next';++import { verifyService } from '@/services/verify';++import { useAcceptanceScope } from '../AcceptanceScope';+import { openGroupFeedbackModal } from '../Review/modals';+import { useAcceptanceBundle } from '../useAcceptanceBundle';+import { flowPlanPhase } from './planReview';++export function AcceptancePlanReview({ runId }: { runId: string | undefined }) {+ const { t } = useTranslation('verify');+ const { acceptanceId } = useAcceptanceScope();+ const { data, mutate } = useAcceptanceBundle(acceptanceId);+ const [pending, setPending] = useState(false);+ const round = data?.rounds.find(({ run }) => run.id === runId);+ const phase = flowPlanPhase(round);+ if (!phase || !round || round.run.id !== data?.rounds.at(-1)?.run.id) return null;+ const canComment = data.canReview && !['accepted', 'closed'].includes(data.acceptance.status);++ const runAction = async (action: () => Promise<unknown>) => {+ setPending(true);+ try {+ await action();+ await mutate();+ return true;+ } catch (error) {+ console.error('[acceptance:plan-review]', error);+ toast.error(t('flow.plan.actionError'));+ return false;+ } finally {+ setPending(false);+ }+ };++ return (+ <Flexbox gap={12}>+ {canComment && (+ <Flexbox horizontal justify="flex-end">+ <Button+ disabled={pending}+ size="small"+ type="text"+ onClick={() =>+ openGroupFeedbackModal({+ title: t('flow.plan.requestChanges'),+ description: t('flow.plan.feedbackDescription'),+ groupLabel: t('flow.plan.label'),+ onConfirm: (comment, fileIds) =>+ runAction(() =>+ verifyService.addGroupFeedback({+ id: acceptanceId,+ category: 'flow-plan',+ comment,+ fileIds,+ }),+ ),+ })+ }+ >+ {t('flow.plan.requestChanges')}+ </Button>+ </Flexbox>+ )}+ </Flexbox>+ );+}diff --git a/src/features/Acceptance/Viewer/Plan/planReview.test.ts b/src/features/Acceptance/Viewer/Plan/planReview.test.tsnew file mode 100644index 00000000000..7d74716d182--- /dev/null+++ b/src/features/Acceptance/Viewer/Plan/planReview.test.ts@@ -0,0 +1,31 @@+import { describe, expect, it } from 'vitest';++import { flowPlanPhase } from './planReview';++const snapshot = {+ flowId: 'flow',+ title: 'Send message',+ entryNodeId: 'entry',+ nodes: [],+ edges: [],+};++describe('flow plan review phase', () => {+ it('distinguishes drafts from execution and leaves checklist-only plans alone', () => {+ expect(flowPlanPhase(undefined)).toBeUndefined();+ expect(flowPlanPhase({ run: { status: 'planned', flowSnapshots: null } })).toBeUndefined();+ expect(+ flowPlanPhase({+ run: { status: 'planned', flowSnapshots: [snapshot] },+ }),+ ).toBe('draft');+ expect(+ flowPlanPhase({+ run: {+ status: 'collecting_evidence',+ flowSnapshots: [snapshot],+ },+ }),+ ).toBeUndefined();+ });+});diff --git a/src/features/Acceptance/Viewer/Plan/planReview.ts b/src/features/Acceptance/Viewer/Plan/planReview.tsnew file mode 100644index 00000000000..b56042f85e7--- /dev/null+++ b/src/features/Acceptance/Viewer/Plan/planReview.ts@@ -0,0 +1,11 @@+import type { AcceptanceBundle } from '@/services/verify';++type Round = AcceptanceBundle['rounds'][number];++/** A prepared flow remains inspectable until execution starts. */+export const flowPlanPhase = (+ round: { run: Pick<Round['run'], 'flowSnapshots' | 'status'> } | undefined,+) => {+ if (!round?.run.flowSnapshots?.length || round.run.status !== 'planned') return undefined;+ return 'draft';+};diff --git a/src/features/Acceptance/Viewer/AcceptanceDecision.tsx b/src/features/Acceptance/Viewer/Review/AcceptanceDecision.tsxsimilarity index 94%rename from src/features/Acceptance/Viewer/AcceptanceDecision.tsxrename to src/features/Acceptance/Viewer/Review/AcceptanceDecision.tsxindex a19a1094401..b00b11eda36 100644--- a/src/features/Acceptance/Viewer/AcceptanceDecision.tsx+++ b/src/features/Acceptance/Viewer/Review/AcceptanceDecision.tsx@@ -12,17 +12,18 @@ import { mutate as globalMutate } from '@/libs/swr';import { isAcceptanceListKey } from '@/libs/swr/keys';import { verifyService } from '@/services/verify';-import { useAcceptanceScope } from './AcceptanceScope';-import { checkFilterState, isException } from './CheckList';-import { buildRepairPrompt } from './checkWork';+import { useAcceptanceScope } from '../AcceptanceScope';+import { checkFilterState, isException } from '../Checks/checkState';+import { buildRepairPrompt } from '../Checks/checkWork';+import { flowPlanPhase } from '../Plan/planReview';+import { acceptanceCheckPath } from '../routes';+import { useAcceptanceBundle } from '../useAcceptanceBundle';+import { useAcceptanceTurn } from '../useAcceptanceTurn';+import { formatAcceptanceCountsText, LIVE_ACCEPTANCE_STATUSES } from '../verdict';+import { canReviewAcceptance } from '../visibility';import DecisionBar from './DecisionBar';import FeedbackDrawer, { type FeedbackListEntry } from './FeedbackDrawer';import { openAcceptModal, openGroupFeedbackModal, openRejectModal } from './modals';-import { acceptanceCheckPath } from './routes';-import { useAcceptanceBundle } from './useAcceptanceBundle';-import { useAcceptanceTurn } from './useAcceptanceTurn';-import { formatAcceptanceCountsText, LIVE_ACCEPTANCE_STATUSES } from './verdict';-import { canReviewAcceptance } from './visibility';interface AcceptanceDecisionProps {onDraftToComposer?: (text: string) => boolean;@@ -39,6 +40,8 @@ const AcceptanceDecision = ({ onDraftToComposer }: AcceptanceDecisionProps) => {const [feedbackOpen, setFeedbackOpen] = useState(false);if (!data || !canReviewAcceptance(data) || data.acceptance.status === 'closed') return null;+ if (flowPlanPhase(data.rounds.at(-1))) return null;+if (turn !== null && turn !== data.rounds.at(-1)?.run.roundIndex)return (<Flexbox gap={8}>diff --git a/src/features/Acceptance/Viewer/CheckRejectModal.tsx b/src/features/Acceptance/Viewer/Review/CheckRejectModal.tsxsimilarity index 98%rename from src/features/Acceptance/Viewer/CheckRejectModal.tsxrename to src/features/Acceptance/Viewer/Review/CheckRejectModal.tsxindex 455a7b71dec..868bb6e5325 100644--- a/src/features/Acceptance/Viewer/CheckRejectModal.tsx+++ b/src/features/Acceptance/Viewer/Review/CheckRejectModal.tsx@@ -8,10 +8,14 @@ import { Trash2, ZoomIn, ZoomOut } from 'lucide-react';import { memo, useEffect, useLayoutEffect, useRef, useState } from 'react';import { useTranslation } from 'react-i18next';-import { AnnotationCanvas } from './Annotation';-import type { PendingAttachment } from './attachments';-import { AttachmentStrip, AttachmentUploadButton, useFeedbackAttachments } from './attachments';-import { MobileEvidenceReview } from './MobileEvidenceReview';+import { AnnotationCanvas } from '../Evidence/Annotation';+import type { PendingAttachment } from '../Evidence/attachments';+import {+ AttachmentStrip,+ AttachmentUploadButton,+ useFeedbackAttachments,+} from '../Evidence/attachments';+import { MobileEvidenceReview } from '../Evidence/MobileEvidenceReview';import { frostedModalStyles } from './modals';import { useReviewSubmit } from './useReviewSubmit';diff --git a/src/features/Acceptance/Viewer/DecisionBar.test.ts b/src/features/Acceptance/Viewer/Review/DecisionBar.test.tssimilarity index 97%rename from src/features/Acceptance/Viewer/DecisionBar.test.tsrename to src/features/Acceptance/Viewer/Review/DecisionBar.test.tsindex c764fd48d57..c2207108a94 100644--- a/src/features/Acceptance/Viewer/DecisionBar.test.ts+++ b/src/features/Acceptance/Viewer/Review/DecisionBar.test.ts@@ -2,7 +2,7 @@ import { cleanup, fireEvent, render, screen } from '@testing-library/react';import { createElement } from 'react';import { afterEach, describe, expect, it, vi } from 'vitest';-import verify from '../../../../packages/locales/src/default/verify';+import verify from '../../../../../packages/locales/src/default/verify';import DecisionBar from './DecisionBar';vi.mock('react-i18next', () => ({ useTranslation: () => ({ t: (key: string) => key }) }));diff --git a/src/features/Acceptance/Viewer/DecisionBar.tsx b/src/features/Acceptance/Viewer/Review/DecisionBar.tsxsimilarity index 99%rename from src/features/Acceptance/Viewer/DecisionBar.tsxrename to src/features/Acceptance/Viewer/Review/DecisionBar.tsxindex 737acfa9e06..5442fb3e8a8 100644--- a/src/features/Acceptance/Viewer/DecisionBar.tsx+++ b/src/features/Acceptance/Viewer/Review/DecisionBar.tsx@@ -15,7 +15,7 @@ import {import { memo, useEffect, useRef } from 'react';import { useTranslation } from 'react-i18next';-import { acceptanceContentLayout } from './layout';+import { acceptanceContentLayout } from '../layout';const styles = createStaticStyles(({ css }) => ({/* Floats over the scrolling checklist — the decision stays reachablediff --git a/src/features/Acceptance/Viewer/FeedbackDrawer.tsx b/src/features/Acceptance/Viewer/Review/FeedbackDrawer.tsxsimilarity index 99%rename from src/features/Acceptance/Viewer/FeedbackDrawer.tsxrename to src/features/Acceptance/Viewer/Review/FeedbackDrawer.tsxindex 795425add7b..88ccf227202 100644--- a/src/features/Acceptance/Viewer/FeedbackDrawer.tsx+++ b/src/features/Acceptance/Viewer/Review/FeedbackDrawer.tsx@@ -8,7 +8,7 @@ import dayjs from 'dayjs';import { memo } from 'react';import { useTranslation } from 'react-i18next';-import { AttachmentThumbs } from './attachments';+import { AttachmentThumbs } from '../Evidence/attachments';const styles = createStaticStyles(({ css }) => ({clickable: css`diff --git a/src/features/Acceptance/Viewer/ProposalCard.tsx b/src/features/Acceptance/Viewer/Review/ProposalCard.tsxsimilarity index 100%rename from src/features/Acceptance/Viewer/ProposalCard.tsxrename to src/features/Acceptance/Viewer/Review/ProposalCard.tsxdiff --git a/src/features/Acceptance/Viewer/modals.tsx b/src/features/Acceptance/Viewer/Review/modals.tsxsimilarity index 98%rename from src/features/Acceptance/Viewer/modals.tsxrename to src/features/Acceptance/Viewer/Review/modals.tsxindex 3b9e5e20965..51db2cf2b39 100644--- a/src/features/Acceptance/Viewer/modals.tsx+++ b/src/features/Acceptance/Viewer/Review/modals.tsx@@ -13,7 +13,11 @@ import { t } from 'i18next';import { memo, useState } from 'react';import { useTranslation } from 'react-i18next';-import { AttachmentStrip, AttachmentUploadButton, useFeedbackAttachments } from './attachments';+import {+ AttachmentStrip,+ AttachmentUploadButton,+ useFeedbackAttachments,+} from '../Evidence/attachments';const styles = createStaticStyles(({ css }) => ({warning: css`diff --git a/src/features/Acceptance/Viewer/proposal.test.ts b/src/features/Acceptance/Viewer/Review/proposal.test.tssimilarity index 100%rename from src/features/Acceptance/Viewer/proposal.test.tsrename to src/features/Acceptance/Viewer/Review/proposal.test.tsdiff --git a/src/features/Acceptance/Viewer/proposal.ts b/src/features/Acceptance/Viewer/Review/proposal.tssimilarity index 100%rename from src/features/Acceptance/Viewer/proposal.tsrename to src/features/Acceptance/Viewer/Review/proposal.tsdiff --git a/src/features/Acceptance/Viewer/repairRerun.test.ts b/src/features/Acceptance/Viewer/Review/repairRerun.test.tssimilarity index 100%rename from src/features/Acceptance/Viewer/repairRerun.test.tsrename to src/features/Acceptance/Viewer/Review/repairRerun.test.tsdiff --git a/src/features/Acceptance/Viewer/repairRerun.ts b/src/features/Acceptance/Viewer/Review/repairRerun.tssimilarity index 100%rename from src/features/Acceptance/Viewer/repairRerun.tsrename to src/features/Acceptance/Viewer/Review/repairRerun.tsdiff --git a/src/features/Acceptance/Viewer/useReviewSubmit.test.ts b/src/features/Acceptance/Viewer/Review/useReviewSubmit.test.tssimilarity index 100%rename from src/features/Acceptance/Viewer/useReviewSubmit.test.tsrename to src/features/Acceptance/Viewer/Review/useReviewSubmit.test.tsdiff --git a/src/features/Acceptance/Viewer/useReviewSubmit.ts b/src/features/Acceptance/Viewer/Review/useReviewSubmit.tssimilarity index 100%rename from src/features/Acceptance/Viewer/useReviewSubmit.tsrename to src/features/Acceptance/Viewer/Review/useReviewSubmit.tsdiff --git a/src/features/Acceptance/Viewer/index.tsx b/src/features/Acceptance/Viewer/index.tsxindex 2a4bbc7d8c9..a33c8e1fd77 100644--- a/src/features/Acceptance/Viewer/index.tsx+++ b/src/features/Acceptance/Viewer/index.tsx@@ -6,51 +6,18 @@ import { useState } from 'react';import { useParams } from 'react-router';import { extractUuid } from '../utils';-import AcceptanceCheckInventory from './AcceptanceCheckInventory';-import AcceptanceCheckOwnerToolbar from './AcceptanceCheckOwnerToolbar';-import AcceptanceDecision from './AcceptanceDecision';-import AcceptanceEnterFocus from './AcceptanceEnterFocus';-import { AcceptanceFlow } from './AcceptanceFlow';-import AcceptanceFocusWorkspace from './AcceptanceFocusWorkspace';-import AcceptanceGoal from './AcceptanceGoal';-import AcceptanceGoalEdit from './AcceptanceGoalEdit';-import AcceptanceIdentity from './AcceptanceIdentity';-import AcceptanceLedgerRail from './AcceptanceLedgerRail';-import AcceptanceOriginTopic from './AcceptanceOriginTopic';-import AcceptanceResources from './AcceptanceResources';-import { AcceptanceBundleGate, AcceptanceScope, useAcceptanceScope } from './AcceptanceScope';-import AcceptanceSharedNotice from './AcceptanceSharedNotice';-import AcceptanceStatusControl from './AcceptanceStatusControl';-import type { AcceptanceTabKey } from './AcceptanceTabs';-import AcceptanceTabs from './AcceptanceTabs';-import { getFlowNodeCount, resolveAcceptanceTab } from './flowNavigation';-import { FlowPanelHostContext } from './FlowResults';-import { acceptanceContentLayout, acceptanceScrollLayout } from './layout';-import { checksForTurn } from './turnChecks';-import { useAcceptanceBundle } from './useAcceptanceBundle';-import { useAcceptanceTurn } from './useAcceptanceTurn';+import { AcceptanceOverview } from './AcceptanceOverview';+import { AcceptanceBundleGate, AcceptanceScope } from './AcceptanceScope';+import { FlowPanelHostContext } from './Flow/FlowPanelHost';+import AcceptanceFocusWorkspace from './Focus/AcceptanceFocusWorkspace';+import AcceptanceSharedNotice from './Header/AcceptanceSharedNotice';+import AcceptanceLedgerRail from './History/AcceptanceLedgerRail';+import { acceptanceScrollLayout } from './layout';const styles = createStaticStyles(({ css }) => ({- column: css`- width: 100%;- max-width: ${acceptanceContentLayout.maxWidth}px;- margin-inline: auto;- padding-inline: 24px;-- @media (width <= 767px) {- padding-inline: 16px;- }- `,contentFrame: css`overflow: ${acceptanceScrollLayout.frameOverflow};`,- /* Spans the frame, not the reading column — the rule is the page's own- horizon line, so cutting it at 920 would read as a card edge. */- headerBand: css`- flex: none;- padding-block: 20px 0;- border-block-end: 1px solid ${cssVar.colorBorderSecondary};- `,flowPanel: css`flex: none;width: min(440px, 42%);@@ -82,82 +49,11 @@ const styles = createStaticStyles(({ css }) => ({}`,}));-interface AcceptancePageProps {acceptanceId?: string;onDraftToComposer?: (text: string) => boolean;}-/**- * The record's own body: an identity band that ends in the full-width rule,- * then whichever face of the delivery the tabs select.- */-const AcceptanceBody = ({ onDraftToComposer }: Pick<AcceptancePageProps, 'onDraftToComposer'>) => {- const { acceptanceId, embedded } = useAcceptanceScope();- const { turn } = useAcceptanceTurn(embedded);- const { data } = useAcceptanceBundle(acceptanceId);- const [requestedTab, setTab] = useState<AcceptanceTabKey>('checks');- const flowCount = getFlowNodeCount(data?.flows);- const tab = resolveAcceptanceTab(requestedTab, flowCount);- const checks = data ? checksForTurn(data, turn) : [];- const resourceCount = new Set(- checks.flatMap((check) =>- (check.evidence ?? [])- .filter((evidence) => evidence.fileUrl || evidence.documentId)- .map((evidence) => evidence.fileId ?? evidence.documentId ?? evidence.id),- ),- ).size;-- return (- <>- <Flexbox className={styles.headerBand}>- <Flexbox className={styles.column} gap={12}>- <AcceptanceSharedNotice />- <AcceptanceIdentity- focusSlot={<AcceptanceEnterFocus />}- statusSlot={<AcceptanceStatusControl />}- topicSlot={<AcceptanceOriginTopic />}- />- <AcceptanceGoal editSlot={<AcceptanceGoalEdit />} />- {/* The requirement needs room to land before the tabs start a new- thought — at the band's uniform gap it read as another row of- the same list. */}- <Flexbox style={{ paddingBlockStart: 16 }}>- <AcceptanceTabs- active={tab}- checkCount={checks.length}- flowCount={flowCount}- resourceCount={resourceCount}- onChange={setTab}- />- </Flexbox>- </Flexbox>- </Flexbox>-- <Flexbox- className={styles.column}- gap={16}- paddingBlock={20}- style={tab === 'flow' ? { maxWidth: 1500 } : undefined}- >- {tab === 'flow' ? (- <>- <AcceptanceFlow />- <AcceptanceDecision onDraftToComposer={onDraftToComposer} />- </>- ) : tab === 'checks' ? (- <>- <AcceptanceCheckInventory toolbar={<AcceptanceCheckOwnerToolbar />} />- <AcceptanceDecision onDraftToComposer={onDraftToComposer} />- </>- ) : (- <AcceptanceResources />- )}- </Flexbox>- </>- );-};-const AcceptancePage = ({acceptanceId: explicitAcceptanceId,onDraftToComposer,@@ -199,7 +95,7 @@ const AcceptancePage = ({</>) : null}</Flexbox>- {!focused && <AcceptanceBody onDraftToComposer={onDraftToComposer} />}+ {!focused && <AcceptanceOverview onDraftToComposer={onDraftToComposer} />}</Flexbox><AcceptanceLedgerRail /></Flexbox>diff --git a/src/features/Acceptance/Viewer/visibility.ts b/src/features/Acceptance/Viewer/visibility.tsindex fa99fbc4975..327116a18bd 100644--- a/src/features/Acceptance/Viewer/visibility.ts+++ b/src/features/Acceptance/Viewer/visibility.ts@@ -18,7 +18,5 @@ export const resolveAcceptanceHistoryNavigation = (* every click answers "Acceptance not found"; deriving it from ownership alone* is what locked a workspace owner out of a teammate's delivery.*/-export const canReviewAcceptance = (- bundle?: { canReview?: boolean; isOwner?: boolean } | null,-) =>+export const canReviewAcceptance = (bundle?: { canReview?: boolean; isOwner?: boolean } | null) =>Boolean(bundle?.canReview);diff --git a/src/features/Acceptance/Workspace/MergeAcceptanceModal.tsx b/src/features/Acceptance/Workspace/MergeAcceptanceModal.tsxindex e22109e955e..716933f7680 100644--- a/src/features/Acceptance/Workspace/MergeAcceptanceModal.tsx+++ b/src/features/Acceptance/Workspace/MergeAcceptanceModal.tsx@@ -18,7 +18,7 @@ import { SkeletonList } from '@/features/NavPanel/components/SkeletonList';import type { AcceptanceListItem } from '@/services/verify';import { useAcceptanceList } from '../hooks';-import { frostedModalStyles } from '../Viewer/modals';+import { frostedModalStyles } from '../Viewer/Review/modals';/** A settled aggregate cannot receive checks — the server refuses it too. */const SETTLED_STATUSES = new Set(['accepted', 'closed']);diff --git a/src/features/Acceptance/index.ts b/src/features/Acceptance/index.tsindex aac4d7742cb..bef7cf6dcea 100644--- a/src/features/Acceptance/index.ts+++ b/src/features/Acceptance/index.ts@@ -20,18 +20,15 @@ export { default as CheckerDock } from './Run/CheckerDock';export { default as RunResult } from './Run/RunResult';export { checkDisplayTitle, countResults, isDraftUnconfirmed, phaseFromStatus } from './utils';export { default as AcceptanceViewer } from './Viewer';-export type { AcceptanceCheck, CheckReviewInput } from './Viewer/CheckList';-export {- AcceptanceCheckRow,- checkHeadMeta,- FocusedCheckDetails,- groupChecks,- shouldGroupChecks,-} from './Viewer/CheckList';+export { AcceptanceCheckRow } from './Viewer/Checks/CheckRow';+export { groupChecks, shouldGroupChecks } from './Viewer/Checks/checkState';+export { checkHeadMeta } from './Viewer/Checks/checkStatus';+export type { AcceptanceCheck, CheckReviewInput } from './Viewer/Checks/types';export {OriginConversationProvider,type OriginConversationSlot,type OriginTopicPanelProps,-} from './Viewer/originConversation';+} from './Viewer/Conversation/originConversation';+export { FocusedCheckDetails } from './Viewer/Focus/FocusedCheckDetails';export { default as AcceptanceWorkspace } from './Workspace';export { default as AcceptanceEmptyDetail } from './Workspace/EmptyDetail';diff --git a/src/features/AgentTasks/AgentTaskDetail/TaskAcceptance.test.tsx b/src/features/AgentTasks/AgentTaskDetail/TaskAcceptance.test.tsxindex 7ecb4249ffd..7728d552c7e 100644--- a/src/features/AgentTasks/AgentTaskDetail/TaskAcceptance.test.tsx+++ b/src/features/AgentTasks/AgentTaskDetail/TaskAcceptance.test.tsx@@ -118,13 +118,13 @@ vi.mock('@/features/Acceptance/Viewer/AcceptanceScope', () => ({),}));-vi.mock('@/features/Acceptance/Viewer/AcceptanceCheckInventory', () => ({+vi.mock('@/features/Acceptance/Viewer/Checks/AcceptanceCheckInventory', () => ({default: ({ toolbar }: { toolbar?: ReactNode }) => (<div data-testid="acceptance-check-inventory">{toolbar}</div>),}));-vi.mock('@/features/Acceptance/Viewer/AcceptanceDecision', () => ({+vi.mock('@/features/Acceptance/Viewer/Review/AcceptanceDecision', () => ({default: () => <div data-testid="acceptance-decision" />,}));diff --git a/src/features/AgentTasks/AgentTaskDetail/TaskAcceptance.tsx b/src/features/AgentTasks/AgentTaskDetail/TaskAcceptance.tsxindex e3d299a7fc4..cf02c0b8a68 100644--- a/src/features/AgentTasks/AgentTaskDetail/TaskAcceptance.tsx+++ b/src/features/AgentTasks/AgentTaskDetail/TaskAcceptance.tsx@@ -26,12 +26,12 @@ import {useAcceptanceBundle,useAcceptanceBySubject,} from '@/features/Acceptance';-import AcceptanceCheckInventory from '@/features/Acceptance/Viewer/AcceptanceCheckInventory';-import AcceptanceDecision from '@/features/Acceptance/Viewer/AcceptanceDecision';import {AcceptanceBundleGate,AcceptanceScope,} from '@/features/Acceptance/Viewer/AcceptanceScope';+import AcceptanceCheckInventory from '@/features/Acceptance/Viewer/Checks/AcceptanceCheckInventory';+import AcceptanceDecision from '@/features/Acceptance/Viewer/Review/AcceptanceDecision';import { usePermission } from '@/hooks/usePermission';import { verifyService } from '@/services/verify';import { useChatStore } from '@/store/chat';diff --git a/src/features/Portal/Acceptance/Body.test.tsx b/src/features/Portal/Acceptance/Body.test.tsxindex 572e8ef1682..6263e1b96e0 100644--- a/src/features/Portal/Acceptance/Body.test.tsx+++ b/src/features/Portal/Acceptance/Body.test.tsx@@ -40,7 +40,7 @@ vi.mock('@/features/Acceptance', () => ({OriginConversationProvider: ({ children }: { children?: React.ReactNode }) => children,}));-vi.mock('@/features/Acceptance/Viewer/TopicPanel', () => ({ default: () => null }));+vi.mock('@/features/Acceptance/Viewer/Conversation/TopicPanel', () => ({ default: () => null }));describe('Portal Acceptance Body — draftToComposer via the global bus', () => {beforeEach(() => {diff --git a/src/features/Portal/Acceptance/Body.tsx b/src/features/Portal/Acceptance/Body.tsxindex 8ca20b1506d..14c3f24d0ca 100644--- a/src/features/Portal/Acceptance/Body.tsx+++ b/src/features/Portal/Acceptance/Body.tsx@@ -1,7 +1,7 @@import { memo } from 'react';import { AcceptanceViewer, OriginConversationProvider } from '@/features/Acceptance';-import TopicPanel from '@/features/Acceptance/Viewer/TopicPanel';+import TopicPanel from '@/features/Acceptance/Viewer/Conversation/TopicPanel';import { draftToMainComposer } from '@/features/Conversation/composerDraftBus';import { useChatStore } from '@/store/chat';import { chatPortalSelectors } from '@/store/chat/selectors';diff --git a/src/routes/acceptance/[acceptanceId]/index.tsx b/src/routes/acceptance/[acceptanceId]/index.tsxindex fef719be37d..3dd6ef46e4f 100644--- a/src/routes/acceptance/[acceptanceId]/index.tsx+++ b/src/routes/acceptance/[acceptanceId]/index.tsx@@ -1,7 +1,7 @@'use client';import { AcceptanceViewer, OriginConversationProvider } from '@/features/Acceptance';-import TopicPanel from '@/features/Acceptance/Viewer/TopicPanel';+import TopicPanel from '@/features/Acceptance/Viewer/Conversation/TopicPanel';export default function AcceptanceRoute() {return (