Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

✨ feat: open verify reports in portal (#17038)

Arvin Xuf9cf973ff7fc
diff --git a/.agents/skills/agent-testing/references/probe-mock-patterns.md b/.agents/skills/agent-testing/references/probe-mock-patterns.md
index 5794f5dba60..5d5ff072872 100644
--- a/.agents/skills/agent-testing/references/probe-mock-patterns.md
+++ b/.agents/skills/agent-testing/references/probe-mock-patterns.md
@@ -919,3 +919,41 @@ agents. Set` `agentRules: false` `in next.config to disable.` and leaves the wor
- **Works**: name the ignored directory explicitly (`grep -rl "agentRules" node_modules`), which
overrides the ignore, or call `/usr/bin/grep` directly. Before asserting "X exists nowhere",
re-run the search with an explicit path into the dependency tree.
+
+### E14. Electron `will-attach-webview` params carry NO custom attributes — identity via data-\* never arrives
+
+- **Situation**: a main-process controller needs to know WHICH renderer feature a mounting
+ `<webview>` belongs to (e.g. a per-conversation session id), and the renderer put it in a
+ custom `data-*` attribute on the element.
+- **Doesn't work**: reading `params['data-…']` in `will-attach-webview`. Measured live: params
+ only contains the standard set (`instanceId, partition, src, httpreferrer, useragent,
+nodeintegration, plugins, disablewebsecurity, allowpopups, preload, …`). The handler silently
+ no-ops and — trap — a unit test that mocks params WITH the custom key passes green.
+- **Works**: two-channel design. (1) Recognition/hardening keyed off the **`partition`
+ attribute** set by the renderer (it IS forwarded); (2) identity bound after mount via an
+ explicit IPC — renderer listens for the webview's `dom-ready`, calls
+ `attach({ sessionId, webContentsId: el.getWebContentsId() })`, main process
+ `webContents.fromId()` + validates the guest's session belongs to the expected partition.
+
+### E16. agent-browser session silently re-targets to a newly created `<webview>` guest
+
+- **Situation**: driving an Electron app over CDP while the app itself spawns a `<webview>`
+ (in-app browser). After the guest mounts, `eval` on the SAME session suddenly returns the
+ guest page's DOM (`__LOBE_STORES` undefined, app selectors empty) — looks like the app broke.
+- **Doesn't work**: assuming a session stays pinned to the app target; also assuming
+ `document.querySelectorAll('webview').length === 0` means "no webview" (you may be evaluating
+ INSIDE the guest).
+- **Works**: `curl -s localhost:<cdp>/json/list` to see targets (`page` = app, `webview` =
+ guest), then use **separate session names** per target (`--session app-x` re-picks the `page`
+ target; the old session keeps following the guest — handy for driving the embedded page).
+ Verify with `get url` (`app://` vs the site URL) before trusting any eval result.
+
+### E17. Dev-mode main-process `logger.warn/debug` is invisible without DEBUG env — probe with console.log
+
+- **Situation**: adding a temporary probe log in Electron main code and watching the dev
+ instance log; nothing prints, which reads as "code path never runs".
+- **Doesn't work**: `createLogger(ns).warn/debug` in development — it routes to the `debug`
+ package, which is silent unless `DEBUG=<ns>` was set when the process started.
+- **Works**: temporary probes use `console.log('[AGENT-TEST] …')` (always reaches the instance
+ log via stdout); confirm the rebuilt bundle actually contains the probe string
+ (`grep "<probe>" apps/desktop/dist/main/index.js`) before interpreting silence.
diff --git a/locales/en-US/chat.json b/locales/en-US/chat.json
index 9140b6c40d0..9e64ec84cf3 100644
--- a/locales/en-US/chat.json
+++ b/locales/en-US/chat.json
@@ -411,6 +411,17 @@
"internalLink.preview.agent": "Agent",
"internalLink.preview.document": "Page",
"internalLink.preview.task": "Task",
+ "internalLink.preview.verify": "Verification report",
+ "internalLink.preview.verifyCounts": "{{passed}} passed · {{failed}} failed · {{uncertain}} uncertain",
+ "internalLink.preview.verifyStatus.delivered": "Delivered",
+ "internalLink.preview.verifyStatus.errored": "Error",
+ "internalLink.preview.verifyStatus.failed": "Failed",
+ "internalLink.preview.verifyStatus.passed": "Passed",
+ "internalLink.preview.verifyStatus.planned": "Planned",
+ "internalLink.preview.verifyStatus.repairing": "Repairing",
+ "internalLink.preview.verifyStatus.uncertain": "Uncertain",
+ "internalLink.preview.verifyStatus.unverified": "Unverified",
+ "internalLink.preview.verifyStatus.verifying": "Verifying",
"inviteMembers": "Invite members",
"knowledgeBase.all": "All Content",
"knowledgeBase.allFiles": "All Files",
diff --git a/locales/zh-CN/chat.json b/locales/zh-CN/chat.json
index dec13623a96..40169deac9f 100644
--- a/locales/zh-CN/chat.json
+++ b/locales/zh-CN/chat.json
@@ -411,6 +411,17 @@
"internalLink.preview.agent": "Agent",
"internalLink.preview.document": "页面",
"internalLink.preview.task": "任务",
+ "internalLink.preview.verify": "验证报告",
+ "internalLink.preview.verifyCounts": "已通过 {{passed}} · 未通过 {{failed}} · 不确定 {{uncertain}}",
+ "internalLink.preview.verifyStatus.delivered": "已交付",
+ "internalLink.preview.verifyStatus.errored": "出错",
+ "internalLink.preview.verifyStatus.failed": "未通过",
+ "internalLink.preview.verifyStatus.passed": "已通过",
+ "internalLink.preview.verifyStatus.planned": "已规划",
+ "internalLink.preview.verifyStatus.repairing": "修复中",
+ "internalLink.preview.verifyStatus.uncertain": "不确定",
+ "internalLink.preview.verifyStatus.unverified": "未验证",
+ "internalLink.preview.verifyStatus.verifying": "验证中",
"inviteMembers": "邀请成员",
"knowledgeBase.all": "全部内容",
"knowledgeBase.allFiles": "全部文件",
diff --git a/packages/database/src/models/message.ts b/packages/database/src/models/message.ts
index 3eb165b3478..fb461b77366 100644
--- a/packages/database/src/models/message.ts
+++ b/packages/database/src/models/message.ts
@@ -2256,6 +2256,7 @@ export class MessageModel {
);
mergedMetadata = merge(existingMessage?.metadata || {}, metadataPatch);
}
+ const metadataToWrite = mergedMetadata;
const [updated] = await runTimedStage(
timing,
@@ -2265,7 +2266,7 @@ export class MessageModel {
.update(messages)
.set({
...message,
- ...(mergedMetadata && { metadata: mergedMetadata }),
+ ...(metadataToWrite && { metadata: metadataToWrite }),
...(usageToWrite && { usage: usageToWrite }),
})
.where(and(eq(messages.id, id), this.ownership()))
diff --git a/packages/locales/src/default/chat.ts b/packages/locales/src/default/chat.ts
index a82f46bad23..8b048464c3e 100644
--- a/packages/locales/src/default/chat.ts
+++ b/packages/locales/src/default/chat.ts
@@ -1544,5 +1544,17 @@ export default {
'internalLink.preview.agent': 'Agent',
'internalLink.preview.document': 'Page',
'internalLink.preview.task': 'Task',
+ 'internalLink.preview.verify': 'Verification report',
+ 'internalLink.preview.verifyCounts':
+ '{{passed}} passed · {{failed}} failed · {{uncertain}} uncertain',
+ 'internalLink.preview.verifyStatus.delivered': 'Delivered',
+ 'internalLink.preview.verifyStatus.errored': 'Error',
+ 'internalLink.preview.verifyStatus.failed': 'Failed',
+ 'internalLink.preview.verifyStatus.passed': 'Passed',
+ 'internalLink.preview.verifyStatus.planned': 'Planned',
+ 'internalLink.preview.verifyStatus.repairing': 'Repairing',
+ 'internalLink.preview.verifyStatus.uncertain': 'Uncertain',
+ 'internalLink.preview.verifyStatus.unverified': 'Unverified',
+ 'internalLink.preview.verifyStatus.verifying': 'Verifying',
'you': 'You',
};
diff --git a/src/features/ChatInput/ControlBar/BranchSwitcher.tsx b/src/features/ChatInput/ControlBar/BranchSwitcher.tsx
index 3075a9d8cd6..e553860c288 100644
--- a/src/features/ChatInput/ControlBar/BranchSwitcher.tsx
+++ b/src/features/ChatInput/ControlBar/BranchSwitcher.tsx
@@ -82,12 +82,14 @@ const styles = createStaticStyles(({ css }) => ({
gap: 8px;
align-items: center;
- padding-block: 2px;
+ height: auto;
+ min-height: 32px;
+ padding-block: 4px;
padding-inline: 8px;
border-radius: 4px;
- font-size: 13px;
- line-height: 1.3;
+ font-size: 14px;
+ line-height: 20px;
color: ${cssVar.colorText};
/* Swap the checkmark for the row actions while hovering the row. */
@@ -145,8 +147,8 @@ const styles = createStaticStyles(({ css }) => ({
min-width: 0;
`,
itemMeta: css`
- margin-block-start: 1px;
- font-size: 11px;
+ font-size: 12px;
+ line-height: 16px;
color: ${cssVar.colorTextTertiary};
`,
list: css`
diff --git a/src/features/Conversation/Markdown/plugins/Link/Render/InternalEntityLink.tsx b/src/features/Conversation/Markdown/plugins/Link/Render/InternalEntityLink.tsx
index 585e7d0599a..d9fcb5ccb2e 100644
--- a/src/features/Conversation/Markdown/plugins/Link/Render/InternalEntityLink.tsx
+++ b/src/features/Conversation/Markdown/plugins/Link/Render/InternalEntityLink.tsx
@@ -2,7 +2,7 @@
import { Icon } from '@lobehub/ui';
import { createStaticStyles } from 'antd-style';
-import { BotIcon, CheckSquareIcon, FileTextIcon } from 'lucide-react';
+import { BotIcon, CheckCircleIcon, CheckSquareIcon, FileTextIcon } from 'lucide-react';
import type { MouseEvent } from 'react';
import { memo, useCallback } from 'react';
@@ -53,6 +53,7 @@ const ENTITY_ICONS = {
agent: BotIcon,
document: FileTextIcon,
task: CheckSquareIcon,
+ verify: CheckCircleIcon,
} as const;
interface InternalEntityLinkProps {
@@ -64,10 +65,11 @@ interface InternalEntityLinkProps {
export const InternalEntityLink = memo<InternalEntityLinkProps>(({ href, label, reference }) => {
const navigate = useWorkspaceAwareNavigate();
const activeAgentId = useAgentStore((s) => s.activeAgentId);
- const [openAgentDetail, openDocument, openTaskDetail] = useChatStore((s) => [
+ const [openAgentDetail, openDocument, openTaskDetail, openVerifyReport] = useChatStore((s) => [
s.openAgentDetail,
s.openDocument,
s.openTaskDetail,
+ s.openVerifyReport,
]);
const linkedAgentId = reference.type === 'document' ? reference.agentId : undefined;
const shouldResolveAgentDocument = !!linkedAgentId && linkedAgentId === activeAgentId;
@@ -118,6 +120,10 @@ export const InternalEntityLink = memo<InternalEntityLinkProps>(({ href, label,
openTaskDetail(reference.taskId);
break;
}
+ case 'verify': {
+ openVerifyReport(reference.runId);
+ break;
+ }
case 'route': {
navigate(reference.pathname);
break;
@@ -131,6 +137,7 @@ export const InternalEntityLink = memo<InternalEntityLinkProps>(({ href, label,
openAgentDetail,
openDocument,
openTaskDetail,
+ openVerifyReport,
reference,
resolveAgentDocuments,
shouldResolveAgentDocument,
diff --git a/src/features/Conversation/Markdown/plugins/Link/Render/InternalEntityPreview.tsx b/src/features/Conversation/Markdown/plugins/Link/Render/InternalEntityPreview.tsx
index c5e16f8b2c4..d68604fa33c 100644
--- a/src/features/Conversation/Markdown/plugins/Link/Render/InternalEntityPreview.tsx
+++ b/src/features/Conversation/Markdown/plugins/Link/Render/InternalEntityPreview.tsx
@@ -2,7 +2,8 @@
import { Avatar, Flexbox, Icon, Popover, Skeleton, Text } from '@lobehub/ui';
import { createStaticStyles } from 'antd-style';
-import { BotIcon, CheckSquareIcon, FileTextIcon } from 'lucide-react';
+import type { TFunction } from 'i18next';
+import { BotIcon, CheckCircleIcon, CheckSquareIcon, FileTextIcon } from 'lucide-react';
import { memo, type PropsWithChildren, useState } from 'react';
import { useTranslation } from 'react-i18next';
@@ -10,6 +11,7 @@ import { useClientDataSWR } from '@/libs/swr';
import { agentService } from '@/services/agent';
import { documentService } from '@/services/document';
import { taskService } from '@/services/task';
+import { verifyService } from '@/services/verify';
import type { InternalLinkReference } from '../internalLink';
@@ -58,10 +60,50 @@ interface PreviewData {
avatar?: string | null;
backgroundColor?: string | null;
description?: string | null;
+ meta?: string | null;
+ secondaryMeta?: string | null;
title?: string | null;
}
-const getPreviewData = async (reference: InternalLinkReference): Promise<PreviewData | null> => {
+const getVerifyStatusLabel = (status: string | null | undefined, t: TFunction<'chat'>) => {
+ switch (status) {
+ case 'delivered': {
+ return t('internalLink.preview.verifyStatus.delivered');
+ }
+ case 'errored': {
+ return t('internalLink.preview.verifyStatus.errored');
+ }
+ case 'failed': {
+ return t('internalLink.preview.verifyStatus.failed');
+ }
+ case 'passed': {
+ return t('internalLink.preview.verifyStatus.passed');
+ }
+ case 'planned': {
+ return t('internalLink.preview.verifyStatus.planned');
+ }
+ case 'repairing': {
+ return t('internalLink.preview.verifyStatus.repairing');
+ }
+ case 'uncertain': {
+ return t('internalLink.preview.verifyStatus.uncertain');
+ }
+ case 'unverified': {
+ return t('internalLink.preview.verifyStatus.unverified');
+ }
+ case 'verifying': {
+ return t('internalLink.preview.verifyStatus.verifying');
+ }
+ default: {
+ return null;
+ }
+ }
+};
+
+const getPreviewData = async (
+ reference: InternalLinkReference,
+ t: TFunction<'chat'>,
+): Promise<PreviewData | null> => {
switch (reference.type) {
case 'agent': {
return agentService.getAgentConfigById(reference.agentId);
@@ -85,6 +127,33 @@ const getPreviewData = async (reference: InternalLinkReference): Promise<Preview
}
: null;
}
+ case 'verify': {
+ const bundle = await verifyService.getReportBundle(reference.runId);
+ if (!bundle) return null;
+
+ const { report, run } = bundle;
+ const status = report?.verdict ?? run.status;
+ const counts = report
+ ? t('internalLink.preview.verifyCounts', {
+ failed: report.failedChecks ?? 0,
+ passed: report.passedChecks ?? 0,
+ uncertain: report.uncertainChecks ?? 0,
+ })
+ : null;
+ const context = run.context;
+ const scope = [
+ context?.branch,
+ context?.commit?.slice(0, 10),
+ context?.testedAt ? new Date(context.testedAt).toLocaleString() : null,
+ ].filter(Boolean);
+
+ return {
+ description: report?.summary,
+ meta: [getVerifyStatusLabel(status, t), counts].filter(Boolean).join(' · '),
+ secondaryMeta: scope.join(' · '),
+ title: run.title,
+ };
+ }
case 'route': {
return null;
}
@@ -102,7 +171,7 @@ export const InternalEntityPreview = memo<InternalEntityPreviewProps>(
const [open, setOpen] = useState(false);
const { data, isLoading } = useClientDataSWR(
open ? ['internal-entity-preview', reference.type, reference.pathname] : null,
- () => getPreviewData(reference),
+ () => getPreviewData(reference, t),
{ revalidateOnFocus: false },
);
@@ -111,7 +180,9 @@ export const InternalEntityPreview = memo<InternalEntityPreviewProps>(
? BotIcon
: reference.type === 'task'
? CheckSquareIcon
- : FileTextIcon;
+ : reference.type === 'verify'
+ ? CheckCircleIcon
+ : FileTextIcon;
const typeLabel = t(`internalLink.preview.${reference.type}`);
const content = isLoading ? (
@@ -143,6 +214,16 @@ export const InternalEntityPreview = memo<InternalEntityPreviewProps>(
{data.description}
</Text>
)}
+ {data?.meta && (
+ <Text fontSize={12} type={'secondary'}>
+ {data.meta}
+ </Text>
+ )}
+ {data?.secondaryMeta && (
+ <Text fontSize={12} type={'secondary'}>
+ {data.secondaryMeta}
+ </Text>
+ )}
</Flexbox>
);
diff --git a/src/features/Conversation/Markdown/plugins/Link/internalLink.test.ts b/src/features/Conversation/Markdown/plugins/Link/internalLink.test.ts
index f183c0b9e2b..8d8f21e73d0 100644
--- a/src/features/Conversation/Markdown/plugins/Link/internalLink.test.ts
+++ b/src/features/Conversation/Markdown/plugins/Link/internalLink.test.ts
@@ -36,6 +36,20 @@ describe('parseInternalLink', () => {
});
});
+ it('parses verification report links', () => {
+ expect(parseInternalLink('https://app.lobehub.com/verify/run-1')).toEqual({
+ pathname: '/verify/run-1',
+ runId: 'run-1',
+ type: 'verify',
+ });
+ expect(parseInternalLink('/lobe-team/verify/run-2', undefined, ['lobe-team'])).toEqual({
+ pathname: '/lobe-team/verify/run-2',
+ runId: 'run-2',
+ type: 'verify',
+ workspaceSlug: 'lobe-team',
+ });
+ });
+
it('parses workspace-prefixed entity paths', () => {
expect(
parseInternalLink('/lobe-team/agent/agt_agent/docs/docs_document', undefined, ['lobe-team']),
diff --git a/src/features/Conversation/Markdown/plugins/Link/internalLink.ts b/src/features/Conversation/Markdown/plugins/Link/internalLink.ts
index 6f9e5989c65..da906a64a44 100644
--- a/src/features/Conversation/Markdown/plugins/Link/internalLink.ts
+++ b/src/features/Conversation/Markdown/plugins/Link/internalLink.ts
@@ -3,7 +3,7 @@ import { OFFICIAL_URL } from '@lobechat/const';
import { getIdFromIdentifier } from '@/utils/identifier';
-const ROUTE_ROOTS = new Set(['agent', 'page', 'task', 'tasks']);
+const ROUTE_ROOTS = new Set(['agent', 'page', 'task', 'tasks', 'verify']);
const BUILTIN_AGENT_SLUG_SET = new Set<string>(Object.values(BUILTIN_AGENT_SLUGS));
const NON_SPA_ROUTE_ROOTS = new Set(['_next', 'api', 'f', 'oidc', 'trpc', 'webapi']);
const SPA_ROUTE_ROOTS = new Set([
@@ -21,6 +21,7 @@ const SPA_ROUTE_ROOTS = new Set([
'task',
'tasks',
'video',
+ 'verify',
]);
export type InternalLinkReference =
@@ -33,6 +34,7 @@ export type InternalLinkReference =
workspaceSlug?: string;
}
| { pathname: string; type: 'route'; workspaceSlug?: string }
+ | { pathname: string; runId: string; type: 'verify'; workspaceSlug?: string }
| {
agentId?: string;
pathname: string;
@@ -126,6 +128,15 @@ export const parseInternalLink = (
};
}
+ if (segments[0] === 'verify' && segments[1]) {
+ return {
+ pathname,
+ runId: segments[1],
+ type: 'verify',
+ ...(workspaceSlug ? { workspaceSlug } : {}),
+ };
+ }
+
if (segments[0] === 'agent' && segments[1]) {
if (BUILTIN_AGENT_SLUG_SET.has(segments[1])) return { pathname, type: 'route' };
diff --git a/src/features/Portal/VerifyReport/Body.tsx b/src/features/Portal/VerifyReport/Body.tsx
new file mode 100644
index 00000000000..4a46e7161c2
--- /dev/null
+++ b/src/features/Portal/VerifyReport/Body.tsx
@@ -0,0 +1,13 @@
+import { memo } from 'react';
+
+import { ReportViewer } from '@/features/Verify';
+import { useChatStore } from '@/store/chat';
+import { chatPortalSelectors } from '@/store/chat/selectors';
+
+const Body = memo(() => {
+ const runId = useChatStore(chatPortalSelectors.verifyReportRunId);
+
+ return <ReportViewer runId={runId} />;
+});
+
+export default Body;
diff --git a/src/features/Portal/VerifyReport/Header.tsx b/src/features/Portal/VerifyReport/Header.tsx
new file mode 100644
index 00000000000..4e5f380fa74
--- /dev/null
+++ b/src/features/Portal/VerifyReport/Header.tsx
@@ -0,0 +1,37 @@
+import { DESKTOP_HEADER_ICON_SMALL_SIZE } from '@lobechat/const';
+import { ActionIcon } from '@lobehub/ui';
+import { Maximize2 } from 'lucide-react';
+import { memo } from 'react';
+
+import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
+import { useChatStore } from '@/store/chat';
+import { chatPortalSelectors } from '@/store/chat/selectors';
+
+import Header from '../components/Header';
+import Title from './Title';
+
+const VerifyReportHeader = memo(() => {
+ const navigate = useWorkspaceAwareNavigate();
+ const runId = useChatStore(chatPortalSelectors.verifyReportRunId);
+ const clearPortalStack = useChatStore((s) => s.clearPortalStack);
+
+ return (
+ <Header
+ title={<Title />}
+ rightExtra={
+ <ActionIcon
+ disabled={!runId}
+ icon={Maximize2}
+ size={DESKTOP_HEADER_ICON_SMALL_SIZE}
+ onClick={() => {
+ if (!runId) return;
+ navigate(`/verify/${runId}`);
+ clearPortalStack();
+ }}
+ />
+ }
+ />
+ );
+});
+
+export default VerifyReportHeader;
diff --git a/src/features/Portal/VerifyReport/Title.tsx b/src/features/Portal/VerifyReport/Title.tsx
new file mode 100644
index 00000000000..760f8844029
--- /dev/null
+++ b/src/features/Portal/VerifyReport/Title.tsx
@@ -0,0 +1,14 @@
+import { memo } from 'react';
+
+import { useVerifyReportBundle } from '@/features/Verify/hooks';
+import { useChatStore } from '@/store/chat';
+import { chatPortalSelectors } from '@/store/chat/selectors';
+
+const Title = memo(() => {
+ const runId = useChatStore(chatPortalSelectors.verifyReportRunId);
+ const { data } = useVerifyReportBundle(runId ?? null);
+
+ return data?.run.title || 'Verify report';
+});
+
+export default Title;
diff --git a/src/features/Portal/VerifyReport/index.ts b/src/features/Portal/VerifyReport/index.ts
new file mode 100644
index 00000000000..51a4b247098
--- /dev/null
+++ b/src/features/Portal/VerifyReport/index.ts
@@ -0,0 +1,6 @@
+import type { PortalImpl } from '../type';
+import Body from './Body';
+import Header from './Header';
+import Title from './Title';
+
+export const VerifyReport: PortalImpl = { Body, Header, Title };
diff --git a/src/features/Portal/router.tsx b/src/features/Portal/router.tsx
index ae695540c69..09470c8e30d 100644
--- a/src/features/Portal/router.tsx
+++ b/src/features/Portal/router.tsx
@@ -20,6 +20,7 @@ import { Plugins } from './Plugins';
import { TaskDetail } from './TaskDetail';
import { Thread } from './Thread';
import { type PortalImpl } from './type';
+import { VerifyReport } from './VerifyReport';
import { VerifyResult } from './VerifyResult';
// View type to component mapping
@@ -40,6 +41,7 @@ const VIEW_COMPONENTS: Record<PortalViewType, PortalImpl> = {
[PortalViewType.Thread]: Thread,
[PortalViewType.GroupThread]: GroupThread,
[PortalViewType.VerifyResult]: VerifyResult,
+ [PortalViewType.VerifyReport]: VerifyReport,
};
// Default Home component
diff --git a/src/features/Verify/ReportViewer.tsx b/src/features/Verify/ReportViewer.tsx
index 2430ab84dda..c6023e56b52 100644
--- a/src/features/Verify/ReportViewer.tsx
+++ b/src/features/Verify/ReportViewer.tsx
@@ -1531,10 +1531,14 @@ CodingScopeCard.displayName = 'CodingScopeCard';
* and the full narrative behind a collapsed disclosure. Addressed by `:runId`;
* refreshes itself while the run is non-terminal.
*/
-const ReportViewer = memo(() => {
+interface ReportViewerProps {
+ runId?: string;
+}
+
+const ReportViewer = memo<ReportViewerProps>(({ runId: explicitRunId }) => {
const { t } = useTranslation('verify');
- const { runId } = useParams<{ runId: string }>();
- const verifyRunId = runId ?? null;
+ const { runId: routeRunId } = useParams<{ runId: string }>();
+ const verifyRunId = explicitRunId ?? routeRunId ?? null;
const { data, error, isLoading, mutate } = useVerifyReportBundle(verifyRunId);
const [filter, setFilter] = useState<Filter>('all');
diff --git a/src/store/chat/slices/portal/action.ts b/src/store/chat/slices/portal/action.ts
index c0c7a47b783..f2bd5d0d715 100644
--- a/src/store/chat/slices/portal/action.ts
+++ b/src/store/chat/slices/portal/action.ts
@@ -598,6 +598,10 @@ export class ChatPortalActionImpl {
this.#get().pushPortalView({ checkItemId, operationId, type: PortalViewType.VerifyResult });
};
+ openVerifyReport = (runId: string): void => {
+ this.#get().pushPortalView({ runId, type: PortalViewType.VerifyReport });
+ };
+
popPortalView = (): void => {
const { portalStack } = this.#get();
diff --git a/src/store/chat/slices/portal/initialState.ts b/src/store/chat/slices/portal/initialState.ts
index 5ab8ca87db4..541d95f5a18 100644
--- a/src/store/chat/slices/portal/initialState.ts
+++ b/src/store/chat/slices/portal/initialState.ts
@@ -20,6 +20,7 @@ export enum PortalViewType {
TaskDetail = 'taskDetail',
Thread = 'thread',
ToolUI = 'toolUI',
+ VerifyReport = 'verifyReport',
VerifyResult = 'verifyResult',
}
@@ -58,6 +59,7 @@ export type PortalViewData =
| { startMessageId?: string; threadId?: string; type: PortalViewType.Thread }
| { agentId: string; type: PortalViewType.GroupThread }
| { taskId: string; type: PortalViewType.TaskDetail }
+ | { runId: string; type: PortalViewType.VerifyReport }
| { checkItemId: string; operationId: string; type: PortalViewType.VerifyResult };
// ============== Portal State ==============
diff --git a/src/store/chat/slices/portal/selectors.ts b/src/store/chat/slices/portal/selectors.ts
index ed0bb175664..732df310a5a 100644
--- a/src/store/chat/slices/portal/selectors.ts
+++ b/src/store/chat/slices/portal/selectors.ts
@@ -238,6 +238,7 @@ const toolUIParams = (s: ChatStoreState) => currentToolUI(s)?.params;
const currentVerifyResult = (s: ChatStoreState) => getViewData(s, PortalViewType.VerifyResult);
const verifyResultOperationId = (s: ChatStoreState) => currentVerifyResult(s)?.operationId;
const verifyResultCheckItemId = (s: ChatStoreState) => currentVerifyResult(s)?.checkItemId;
+const verifyReportRunId = (s: ChatStoreState) => getViewData(s, PortalViewType.VerifyReport)?.runId;
const isPluginUIOpen = (id: string) => (s: ChatStoreState) =>
toolMessageId(s) === id && showPortal(s);
@@ -310,6 +311,7 @@ export const chatPortalSelectors = {
// Verify result detail data
verifyResultOperationId,
verifyResultCheckItemId,
+ verifyReportRunId,
};
export * from './selectors/thread';