🤯 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
✨ feat(project): sub-group agent topics and open acceptances as full pages (#21397)
LiJian7b9a9e9a172b
diff --git a/src/features/Acceptance/Viewer/Checks/AcceptanceCheckInventory.tsx b/src/features/Acceptance/Viewer/Checks/AcceptanceCheckInventory.tsxindex 2b1af2d31d4..f00ae952198 100644--- a/src/features/Acceptance/Viewer/Checks/AcceptanceCheckInventory.tsx+++ b/src/features/Acceptance/Viewer/Checks/AcceptanceCheckInventory.tsx@@ -24,7 +24,7 @@ import { verifyService } from '@/services/verify';import { useAcceptanceScope } from '../AcceptanceScope';import { hasVisualEvidence } from '../Evidence/evidence';import AcceptanceInteractionCost from '../History/AcceptanceInteractionCost';-import { acceptanceCheckPath } from '../routes';+import { acceptanceCheckPath, useAcceptanceRouteBase } from '../routes';import { checksForTurn } from '../turnChecks';import { useAcceptanceBundle } from '../useAcceptanceBundle';import { useAcceptanceTurn } from '../useAcceptanceTurn';@@ -78,6 +78,7 @@ const AcceptanceCheckInventory = ({const { t } = useTranslation('verify');const { md = true } = useResponsive();const { acceptanceId, embedded } = useAcceptanceScope();+ const routeBase = useAcceptanceRouteBase();const { data, mutate } = useAcceptanceBundle(acceptanceId);const navigate = useNavigate();const [searchParams, setSearchParams] = useSearchParams();@@ -216,7 +217,8 @@ const AcceptanceCheckInventory = ({!md && !embedded? (id: string) =>navigate(- acceptanceCheckPath(acceptanceId, id) + (searchParams.size ? `?${searchParams}` : ''),+ acceptanceCheckPath(acceptanceId, id, routeBase) ++ (searchParams.size ? `?${searchParams}` : ''),{state: { fromCheckList: true },},diff --git a/src/features/Acceptance/Viewer/Comments/DiscussionEntries.tsx b/src/features/Acceptance/Viewer/Comments/DiscussionEntries.tsxindex dd2e5ba0abe..8ba274a4553 100644--- a/src/features/Acceptance/Viewer/Comments/DiscussionEntries.tsx+++ b/src/features/Acceptance/Viewer/Comments/DiscussionEntries.tsx@@ -11,7 +11,7 @@ import { checkDisplayTitle } from '../../utils';import { useAcceptanceScope } from '../AcceptanceScope';import { collectEvidenceById } from '../Checks/CheckHistory';import type { AcceptanceCheck } from '../Checks/types';-import { acceptanceCheckPath } from '../routes';+import { acceptanceCheckPath, useAcceptanceRouteBase } from '../routes';import { commentAnchorId } from './anchor';import CommentCard, { commentAuthorName, CommentAvatar } from './CommentCard';import CommentThread from './CommentThread';@@ -126,11 +126,15 @@ TimelineMessage.displayName = 'AcceptanceTimelineMessage';export const CheckReference = memo<{ check?: AcceptanceCheck }>(({ check }) => {const { t } = useTranslation('verify');const { acceptanceId, embedded } = useAcceptanceScope();+ const routeBase = useAcceptanceRouteBase();if (!check) return null;const label = `C${check.seq} · ${checkDisplayTitle(check.title, t('acceptance.checks.holisticTitle'))}`;if (embedded) return <span className={entryStyles.checkLink}>{label}</span>;return (- <Link className={entryStyles.checkLink} to={acceptanceCheckPath(acceptanceId, check.id)}>+ <Link+ className={entryStyles.checkLink}+ to={acceptanceCheckPath(acceptanceId, check.id, routeBase)}+ >{label}</Link>);diff --git a/src/features/Acceptance/Viewer/Focus/AcceptanceEnterFocus.tsx b/src/features/Acceptance/Viewer/Focus/AcceptanceEnterFocus.tsxindex 366c7bc2b7e..627aa0c0039 100644--- a/src/features/Acceptance/Viewer/Focus/AcceptanceEnterFocus.tsx+++ b/src/features/Acceptance/Viewer/Focus/AcceptanceEnterFocus.tsx@@ -6,7 +6,7 @@ import { useTranslation } from 'react-i18next';import { useNavigate, useSearchParams } from 'react-router';import { useAcceptanceScope } from '../AcceptanceScope';-import { acceptanceCheckPath } from '../routes';+import { acceptanceCheckPath, useAcceptanceRouteBase } from '../routes';import { checksForTurn } from '../turnChecks';import { useAcceptanceBundle } from '../useAcceptanceBundle';import { readAcceptanceTurn } from '../useAcceptanceTurn';@@ -24,6 +24,7 @@ const AcceptanceEnterFocus = () => {const navigate = useNavigate();const [params] = useSearchParams();const { acceptanceId, embedded } = useAcceptanceScope();+ const routeBase = useAcceptanceRouteBase();const { data } = useAcceptanceBundle(acceptanceId);const checks = data ? checksForTurn(data, readAcceptanceTurn(params)) : [];if (embedded || !data || checks.length === 0) return null;@@ -37,7 +38,8 @@ const AcceptanceEnterFocus = () => {type={'text'}onClick={() =>navigate(- acceptanceCheckPath(acceptanceId, checks[0]!.id) + (params.size ? `?${params}` : ''),+ acceptanceCheckPath(acceptanceId, checks[0]!.id, routeBase) ++ (params.size ? `?${params}` : ''),{ replace: true },)}diff --git a/src/features/Acceptance/Viewer/Focus/AcceptanceFocusWorkspace.tsx b/src/features/Acceptance/Viewer/Focus/AcceptanceFocusWorkspace.tsxindex 2c102912557..6d4c88b4f04 100644--- a/src/features/Acceptance/Viewer/Focus/AcceptanceFocusWorkspace.tsx+++ b/src/features/Acceptance/Viewer/Focus/AcceptanceFocusWorkspace.tsx@@ -10,7 +10,7 @@ import { verifyService } from '@/services/verify';import { useAcceptanceScope } from '../AcceptanceScope';import { openAddCheckModal } from '../Checks/AddCheckModal';-import { acceptanceCheckPath, acceptanceOverviewPath } from '../routes';+import { acceptanceCheckPath, acceptanceOverviewPath, useAcceptanceRouteBase } from '../routes';import { checksForTurn } from '../turnChecks';import { useAcceptanceBundle } from '../useAcceptanceBundle';import { useAcceptanceTurn } from '../useAcceptanceTurn';@@ -25,6 +25,7 @@ const AcceptanceFocusWorkspace = () => {const query = searchParams.toString() ? `?${searchParams}` : '';const params = useParams<{ checkId?: string }>();const { acceptanceId } = useAcceptanceScope();+ const routeBase = useAcceptanceRouteBase();const { data, mutate } = useAcceptanceBundle(acceptanceId);const { turn } = useAcceptanceTurn();const turnChecks = data ? checksForTurn(data, turn) : [];@@ -62,12 +63,12 @@ const AcceptanceFocusWorkspace = () => {onBack={() =>(location.state as { fromCheckList?: boolean } | null)?.fromCheckList? navigate(-1)- : navigate(acceptanceOverviewPath(acceptanceId) + query, { replace: true })+ : navigate(acceptanceOverviewPath(acceptanceId, routeBase) + query, { replace: true })}// Stepping between checks replaces the entry in place, carrying the// "came from the list" flag so the back arrow still knows where to land.onSelectCheck={(id) =>- navigate(acceptanceCheckPath(acceptanceId, id) + query, {+ navigate(acceptanceCheckPath(acceptanceId, id, routeBase) + query, {replace: true,state: location.state,})diff --git a/src/features/Acceptance/Viewer/Review/AcceptanceDecision.tsx b/src/features/Acceptance/Viewer/Review/AcceptanceDecision.tsxindex 0b18875812b..3fe0f4ed3b1 100644--- a/src/features/Acceptance/Viewer/Review/AcceptanceDecision.tsx+++ b/src/features/Acceptance/Viewer/Review/AcceptanceDecision.tsx@@ -16,7 +16,7 @@ import { useAcceptanceScope } from '../AcceptanceScope';import { checkFilterState, isException } from '../Checks/checkState';import { useAcceptanceComments } from '../Comments/hooks';import { flowPlanPhase } from '../Plan/planReview';-import { acceptanceCheckPath } from '../routes';+import { acceptanceCheckPath, useAcceptanceRouteBase } from '../routes';import { useAcceptanceBundle } from '../useAcceptanceBundle';import { useAcceptanceTurn } from '../useAcceptanceTurn';import { formatAcceptanceCountsText, LIVE_ACCEPTANCE_STATUSES } from '../verdict';@@ -36,6 +36,7 @@ const AcceptanceDecision = ({ onDraftToComposer }: AcceptanceDecisionProps) => {const navigate = useNavigate();const hydrated = useIsHydrated();const { acceptanceId, embedded } = useAcceptanceScope();+ const routeBase = useAcceptanceRouteBase();const { data, mutate } = useAcceptanceBundle(acceptanceId);const { turn, setTurn } = useAcceptanceTurn(embedded);const [pending, setPending] = useState(false);@@ -305,7 +306,7 @@ const AcceptanceDecision = ({ onDraftToComposer }: AcceptanceDecisionProps) => {onJumpToCheck={(checkId) => {setFeedbackOpen(false);if (!embedded) {- navigate(acceptanceCheckPath(acceptanceId, checkId));+ navigate(acceptanceCheckPath(acceptanceId, checkId, routeBase));return;}setTimeout(() => {diff --git a/src/features/Acceptance/Viewer/routes.test.ts b/src/features/Acceptance/Viewer/routes.test.tsindex f2ebaa45d27..342cbab6c07 100644--- a/src/features/Acceptance/Viewer/routes.test.ts+++ b/src/features/Acceptance/Viewer/routes.test.ts@@ -1,6 +1,11 @@import { describe, expect, it } from 'vitest';-import { acceptanceCheckPath, acceptanceHomePath, acceptanceOverviewPath } from './routes';+import {+ acceptanceCheckPath,+ acceptanceHomePath,+ acceptanceListPath,+ acceptanceOverviewPath,+} from './routes';describe('acceptance routes', () => {it('returns from the acceptance workspace to home', () => {@@ -16,4 +21,12 @@ describe('acceptance routes', () => {'/acceptance/acceptance%2F1/check/check%2F1',);});++ it('keeps a project section base so opening a record stays inside the project', () => {+ const base = '/team-x/project/prj_1/acceptance';++ expect(acceptanceListPath(base)).toBe(base);+ expect(acceptanceOverviewPath('acc-1', base)).toBe(`${base}/acc-1`);+ expect(acceptanceCheckPath('acc-1', 'chk-1', base)).toBe(`${base}/acc-1/check/chk-1`);+ });});diff --git a/src/features/Acceptance/Viewer/routes.ts b/src/features/Acceptance/Viewer/routes.tsindex 807f95ef386..f458f6c1884 100644--- a/src/features/Acceptance/Viewer/routes.ts+++ b/src/features/Acceptance/Viewer/routes.ts@@ -1,9 +1,26 @@+import { createContext, use } from 'react';++/** The standalone acceptance pages; a project mounts the same pages under its own section. */+export const ACCEPTANCE_ROUTE_BASE = '/acceptance';+export const acceptanceHomePath = () => '/';-export const acceptanceListPath = () => '/acceptance';+export const acceptanceListPath = (base = ACCEPTANCE_ROUTE_BASE) => base;++export const acceptanceOverviewPath = (acceptanceId: string, base = ACCEPTANCE_ROUTE_BASE) =>+ `${base}/${encodeURIComponent(acceptanceId)}`;++export const acceptanceCheckPath = (+ acceptanceId: string,+ checkId: string,+ base = ACCEPTANCE_ROUTE_BASE,+) => `${acceptanceOverviewPath(acceptanceId, base)}/check/${encodeURIComponent(checkId)}`;-export const acceptanceOverviewPath = (acceptanceId: string) =>- `/acceptance/${encodeURIComponent(acceptanceId)}`;+/**+ * Where the acceptance pages of this tree live. A project's acceptance section+ * provides its own base so opening a record or a check stays inside the+ * project instead of jumping to the standalone (web-only) `/acceptance`.+ */+export const AcceptanceRouteBaseContext = createContext(ACCEPTANCE_ROUTE_BASE);-export const acceptanceCheckPath = (acceptanceId: string, checkId: string) =>- `${acceptanceOverviewPath(acceptanceId)}/check/${encodeURIComponent(checkId)}`;+export const useAcceptanceRouteBase = () => use(AcceptanceRouteBaseContext);diff --git a/src/features/Acceptance/Workspace/AcceptanceListPanel.tsx b/src/features/Acceptance/Workspace/AcceptanceListPanel.tsxindex 9ec453ce41e..6ea5bc67032 100644--- a/src/features/Acceptance/Workspace/AcceptanceListPanel.tsx+++ b/src/features/Acceptance/Workspace/AcceptanceListPanel.tsx@@ -46,7 +46,7 @@ import { systemStatusSelectors } from '@/store/global/selectors';import { useVerifyStore } from '@/store/verify';import { useAcceptanceList, useAcceptanceListInfinite } from '../hooks';-import { acceptanceHomePath } from '../Viewer/routes';+import { acceptanceHomePath, useAcceptanceRouteBase } from '../Viewer/routes';import type { AcceptanceStatusAction } from '../Viewer/statusActions';import AcceptanceBatchBar from './AcceptanceBatchBar';import { openAcceptanceDeleteConfirm } from './AcceptanceDeleteConfirm';@@ -81,7 +81,7 @@ import {expandedAcceptanceGroupKeys,groupAcceptanceList,nextCollapsedGroupKeys,- normalizeAcceptanceGroupMode,+ resolveAcceptanceGroupMode,shouldRenderAcceptanceGroups,} from './groupAcceptanceList';import { useAcceptanceListFilterMenu } from './useAcceptanceListFilterMenu';@@ -304,6 +304,7 @@ const AcceptanceListPanel = memo<AcceptanceListPanelProps>(({ expand, headerLeading, hosted, isNarrow, projectActionItems, projectId, setExpand }) => {const { t } = useTranslation('verify');const navigate = useNavigate();+ const routeBase = useAcceptanceRouteBase();const { acceptanceId } = useParams<{ acceptanceId: string }>();const [query, setQuery] = useState('');@@ -336,7 +337,7 @@ const AcceptanceListPanel = memo<AcceptanceListPanelProps>(source,} = effectiveAcceptanceListFacets(facets, projectId);const listQuery = { projectId: listProjectId, scope, source };- const groupMode = normalizeAcceptanceGroupMode(storedGroupMode);+ const groupMode = resolveAcceptanceGroupMode(storedGroupMode, projectId);const debouncedQuery = useDebounce(query.trim(), { wait: 300 });const trimmedQuery = query.trim();const searching = Boolean(debouncedQuery);@@ -605,7 +606,12 @@ const AcceptanceListPanel = memo<AcceptanceListPanelProps>(// The open acceptance just stopped existing — leave its dead route// rather than letting the detail pane render a 404.- const redirect = acceptanceRedirectAfterDelete(acceptanceId, targets, failedIds);+ const redirect = acceptanceRedirectAfterDelete(+ acceptanceId,+ targets,+ failedIds,+ routeBase,+ );if (redirect) navigate(redirect, { replace: true });await settleBatch(targets, [], failedIds);reportBatch(deleted, targets.length, 'acceptance.workspace.batch.deleteSuccess');@@ -618,7 +624,8 @@ const AcceptanceListPanel = memo<AcceptanceListPanelProps>(// Grouping by project already names it in the header; every other mode has// to carry it on the row or the affiliation is simply not on screen.- const showRowProject = groupMode !== 'project';+ // Inside a project every row belongs to it, so naming the project again is noise.+ const showRowProject = !projectId && groupMode !== 'project';const orderedIds = (showGroups ? groups.flatMap((group) => group.items) : items).filter((item) => item.canManage)diff --git a/src/features/Acceptance/Workspace/AcceptanceRow.tsx b/src/features/Acceptance/Workspace/AcceptanceRow.tsxindex 0e8bdd8827b..ef090204bcc 100644--- a/src/features/Acceptance/Workspace/AcceptanceRow.tsx+++ b/src/features/Acceptance/Workspace/AcceptanceRow.tsx@@ -39,7 +39,11 @@ import type { AcceptanceListItem } from '@/services/verify';import { verifyService } from '@/services/verify';import { useVerifyStore } from '@/store/verify';-import { acceptanceListPath } from '../Viewer/routes';+import {+ acceptanceListPath,+ acceptanceOverviewPath,+ useAcceptanceRouteBase,+} from '../Viewer/routes';import { getAcceptanceStatusActions } from '../Viewer/statusActions';import { openAcceptanceDeleteConfirm } from './AcceptanceDeleteConfirm';import { openMergeAcceptanceModal } from './MergeAcceptanceModal';@@ -126,6 +130,7 @@ const AcceptanceRow = memo<{}>(({ active, item, onChanged, onToggleSelect, selectable, selected, showProject }) => {const { t } = useTranslation('verify');const navigate = useNavigate();+ const routeBase = useAcceptanceRouteBase();const [mutating, setMutating] = useState(false);const glyph = glyphOf(item.status as AcceptanceStatus);@@ -218,7 +223,7 @@ const AcceptanceRow = memo<{setMutating(true);try {const summary = await verifyService.mergeAcceptance(item.id, targetId);- if (active) navigate(`/acceptance/${targetId}`, { replace: true });+ if (active) navigate(acceptanceOverviewPath(targetId, routeBase), { replace: true });await Promise.all([onChanged(),useVerifyStore.getState().refreshAcceptanceBundle(targetId),@@ -244,7 +249,7 @@ const AcceptanceRow = memo<{setMutating(true);try {await verifyService.deleteAcceptance(item.id, purge);- if (active) navigate(acceptanceListPath(), { replace: true });+ if (active) navigate(acceptanceListPath(routeBase), { replace: true });await onChanged();toast.success(t('acceptance.workspace.deleteSuccess'));} finally {@@ -399,7 +404,7 @@ const AcceptanceRow = memo<{onToggleSelect(e.shiftKey);return;}- navigate(`/acceptance/${item.id}`);+ navigate(acceptanceOverviewPath(item.id, routeBase));}}/>);diff --git a/src/features/Acceptance/Workspace/batchSelection.ts b/src/features/Acceptance/Workspace/batchSelection.tsindex 21b07a8f3c1..987b8306197 100644--- a/src/features/Acceptance/Workspace/batchSelection.ts+++ b/src/features/Acceptance/Workspace/batchSelection.ts@@ -141,7 +141,8 @@ export const acceptanceRedirectAfterDelete = (openId: string | undefined,targets: string[],failedIds: string[],+ routeBase?: string,): string | undefined =>openId && targets.includes(openId) && !failedIds.includes(openId)- ? acceptanceListPath()+ ? acceptanceListPath(routeBase): undefined;diff --git a/src/features/Acceptance/Workspace/groupAcceptanceList.test.ts b/src/features/Acceptance/Workspace/groupAcceptanceList.test.tsindex 3854eaa803e..0ef48f92a16 100644--- a/src/features/Acceptance/Workspace/groupAcceptanceList.test.ts+++ b/src/features/Acceptance/Workspace/groupAcceptanceList.test.ts@@ -8,6 +8,7 @@ import {hasProjectAcceptanceGroups,nextCollapsedGroupKeys,normalizeAcceptanceGroupMode,+ resolveAcceptanceGroupMode,shouldRenderAcceptanceGroups,} from './groupAcceptanceList';@@ -148,6 +149,18 @@ describe('normalizeAcceptanceGroupMode', () => {});});+describe('resolveAcceptanceGroupMode', () => {+ it('shows a project-hosted list flat instead of under one header naming the project', () => {+ expect(resolveAcceptanceGroupMode('project', 'prj_1')).toBe('none');+ expect(resolveAcceptanceGroupMode(undefined, 'prj_1')).toBe('none');+ expect(resolveAcceptanceGroupMode('time', 'prj_1')).toBe('time');+ });++ it('keeps project grouping on the standalone list', () => {+ expect(resolveAcceptanceGroupMode('project')).toBe('project');+ });+});+describe('accordion expansion state', () => {it('keeps a group that appears after mount expanded, and remembers manual collapses', () => {const groups = groupAcceptanceList([diff --git a/src/features/Acceptance/Workspace/groupAcceptanceList.ts b/src/features/Acceptance/Workspace/groupAcceptanceList.tsindex bd937e08487..3bda87a4a5a 100644--- a/src/features/Acceptance/Workspace/groupAcceptanceList.ts+++ b/src/features/Acceptance/Workspace/groupAcceptanceList.ts@@ -13,6 +13,18 @@ export const normalizeAcceptanceGroupMode = (value: unknown): AcceptanceGroupMod? value: DEFAULT_ACCEPTANCE_GROUP_MODE;+/**+ * Inside a project page every row belongs to that project, so project grouping+ * would wrap the list in one header naming the page itself — show it flat.+ */+export const resolveAcceptanceGroupMode = (+ value: unknown,+ hostProjectId?: string,+): AcceptanceGroupMode => {+ const mode = normalizeAcceptanceGroupMode(value);+ return hostProjectId && mode === 'project' ? 'none' : mode;+};+export interface AcceptanceListGroup {items: AcceptanceListItem[];key: string;diff --git a/src/features/Acceptance/Workspace/useAcceptanceListFilterMenu.tsx b/src/features/Acceptance/Workspace/useAcceptanceListFilterMenu.tsxindex 5a51fb8b84a..54ec284dddd 100644--- a/src/features/Acceptance/Workspace/useAcceptanceListFilterMenu.tsx+++ b/src/features/Acceptance/Workspace/useAcceptanceListFilterMenu.tsx@@ -171,12 +171,15 @@ export const useAcceptanceListFilterMenu = ({['time', t('acceptance.workspace.groups.byTime')],['none', t('acceptance.workspace.groups.byNone')],] as const- ).map(([key, label]) => ({- icon: checkIcon(groupMode === key),- key,- label,- onClick: () => setGroupMode(key),- })),+ )+ // Inside a project page the project is the page itself.+ .filter(([key]) => !hostProjectId || key !== 'project')+ .map(([key, label]) => ({+ icon: checkIcon(groupMode === key),+ key,+ label,+ onClick: () => setGroupMode(key),+ })),icon: <Icon icon={Group} />,key: 'group-mode',label: t('acceptance.workspace.groups.mode'),diff --git a/src/features/Acceptance/index.ts b/src/features/Acceptance/index.tsindex 8ebc3578b35..e626d0cd284 100644--- a/src/features/Acceptance/index.ts+++ b/src/features/Acceptance/index.ts@@ -30,5 +30,13 @@ export {type OriginTopicPanelProps,} from './Viewer/Conversation/originConversation';export { FocusedCheckDetails } from './Viewer/Focus/FocusedCheckDetails';+export {+ acceptanceListPath,+ acceptanceOverviewPath,+ AcceptanceRouteBaseContext,+ useAcceptanceRouteBase,+} from './Viewer/routes';export { default as AcceptanceWorkspace } from './Workspace';+export { default as AcceptanceListPanel } from './Workspace/AcceptanceListPanel';+export { useAcceptanceProjectActionItems } from './Workspace/AcceptanceProjectActions';export { default as AcceptanceEmptyDetail } from './Workspace/EmptyDetail';diff --git a/src/features/AgentSidebar/Topic/TopicListContent/ByAgentMode/GroupItem.test.tsx b/src/features/AgentSidebar/Topic/TopicListContent/ByAgentMode/GroupItem.test.tsxindex 3e96cf5f0ba..8534f0041b2 100644--- a/src/features/AgentSidebar/Topic/TopicListContent/ByAgentMode/GroupItem.test.tsx+++ b/src/features/AgentSidebar/Topic/TopicListContent/ByAgentMode/GroupItem.test.tsx@@ -3,11 +3,13 @@*/import { AccordionRoot } from '@lobehub/ui';import { render, screen } from '@testing-library/react';-import { describe, expect, it, vi } from 'vitest';+import { beforeEach, describe, expect, it, vi } from 'vitest';import { TopicListScopeContext } from '../../TopicListScope';import GroupItem from './GroupItem';+const subGroupModes: Record<string, string> = {};+vi.mock('@/store/agent', () => ({useAgentStore: (selector: (state: unknown) => unknown) => selector({ activeAgentId: 'agent-1' }),}));@@ -19,11 +21,72 @@ vi.mock('@/store/agent/selectors', () => ({},}));+vi.mock('@/store/global', () => ({+ useGlobalStore: (selector: (state: unknown) => unknown) =>+ selector({ updateSystemStatus: vi.fn() }),+}));++vi.mock('@/store/global/selectors', () => ({+ systemStatusSelectors: {+ projectTopicSubGroupMode: (id: string) => () => subGroupModes[id] ?? 'none',+ },+}));++const directories: { deviceId: string; id: string; instanceId?: string }[] = [];++vi.mock('@/store/projectWorkingDirectory', () => ({+ useProjectDirectories: () => directories,+}));++vi.mock('@/features/Projects/WorkingDirectories/StartDirectoryModal', () => ({+ openProjectTopicModal: vi.fn(),+}));++vi.mock('@/store/device', () => ({+ deviceSelectors: { deviceList: (s: { devices: unknown[] }) => s.devices },+ useDeviceStore: (selector: (state: object) => unknown) =>+ selector({+ devices: [+ { deviceId: 'device-1', friendlyName: 'MacBook' },+ { deviceId: 'device-2', friendlyName: 'Studio Linux' },+ ],+ useFetchDevices: () => ({}),+ }),+}));++vi.mock('@/store/user', () => ({+ useUserStore: (selector: (state: object) => unknown) => selector({}),+}));+vi.mock('@/store/user/selectors', () => ({+ preferenceSelectors: { topicSortBy: () => 'updatedAt' },+}));++vi.mock('@/store/chat', () => ({+ useChatStore: (selector: (state: object) => unknown) => selector({}),+}));+vi.mock('@/store/chat/selectors', () => ({+ operationSelectors: {+ unreadCompletedCountForTopics: () => () => 0,+ visiblyRunningTopicIds: () => new Set(),+ },+}));++vi.mock('@/components/RingLoading', () => ({ default: () => <span /> }));+// Capture what the group hands each row: by-agent buckets are named in the-// group header, so rows must not render a second leading agent avatar.+// group header, and the whole list already sits inside one project.vi.mock('../../List/Item', () => ({- default: (props: { suppressAgentAvatar?: boolean; title: string }) => (- <div data-suppress={props.suppressAgentAvatar ? 'yes' : 'no'}>{props.title}</div>+ default: (props: {+ showWorkingDirectory?: boolean;+ suppressAgentAvatar?: boolean;+ title: string;+ }) => (+ <div+ data-directory={props.showWorkingDirectory ? 'yes' : 'no'}+ data-suppress={props.suppressAgentAvatar ? 'yes' : 'no'}+ >+ {props.title}+ </div>),}));@@ -32,34 +95,94 @@ vi.mock('@lobehub/ui', async (importOriginal) => ({...(await import('~base-ui-stubs')).baseUiStubs,}));-vi.mock('@/store/projectWorkingDirectory', () => ({ useProjectDirectories: () => [] }));-vi.mock('react-i18next', () => ({useTranslation: () => ({ t: (key: string) => key }),}));-describe('TopicByAgentGroupItem', () => {- /** @example Review feedback: rows under an agent-named bucket must not repeat the avatar. */- it('suppresses the row leading agent avatar because the group header already identifies the agent', () => {- // ROOT CAUSE: the by-agent grouping named every bucket after its agent,- // but each row still rendered the same avatar at its leading position —- // the same identity twice in one row.- render(- <AccordionRoot defaultValue={['agent:agt_acc_merge_alpha']}>+const GROUP_ID = 'agent:agt_acc_merge_alpha';++const renderGroup = () =>+ render(+ <TopicListScopeContext value={{ projectId: 'project-1' }}>+ <AccordionRoot defaultValue={[GROUP_ID]}><GroupItemexpandedgroup={{- children: [{ createdAt: 1, id: 't1', title: 'A1-目录A任务', updatedAt: 1 }],- id: 'agent:agt_acc_merge_alpha',+ children: [+ {+ createdAt: 1,+ id: 't1',+ projectWorkingDirectoryId: 'binding-mac',+ title: 'A1-目录A任务',+ updatedAt: 1,+ },+ {+ createdAt: 2,+ id: 't2',+ projectWorkingDirectoryId: 'binding-linux',+ title: 'A2-目录B任务',+ updatedAt: 2,+ },+ ],+ id: GROUP_ID,title: '验收合并-Alpha',}}/>- </AccordionRoot>,+ </AccordionRoot>+ </TopicListScopeContext>,+ );++describe('TopicByAgentGroupItem', () => {+ beforeEach(() => {+ for (const key of Object.keys(subGroupModes)) delete subGroupModes[key];+ directories.splice(+ 0,+ directories.length,+ { deviceId: 'device-1', id: 'binding-mac' },+ { deviceId: 'device-2', id: 'binding-linux' },);+ });++ /** @example Review feedback: rows under an agent-named bucket must not repeat the avatar. */+ it('suppresses the row leading agent avatar because the group header already identifies the agent', () => {+ // ROOT CAUSE: the by-agent grouping named every bucket after its agent,+ // but each row still rendered the same avatar at its leading position —+ // the same identity twice in one row.+ renderGroup();++ expect(screen.getByText('A1-目录A任务').getAttribute('data-suppress')).toBe('yes');+ });++ /** @example User report: project sidebar rows repeated "develop-center · branch" on every topic. */+ it('does not repeat the working directory on rows that already sit inside the project', () => {+ renderGroup();+ expect(screen.getByText('A1-目录A任务').getAttribute('data-directory')).toBe('no');+ expect(screen.getByText('A2-目录B任务').getAttribute('data-directory')).toBe('no');+ });++ it('offers a second-level grouping and sections the agent topics by device', () => {+ subGroupModes[GROUP_ID] = 'byDevice';+ renderGroup();++ expect(screen.getByRole('button', { name: 'topics.subGroup.title' })).toBeTruthy();+ expect(screen.getByRole('button', { name: 'MacBook' })).toBeTruthy();+ expect(screen.getByRole('button', { name: 'Studio Linux' })).toBeTruthy();expect(screen.getByText('A1-目录A任务').getAttribute('data-suppress')).toBe('yes');});+ /** @example Acceptance: a device without an environment opened the modal on a raw directory id. */+ it('offers a device section "+" only where that device has an instance-bound directory', () => {+ // ROOT CAUSE: the section "+" preselected any project directory on the+ // device, but the new-topic modal only lists instance-bound directories,+ // so a legacy directory opened with an unselectable raw id.+ subGroupModes[GROUP_ID] = 'byDevice';+ directories[0] = { ...directories[0], instanceId: 'ins-mac' };+ renderGroup();++ expect(screen.getAllByRole('button', { name: 'directories.start' })).toHaveLength(1);+ });+const renderInProject = (agentId: string) =>render(<TopicListScopeContext value={{ coordinatorAgentId: 'agt_lead', projectId: 'prj_1' }}>diff --git a/src/features/AgentSidebar/Topic/TopicListContent/ByAgentMode/GroupItem.tsx b/src/features/AgentSidebar/Topic/TopicListContent/ByAgentMode/GroupItem.tsxindex f61af791a1d..9b83680664a 100644--- a/src/features/AgentSidebar/Topic/TopicListContent/ByAgentMode/GroupItem.tsx+++ b/src/features/AgentSidebar/Topic/TopicListContent/ByAgentMode/GroupItem.tsx@@ -11,26 +11,33 @@ import {createStaticStyles,cssVar,cx,+ type DropdownItem,+ DropdownMenu,Flexbox,+ Icon,Tag,Text,} from '@lobehub/ui';import isEqual from 'fast-deep-equal';-import { PlusIcon } from 'lucide-react';-import { memo } from 'react';+import { ListFilter, LucideCheck, PlusIcon } from 'lucide-react';+import { memo, useMemo } from 'react';import { useTranslation } from 'react-i18next';import Avatar from '@/components/Avatar';import { openProjectTopicModal } from '@/features/Projects/WorkingDirectories/StartDirectoryModal';import { useAgentStore } from '@/store/agent';import { agentSelectors } from '@/store/agent/selectors';+import { useGlobalStore } from '@/store/global';+import { type ProjectTopicSubGroupMode } from '@/store/global/initialState';+import { systemStatusSelectors } from '@/store/global/selectors';import { useProjectDirectories } from '@/store/projectWorkingDirectory';-import TopicItem from '../../List/Item';import { useTopicListScope } from '../../TopicListScope';+import ProjectTopicList from '../ByProjectMode/ProjectTopicList';import { type GroupItemComponentProps } from '../GroupedAccordion';const AGENT_GROUP_PREFIX = 'agent:';+const SUB_GROUP_MODES: ProjectTopicSubGroupMode[] = ['none', 'byDevice', 'byTime', 'byStatus'];const styles = createStaticStyles(({ css }) => ({avatarWrap: css`@@ -88,17 +95,49 @@ const GroupItem = memo<GroupItemComponentProps>(({ group }) => {// Only an attributed bucket in a project-scoped list can start a topic with// its agent preselected; the `no-agent` bucket has no agent to preselect.const canAddTopic = !!scope && !!agentId;- const handleAddTopic = () => {+ // The new-topic modal's picker only lists instance-bound directories; a+ // device section offering any other directory would open with an unselectable+ // work location, so its "+" only considers instance-bound ones.+ const startDirectories = useMemo(+ () => (canAddTopic ? directories.filter((directory) => directory.instanceId) : undefined),+ [canAddTopic, directories],+ );++ const handleAddTopic = (initialDirectoryId?: string) => {if (!scope || !agentId) return;openProjectTopicModal({coordinatorAgentId: scope.coordinatorAgentId ?? agentId,directories,initialAgentId: agentId,+ initialDirectoryId,projectId: scope.projectId,title: tProject('sidebar.newConversation'),});};+ // The agent bucket already sits inside one project, so its rows skip the+ // directory line; a second-level split (device / time / status) is what+ // tells the topics apart. Same per-group preference as the project rows.+ const storedSubGroupMode = useGlobalStore(systemStatusSelectors.projectTopicSubGroupMode(id));+ const subGroupMode = SUB_GROUP_MODES.includes(storedSubGroupMode) ? storedSubGroupMode : 'none';+ const updateSystemStatus = useGlobalStore((s) => s.updateSystemStatus);+ const subGroupMenuItems = useMemo<DropdownItem[]>(+ () => [+ {+ children: SUB_GROUP_MODES.map((mode) => ({+ icon: subGroupMode === mode ? <Icon icon={LucideCheck} /> : <div />,+ key: `sub-group-${mode}`,+ label: tProject(`topics.subGroup.${mode}`),+ onClick: () => updateSystemStatus({ projectTopicSubGroupModeByGroup: { [id]: mode } }),+ })),+ key: 'sub-group',+ label: tProject('topics.subGroup.title'),+ type: 'group',+ },+ ],+ [id, subGroupMode, tProject, updateSystemStatus],+ );+return (<AccordionItem value={id}><AccordionHeader>@@ -117,45 +156,46 @@ const GroupItem = memo<GroupItemComponentProps>(({ group }) => {)}</Flexbox></AccordionTrigger>- {canAddTopic && (- <div- className={cx(- 'accordion-action',- accordionStyles.action,- accordionStyles.actionBorderless,+ <div+ className={cx(+ 'accordion-action',+ accordionStyles.action,+ accordionStyles.actionBorderless,+ )}+ >+ <Flexbox horizontal align={'center'} gap={4}>+ <DropdownMenu items={subGroupMenuItems}>+ <ActionIcon+ icon={ListFilter}+ size={'small'}+ title={tProject('topics.subGroup.title')}+ onClick={(e) => e.stopPropagation()}+ />+ </DropdownMenu>+ {canAddTopic && (+ <ActionIcon+ icon={PlusIcon}+ size={'small'}+ title={tProject('sidebar.newConversation')}+ onClick={(e) => {+ e.stopPropagation();+ handleAddTopic();+ }}+ />)}- >- <ActionIcon- icon={PlusIcon}- size={'small'}- title={tProject('sidebar.newConversation')}- onClick={(e) => {- e.stopPropagation();- handleAddTopic();- }}- />- </div>- )}+ </Flexbox>+ </div></AccordionHeader><AccordionPanel contentStyle={{ padding: 0 }}>- <Flexbox gap={1} paddingBlock={1}>- {children.map((topic) => (- <TopicItem- // The group header already names the owning agent — the row- // must not repeat the avatar at its leading position.- showWorkingDirectory- suppressAgentAvatar- fav={topic.favorite}- id={topic.id}- key={topic.id}- metadata={topic.metadata}- runStartedAt={topic.runStartedAt}- status={topic.status}- title={topic.title}- userId={topic.userId}- />- ))}- </Flexbox>+ <ProjectTopicList+ // The group header already names the owning agent — the row must not+ // repeat the avatar at its leading position.+ suppressAgentAvatar+ mode={subGroupMode}+ startDirectories={startDirectories}+ topics={children}+ onStartInDirectory={canAddTopic ? handleAddTopic : undefined}+ /></AccordionPanel></AccordionItem>);diff --git a/src/features/AgentSidebar/Topic/TopicListContent/ByProjectMode/ProjectTopicList.tsx b/src/features/AgentSidebar/Topic/TopicListContent/ByProjectMode/ProjectTopicList.tsxindex b2f3fe1d6bd..62924e02dab 100644--- a/src/features/AgentSidebar/Topic/TopicListContent/ByProjectMode/ProjectTopicList.tsx+++ b/src/features/AgentSidebar/Topic/TopicListContent/ByProjectMode/ProjectTopicList.tsx@@ -47,7 +47,7 @@ const STATUS_ICON: Record<string, ExecutionStatusVisual> = {...TOPIC_GROUP_VISUALS,};-const renderTopic = (topic: ChatTopic) => (+const renderTopic = (topic: ChatTopic, suppressAgentAvatar?: boolean) => (<TopicItemfav={topic.favorite}id={topic.id}@@ -55,6 +55,7 @@ const renderTopic = (topic: ChatTopic) => (metadata={topic.metadata}runStartedAt={topic.runStartedAt}status={topic.status}+ suppressAgentAvatar={suppressAgentAvatar}title={topic.title}userId={topic.userId}/>@@ -66,11 +67,12 @@ interface SubGroupItemProps {icon?: Pick<ExecutionStatusVisual, 'color' | 'icon'>;onStartInDirectory?: (projectWorkingDirectoryId: string) => void;startDirectoryId?: string;+ suppressAgentAvatar?: boolean;title: string;}const SubGroupItem = memo<SubGroupItemProps>(- ({ expanded, group, icon, onStartInDirectory, startDirectoryId, title }) => {+ ({ expanded, group, icon, onStartInDirectory, startDirectoryId, suppressAgentAvatar, title }) => {const { t: tProject } = useTranslation('project');// A folded section keeps the project row's running / awaiting / failed// counts and unread dot, so a device section still says how much it does.@@ -121,7 +123,7 @@ const SubGroupItem = memo<SubGroupItemProps>(</AccordionHeader><AccordionPanel contentStyle={{ padding: 0 }}><Flexbox gap={1} paddingBlock={1}>- {group.children.map(renderTopic)}+ {group.children.map((topic) => renderTopic(topic, suppressAgentAvatar))}</Flexbox></AccordionPanel></AccordionItem>@@ -139,6 +141,8 @@ interface ProjectTopicListProps {onStartInDirectory?: (projectWorkingDirectoryId: string) => void;/** The group's project directories a device section's "+" may start in. */startDirectories?: ProjectDirectory[];+ /** Set when the parent group header already names the owning agent. */+ suppressAgentAvatar?: boolean;topics: ChatTopic[];}@@ -147,7 +151,7 @@ interface ProjectTopicListProps {* or status (picked from the group's "more" menu).*/const ProjectTopicList = memo<ProjectTopicListProps>((props) => {- const { mode, onStartInDirectory, startDirectories, topics } = props;+ const { mode, onStartInDirectory, startDirectories, suppressAgentAvatar, topics } = props;const { t } = useTranslation('topic');const topicSortBy = useUserStore(preferenceSelectors.topicSortBy);const field = topicSortBy === 'createdAt' ? 'createdAt' : 'updatedAt';@@ -233,7 +237,7 @@ const ProjectTopicList = memo<ProjectTopicListProps>((props) => {if (!groups) {return (<Flexbox gap={1} paddingBlock={1}>- {topics.map(renderTopic)}+ {topics.map((topic) => renderTopic(topic, suppressAgentAvatar))}</Flexbox>);}@@ -251,6 +255,7 @@ const ProjectTopicList = memo<ProjectTopicListProps>((props) => {group={group}key={group.id}startDirectoryId={getStartDirectoryId(group)}+ suppressAgentAvatar={suppressAgentAvatar}title={getTitle(group)}icon={mode === 'byStatus'diff --git a/src/features/AgentSidebar/Topic/TopicListContent/ByStatusMode/GroupItem.tsx b/src/features/AgentSidebar/Topic/TopicListContent/ByStatusMode/GroupItem.tsxindex 21eb86d315a..e2461d461cf 100644--- a/src/features/AgentSidebar/Topic/TopicListContent/ByStatusMode/GroupItem.tsx+++ b/src/features/AgentSidebar/Topic/TopicListContent/ByStatusMode/GroupItem.tsx@@ -18,6 +18,7 @@ import {} from '@/components/ExecutionStatus';import TopicItem from '../../List/Item';+import { useTopicListScope } from '../../TopicListScope';import { type GroupItemComponentProps } from '../GroupedAccordion';// Status-group ids map 1:1 to a topic status except the synthetic `favorite`@@ -31,6 +32,9 @@ const STATUS_ICON: Record<string, ExecutionStatusVisual> = {const GroupItem = memo<GroupItemComponentProps>(({ group }) => {const { id, title, children } = group;const statusIcon = STATUS_ICON[id];+ // An agent's own status buckets mix topics from different projects, so each+ // row names its directory; inside a project that line repeats the project.+ const scope = useTopicListScope();return (<AccordionItem value={id}>@@ -52,12 +56,12 @@ const GroupItem = memo<GroupItemComponentProps>(({ group }) => {<Flexbox gap={1} paddingBlock={1}>{children.map((topic) => (<TopicItem- showWorkingDirectoryfav={topic.favorite}id={topic.id}key={topic.id}metadata={topic.metadata}runStartedAt={topic.runStartedAt}+ showWorkingDirectory={!scope}status={topic.status}title={topic.title}userId={topic.userId}diff --git a/src/features/Projects/Acceptance/Detail.tsx b/src/features/Projects/Acceptance/Detail.tsxnew file mode 100644index 00000000000..0c51ce227a9--- /dev/null+++ b/src/features/Projects/Acceptance/Detail.tsx@@ -0,0 +1,48 @@+'use client';++import { ActionIcon, Flexbox, Text } from '@lobehub/ui';+import { ChevronLeftIcon } from 'lucide-react';+import { useTranslation } from 'react-i18next';+import { useNavigate } from 'react-router';++import {+ AcceptanceViewer,+ OriginConversationProvider,+ useAcceptanceRouteBase,+} from '@/features/Acceptance';+import TopicPanel from '@/features/Acceptance/Viewer/Conversation/TopicPanel';+import NavHeader from '@/features/NavHeader';++/** `project/:projectId/acceptance/:acceptanceId` — one acceptance, back to the project's list. */+const ProjectAcceptanceDetail = () => {+ const { t } = useTranslation('verify');+ const navigate = useNavigate();+ const listPath = useAcceptanceRouteBase();++ return (+ <Flexbox flex={1} height={'100%'} style={{ minWidth: 0 }}>+ <NavHeader+ left={+ <Flexbox horizontal align={'center'} gap={6}>+ <ActionIcon+ icon={ChevronLeftIcon}+ size={'small'}+ title={t('acceptance.workspace.title')}+ onClick={() => navigate(listPath)}+ />+ <Text ellipsis weight={500}>+ {t('acceptance.workspace.title')}+ </Text>+ </Flexbox>+ }+ />+ <Flexbox flex={1} style={{ minHeight: 0, position: 'relative' }}>+ <OriginConversationProvider TopicPanel={TopicPanel}>+ <AcceptanceViewer />+ </OriginConversationProvider>+ </Flexbox>+ </Flexbox>+ );+};++export default ProjectAcceptanceDetail;diff --git a/src/features/Projects/Acceptance/List.tsx b/src/features/Projects/Acceptance/List.tsxnew file mode 100644index 00000000000..55f8e0c4933--- /dev/null+++ b/src/features/Projects/Acceptance/List.tsx@@ -0,0 +1,52 @@+'use client';++import { Flexbox, Text } from '@lobehub/ui';+import { useTranslation } from 'react-i18next';++import { AcceptanceListPanel, useAcceptanceProjectActionItems } from '@/features/Acceptance';+import NavHeader from '@/features/NavHeader';+import { useActiveRouteParams } from '@/hooks/useActiveRouteParams';+import { useCurrentProjectDetail } from '@/store/project';++const noop = () => {};++/**+ * `project/:projectId/acceptance` — the project's acceptances as one page-wide+ * list; a row opens its own page instead of filling a side pane.+ */+const ProjectAcceptanceList = () => {+ const { t } = useTranslation('verify');+ const { projectId } = useActiveRouteParams<{ projectId: string }>();+ const detail = useCurrentProjectDetail(projectId);+ const projectActionItems = useAcceptanceProjectActionItems();++ return (+ <Flexbox flex={1} height={'100%'} style={{ minWidth: 0 }}>+ <NavHeader+ left={+ <Text style={{ paddingInlineStart: 4 }} weight={500}>+ {t('acceptance.workspace.title')}+ </Text>+ }+ />+ <Flexbox+ flex={1}+ paddingBlock={'0 8px'}+ style={{ marginInline: 'auto', maxWidth: 960, minHeight: 0 }}+ width={'100%'}+ >+ <AcceptanceListPanel+ expand+ hosted+ pinned+ isNarrow={false}+ projectActionItems={projectActionItems}+ projectId={detail?.project.id}+ setExpand={noop}+ />+ </Flexbox>+ </Flexbox>+ );+};++export default ProjectAcceptanceList;diff --git a/src/features/Projects/Acceptance/index.tsx b/src/features/Projects/Acceptance/index.tsxindex 85a16ae689d..cf9677c5c31 100644--- a/src/features/Projects/Acceptance/index.tsx+++ b/src/features/Projects/Acceptance/index.tsx@@ -1,13 +1,25 @@'use client';+import { Outlet } from 'react-router';++import { useActiveWorkspaceSlug } from '@/business/client/hooks/useActiveWorkspaceSlug';import AsyncError from '@/components/AsyncError';import { RouteLoading } from '@/components/Skeleton/RouteSegment';-import { AcceptanceWorkspace } from '@/features/Acceptance';+import { AcceptanceRouteBaseContext } from '@/features/Acceptance';+import { buildWorkspaceAwarePath } from '@/features/Workspace/workspaceAwarePath';import { useActiveRouteParams } from '@/hooks/useActiveRouteParams';import { useCurrentProjectDetail, useProjectStore } from '@/store/project';-const ProjectAcceptance = () => {+import { getProjectAcceptancePath } from '../Layout/navigation';++/**+ * `project/:projectId/acceptance` layout: the project's full-width list at the+ * index, one acceptance below it. Every acceptance link rendered inside points+ * back into this section rather than at the standalone `/acceptance` pages.+ */+const ProjectAcceptanceLayout = () => {const { projectId } = useActiveRouteParams<{ projectId: string }>();+ const activeWorkspaceSlug = useActiveWorkspaceSlug();// The persisted project paints on the first frame; the hook only syncs it.const detail = useCurrentProjectDetail(projectId);const { error, isHydrated, isValidating, revalidate } = useProjectStore(@@ -17,9 +29,15 @@ const ProjectAcceptance = () => {if (!detail && (!isHydrated || isValidating)) return <RouteLoading />;if (error && !detail)return <AsyncError error={error} variant={'page'} onRetry={() => void revalidate()} />;- if (!detail) return null;+ if (!detail || !projectId) return null;- return <AcceptanceWorkspace projectId={detail.project.id} />;+ return (+ <AcceptanceRouteBaseContext+ value={buildWorkspaceAwarePath(getProjectAcceptancePath(projectId), activeWorkspaceSlug)}+ >+ <Outlet />+ </AcceptanceRouteBaseContext>+ );};-export default ProjectAcceptance;+export default ProjectAcceptanceLayout;diff --git a/src/features/Projects/Layout/Sidebar.tsx b/src/features/Projects/Layout/Sidebar.tsxindex dad111f6876..063d6cf35e7 100644--- a/src/features/Projects/Layout/Sidebar.tsx+++ b/src/features/Projects/Layout/Sidebar.tsx@@ -27,6 +27,7 @@ import {getProjectDashboardPath,getProjectGoalsPath,getProjectTasksPath,+ isProjectSectionActive,} from './navigation';import ProjectHeader from './ProjectHeader';@@ -74,16 +75,14 @@ const ProjectSidebarContent = memo(() => {/>{dashboardEnabled && (<NavItem+ active={isProjectSectionActive(pathname, projectDashboardPath)}icon={LayoutDashboardIcon}title={t('sections.dashboard')}- active={- pathname === projectDashboardPath || pathname.startsWith(`${projectDashboardPath}/`)- }onClick={() => navigate(projectDashboardPath)}/>)}<NavItem- active={pathname === projectAcceptancePath}+ active={isProjectSectionActive(pathname, projectAcceptancePath)}icon={ClipboardCheckIcon}title={t('sections.acceptance')}onClick={() => navigate(projectAcceptancePath)}diff --git a/src/features/Projects/Layout/navigation.test.ts b/src/features/Projects/Layout/navigation.test.tsindex 79cbacd25fc..6e0a26cc95f 100644--- a/src/features/Projects/Layout/navigation.test.ts+++ b/src/features/Projects/Layout/navigation.test.ts@@ -9,6 +9,7 @@ import {getProjectGoalsPath,getProjectLibraryPath,getProjectTasksPath,+ isProjectSectionActive,} from './navigation';describe('project workspace navigation', () => {@@ -33,3 +34,20 @@ describe('project workspace navigation', () => {);});});++describe('isProjectSectionActive', () => {+ /** @example Acceptance: opening a record un-highlighted the Acceptance nav item. */+ it('keeps a section active on its own record pages', () => {+ const section = getProjectAcceptancePath('prj_1');++ expect(isProjectSectionActive(section, section)).toBe(true);+ expect(isProjectSectionActive(`${section}/acc_1`, section)).toBe(true);+ expect(isProjectSectionActive(`${section}/acc_1/check/chk_1`, section)).toBe(true);+ });++ it('does not match a sibling path that only shares the prefix', () => {+ expect(+ isProjectSectionActive('/project/prj_1/acceptance-old', '/project/prj_1/acceptance'),+ ).toBe(false);+ });+});diff --git a/src/features/Projects/Layout/navigation.ts b/src/features/Projects/Layout/navigation.tsindex b465cb5ccdc..adc7e0b1ccb 100644--- a/src/features/Projects/Layout/navigation.ts+++ b/src/features/Projects/Layout/navigation.ts@@ -19,3 +19,7 @@ export const getProjectDashboardPath = (projectId: string, dashboardId?: string): `/project/${projectId}/dashboard`;export const getProjectAcceptancePath = (projectId: string) => `/project/${projectId}/acceptance`;++/** A section stays active on its own pages too — a board, an acceptance record. */+export const isProjectSectionActive = (pathname: string, sectionPath: string) =>+ pathname === sectionPath || pathname.startsWith(`${sectionPath}/`);diff --git a/src/routes/(main)/project/[projectId]/acceptance/[acceptanceId]/index.tsx b/src/routes/(main)/project/[projectId]/acceptance/[acceptanceId]/index.tsxnew file mode 100644index 00000000000..0376e72f360--- /dev/null+++ b/src/routes/(main)/project/[projectId]/acceptance/[acceptanceId]/index.tsx@@ -0,0 +1 @@+export { default } from '@/features/Projects/Acceptance/Detail';diff --git a/src/routes/(main)/project/[projectId]/acceptance/_layout/index.tsx b/src/routes/(main)/project/[projectId]/acceptance/_layout/index.tsxnew file mode 100644index 00000000000..54eaddcc0d8--- /dev/null+++ b/src/routes/(main)/project/[projectId]/acceptance/_layout/index.tsx@@ -0,0 +1 @@+export { default } from '@/features/Projects/Acceptance';diff --git a/src/routes/(main)/project/[projectId]/acceptance/index.tsx b/src/routes/(main)/project/[projectId]/acceptance/index.tsxindex 54eaddcc0d8..6c26e43a8cd 100644--- a/src/routes/(main)/project/[projectId]/acceptance/index.tsx+++ b/src/routes/(main)/project/[projectId]/acceptance/index.tsx@@ -1 +1 @@-export { default } from '@/features/Projects/Acceptance';+export { default } from '@/features/Projects/Acceptance/List';diff --git a/src/spa/router/desktopRouter.meta.desktop.test.ts b/src/spa/router/desktopRouter.meta.desktop.test.tsindex c6863be11e4..2aa092ad924 100644--- a/src/spa/router/desktopRouter.meta.desktop.test.ts+++ b/src/spa/router/desktopRouter.meta.desktop.test.ts@@ -80,6 +80,14 @@ describe('mainAreaMetaRoutes (Electron adapter)', () => {expect(matched.meta?.DynamicMeta).toBeUndefined();});+ it('resolves a project acceptance record with the acceptance title runner', () => {+ const matched = matchRouteMeta(mainAreaMetaRoutes, '/project/prj_1/acceptance/acc_1');++ expect(matched.static.titleKey).toBe('verify:acceptance.titleFallback');+ expect(matched.meta?.DynamicMeta).toBeDefined();+ expect(matched.params.acceptanceId).toBe('acc_1');+ });+it('resolves project meta for workspace-scoped tab urls', () => {const matched = matchRouteMeta(mainAreaMetaRoutes, '/team-x/project/prj_1/conversation/tpc_1');diff --git a/src/spa/router/desktopRouter.shared.tsx b/src/spa/router/desktopRouter.shared.tsxindex 62b219cb046..808552f7fb1 100644--- a/src/spa/router/desktopRouter.shared.tsx+++ b/src/spa/router/desktopRouter.shared.tsx@@ -47,7 +47,6 @@ import { agentsRouteMeta } from '@/features/AgentViewAll/routeMeta';import { dashboardRouteMeta, dashboardsRouteMeta } from '@/features/Dashboard/routeMeta';import { pageRouteMeta } from '@/features/Pages/routeMeta';import {- projectAcceptanceRouteMeta,projectConversationRouteMeta,projectDirectoriesRouteMeta,projectsRouteMeta,@@ -83,6 +82,7 @@ import { identitiesListLoader } from '@/spa/router/identitiesListLoader';import { libraryTreeLoader } from '@/spa/router/libraryTreeLoader';import { pageListLoader } from '@/spa/router/pageListLoader';import { preferenceListLoader } from '@/spa/router/preferenceListLoader';+import { projectAcceptanceRoute } from '@/spa/router/projectAcceptanceRoutes';import { agentAccessLoader, agentGroupAccessLoader } from '@/spa/router/resourceAccessLoader';import { NoRouteSkeleton, routeMeta } from '@/spa/router/routeMeta';import { scheduledTaskListLoader } from '@/spa/router/scheduledTaskListLoader';@@ -1133,23 +1133,7 @@ export const sharedMainAreaChildren: RouteObject[] = [),path: 'dashboard',},- {- children: [- {- element: dynamicElement(- () => import('@/routes/(main)/acceptance/empty'),- 'Desktop > Project Acceptance > Empty',- ),- index: true,- },- ],- element: dynamicLayout(- () => import('@/routes/(main)/project/[projectId]/acceptance'),- 'Desktop > Project Acceptance',- ),- handle: { meta: projectAcceptanceRouteMeta },- path: 'acceptance',- },+ projectAcceptanceRoute,],element: dynamicLayout(() => import('@/routes/(main)/project/_layout'),diff --git a/src/spa/router/desktopRouter.sync.test.tsx b/src/spa/router/desktopRouter.sync.test.tsxindex 531c411f2dc..b4070e97359 100644--- a/src/spa/router/desktopRouter.sync.test.tsx+++ b/src/spa/router/desktopRouter.sync.test.tsx@@ -226,6 +226,23 @@ describe('desktop router shared definition', () => {},);+ it.each(mainAreaVariants)(+ '%s opens a project acceptance record inside the project section',+ (_, factory) => {+ const list = matchRoutes(createMainAreaRoutes(factory), '/project/prj_1/acceptance');+ const record = matchRoutes(createMainAreaRoutes(factory), '/project/prj_1/acceptance/acc_1');+ const check = matchRoutes(+ createMainAreaRoutes(factory),+ '/project/prj_1/acceptance/acc_1/check/chk_1',+ );++ expect(list?.at(-1)?.route.index).toBe(true);+ expect(record?.at(-1)?.route.path).toBe(':acceptanceId');+ expect(record?.at(-1)?.params.acceptanceId).toBe('acc_1');+ expect(check?.at(-1)?.params.checkId).toBe('chk_1');+ },+ );+it.each(mainAreaVariants)('%s matches project dashboard list and board pages', (_, factory) => {const list = matchRoutes(createMainAreaRoutes(factory), '/project/prj_1/dashboard');const board = matchRoutes(createMainAreaRoutes(factory), '/acme/project/prj_1/dashboard/d-1');diff --git a/src/spa/router/projectAcceptanceRoutes.tsx b/src/spa/router/projectAcceptanceRoutes.tsxnew file mode 100644index 00000000000..5528b2ea9a8--- /dev/null+++ b/src/spa/router/projectAcceptanceRoutes.tsx@@ -0,0 +1,44 @@+import type { RouteObject } from 'react-router';++import { acceptanceRouteMeta } from '@/features/Acceptance/routeMeta';+import { projectAcceptanceRouteMeta } from '@/features/Projects/routeMeta';+import { dynamicElement, dynamicLayout } from '@/utils/router';++const projectAcceptanceDetailElement = (name: string) =>+ dynamicElement(+ () => import('@/routes/(main)/project/[projectId]/acceptance/[acceptanceId]'),+ name,+ );++/**+ * `project/:projectId/acceptance`: the project's acceptances as a full-width+ * list, and each record (or one of its checks) on its own page inside the+ * project. Mounted under the project layout in `desktopRouter.shared.tsx`.+ */+export const projectAcceptanceRoute: RouteObject = {+ children: [+ {+ element: dynamicElement(+ () => import('@/routes/(main)/project/[projectId]/acceptance'),+ 'Desktop > Project Acceptance > List',+ ),+ index: true,+ },+ {+ element: projectAcceptanceDetailElement('Desktop > Project Acceptance > Detail'),+ handle: { meta: acceptanceRouteMeta },+ path: ':acceptanceId',+ },+ {+ element: projectAcceptanceDetailElement('Desktop > Project Acceptance > Check'),+ handle: { meta: acceptanceRouteMeta },+ path: ':acceptanceId/check/:checkId',+ },+ ],+ element: dynamicLayout(+ () => import('@/routes/(main)/project/[projectId]/acceptance/_layout'),+ 'Desktop > Project Acceptance',+ ),+ handle: { meta: projectAcceptanceRouteMeta },+ path: 'acceptance',+};