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(verify): ingest path for standalone verify run (#16132)

Arvin Xu52d2306793e8
diff --git a/apps/cli/src/commands/verify.test.ts b/apps/cli/src/commands/verify.test.ts
index 7fbcdfc7ad2..d7667012ffb 100644
--- a/apps/cli/src/commands/verify.test.ts
+++ b/apps/cli/src/commands/verify.test.ts
@@ -88,3 +88,45 @@ describe('verify rubric config commands', () => {
expect(printed).toContain('4');
});
});
+
+describe('verify evidence upload command', () => {
+ let exitSpy: ReturnType<typeof vi.spyOn>;
+
+ beforeEach(() => {
+ mockGetTrpcClient.mockReset();
+ exitSpy = vi.spyOn(process, 'exit').mockImplementation(((code?: number) => {
+ throw new Error(`process.exit ${code}`);
+ }) as any);
+ });
+
+ afterEach(() => {
+ exitSpy.mockRestore();
+ });
+
+ const run = async (args: string[]) => {
+ const program = new Command();
+ program.exitOverride();
+ registerVerifyCommand(program);
+ await program.parseAsync(['node', 'lh', 'verify', ...args]);
+ };
+
+ it('rejects evidence with both file and inline content', async () => {
+ await expect(
+ run([
+ 'evidence',
+ 'upload',
+ '--check',
+ 'result-1',
+ '--type',
+ 'text',
+ '--file',
+ 'artifact.txt',
+ '--content',
+ 'inline payload',
+ ]),
+ ).rejects.toThrow('process.exit 1');
+
+ expect(exitSpy).toHaveBeenCalledWith(1);
+ expect(mockGetTrpcClient).not.toHaveBeenCalled();
+ });
+});
diff --git a/apps/cli/src/commands/verify.ts b/apps/cli/src/commands/verify.ts
index e9a88d4e733..ecea898df39 100644
--- a/apps/cli/src/commands/verify.ts
+++ b/apps/cli/src/commands/verify.ts
@@ -1,9 +1,13 @@
+import { existsSync, readFileSync } from 'node:fs';
+import path from 'node:path';
+
import type { Command } from 'commander';
import pc from 'picocolors';
import { getTrpcClient } from '../api/client';
import { confirm, outputJson, printTable, timeAgo, truncate } from '../utils/format';
import { log } from '../utils/logger';
+import { uploadLocalFile } from '../utils/uploadLocalFile';
// ── Helpers ────────────────────────────────────────────────
@@ -32,6 +36,36 @@ function assertEnum<T extends string>(value: T | undefined, allowed: T[], flag:
}
}
+type Verdict = 'failed' | 'passed' | 'uncertain';
+type EvidenceType = 'dom_snapshot' | 'gif' | 'screenshot' | 'text' | 'transcript' | 'video';
+
+/** Map a free-form case/summary result token onto the verify verdict vocabulary. */
+function toVerdict(raw: unknown): Verdict {
+ const s = String(raw ?? '').toLowerCase();
+ if (['pass', 'passed', 'ok', 'success'].includes(s)) return 'passed';
+ if (['fail', 'failed', 'error'].includes(s)) return 'failed';
+ return 'uncertain'; // partial / blocked / skipped / pending / unknown
+}
+
+/** Pick an evidence medium from a file extension. */
+function evidenceTypeForFile(file: string): EvidenceType {
+ const ext = path.extname(file).toLowerCase().slice(1);
+ if (ext === 'gif') return 'gif';
+ if (['png', 'jpg', 'jpeg', 'webp', 'svg', 'bmp'].includes(ext)) return 'screenshot';
+ if (['mp4', 'webm', 'mov', 'm4v'].includes(ext)) return 'video';
+ if (['html', 'htm'].includes(ext)) return 'dom_snapshot';
+ return 'text';
+}
+
+/** Normalize a case's `evidence` field (string | string[] | {path}[]) to path strings. */
+function evidencePaths(evidence: unknown): string[] {
+ if (!evidence) return [];
+ const arr = Array.isArray(evidence) ? evidence : [evidence];
+ return arr
+ .map((e) => (typeof e === 'string' ? e : (e?.path ?? e?.file)))
+ .filter((p): p is string => typeof p === 'string' && p.length > 0);
+}
+
// ── Command Registration ───────────────────────────────────
export function registerVerifyCommand(program: Command) {
@@ -368,9 +402,9 @@ export function registerVerifyCommand(program: Command) {
console.log(`${pc.green('βœ“')} Skipped verification for run ${pc.bold(operationId)}`);
});
- // ════════════ run / results ════════════
+ // ════════════ execute (agent path) ════════════
verify
- .command('run <operationId>')
+ .command('execute <operationId>')
.description('Execute the confirmed plan against a deliverable (LLM judge)')
.requiredOption('--goal <goal>', "The run's task")
.requiredOption('--deliverable <text>', 'The output to judge')
@@ -406,13 +440,147 @@ export function registerVerifyCommand(program: Command) {
},
);
- verify
- .command('results <operationId>')
- .description('List check results for a run')
+ // ════════════ run (verification session entity) ════════════
+ const run = verify.command('run').description('Verification sessions (verify_runs)');
+
+ run
+ .command('create')
+ .description('Create a standalone verification session')
+ .option('--source <source>', 'agent | agent-testing', 'agent-testing')
+ .option('--operation <id>', 'Link to an existing Agent Run')
+ .option('--title <title>', 'Session title')
+ .option('--goal <goal>', 'Goal/task being verified')
.option('--json [fields]', 'Output JSON')
- .action(async (operationId: string, options: { json?: boolean | string }) => {
+ .action(
+ async (options: {
+ goal?: string;
+ json?: boolean | string;
+ operation?: string;
+ source?: string;
+ title?: string;
+ }) => {
+ const client = await getTrpcClient();
+ const created = await client.verify.createRun.mutate({
+ goal: options.goal,
+ operationId: options.operation,
+ source: options.source as any,
+ title: options.title,
+ });
+ if (options.json !== undefined) {
+ outputJson(created, typeof options.json === 'string' ? options.json : undefined);
+ return;
+ }
+ console.log(`${pc.green('βœ“')} Created run ${pc.bold(created.id)}`);
+ },
+ );
+
+ run
+ .command('list')
+ .description('List recent verification sessions')
+ .option('--json [fields]', 'Output JSON')
+ .action(async (options: { json?: boolean | string }) => {
+ const client = await getTrpcClient();
+ const runs = await client.verify.listRuns.query();
+ if (options.json !== undefined) {
+ outputJson(runs, typeof options.json === 'string' ? options.json : undefined);
+ return;
+ }
+ if (runs.length === 0) return void console.log('No runs found.');
+ printTable(
+ runs.map((r: any) => [
+ r.id,
+ truncate(r.title || '', 40),
+ r.source,
+ r.status ?? '',
+ r.operationId ? 'agent' : 'standalone',
+ r.createdAt ? timeAgo(r.createdAt) : '',
+ ]),
+ ['ID', 'TITLE', 'SOURCE', 'STATUS', 'KIND', 'CREATED'],
+ );
+ });
+
+ run
+ .command('get <runId>')
+ .description('Show a verification session')
+ .option('--json [fields]', 'Output JSON')
+ .action(async (runId: string, options: { json?: boolean | string }) => {
const client = await getTrpcClient();
- const results = await client.verify.listResults.query({ operationId });
+ const item = await client.verify.getRun.query({ verifyRunId: runId });
+ if (options.json !== undefined) {
+ outputJson(item, typeof options.json === 'string' ? options.json : undefined);
+ return;
+ }
+ if (!item) return void console.log('Run not found.');
+ console.log(JSON.stringify(item, null, 2));
+ });
+
+ // ════════════ result (check result entity) ════════════
+ const result = verify.command('result').description('Check results (verify_check_results)');
+
+ result
+ .command('ingest')
+ .description('Upsert one check result by (run, checkItemId) from a supplied verdict')
+ .requiredOption('--run <verifyRunId>', 'Target session id')
+ .requiredOption('--check <checkItemId>', 'Stable check item id within the session')
+ .requiredOption('--verdict <verdict>', 'passed|failed|uncertain')
+ .option('--title <title>', 'Check title')
+ .option('--index <n>', 'Display index')
+ .option('--confidence <n>', '0-1 confidence')
+ .option('--status <status>', 'pending|running|passed|failed|skipped (derived from verdict)')
+ .option('--evidence <text>', 'Key observation (stored as Toulmin evidence)')
+ .option('--suggestion <text>', 'Remediation hint')
+ .option('--soft', 'Non-blocking (required=false); defaults to blocking')
+ .option('--json [fields]', 'Output JSON')
+ .action(
+ async (options: {
+ check: string;
+ confidence?: string;
+ evidence?: string;
+ index?: string;
+ json?: boolean | string;
+ run: string;
+ soft?: boolean;
+ status?: string;
+ suggestion?: string;
+ title?: string;
+ verdict: string;
+ }) => {
+ const client = await getTrpcClient();
+ const created = await client.verify.ingestResult.mutate({
+ checkItemId: options.check,
+ checkItemIndex: options.index ? Number.parseInt(options.index, 10) : undefined,
+ checkItemTitle: options.title,
+ confidence: options.confidence ? Number.parseFloat(options.confidence) : undefined,
+ required: options.soft ? false : undefined,
+ status: options.status as any,
+ suggestion: options.suggestion,
+ toulmin: options.evidence ? { evidence: options.evidence } : undefined,
+ verdict: options.verdict as any,
+ verifyRunId: options.run,
+ });
+ if (options.json !== undefined) {
+ outputJson(created, typeof options.json === 'string' ? options.json : undefined);
+ return;
+ }
+ console.log(`${pc.green('βœ“')} Result ${pc.bold(created.id)} (${created.verdict})`);
+ },
+ );
+
+ result
+ .command('list')
+ .description('List check results β€” by session (--run) or by Agent Run (--operation)')
+ .option('--run <verifyRunId>', 'List by verification session')
+ .option('--operation <operationId>', 'List by Agent Run')
+ .option('--json [fields]', 'Output JSON')
+ .action(async (options: { json?: boolean | string; operation?: string; run?: string }) => {
+ if (!options.run && !options.operation) {
+ log.error('Provide either --run or --operation');
+ process.exit(1);
+ }
+ const client = await getTrpcClient();
+ const results = options.run
+ ? await client.verify.listResultsByRun.query({ verifyRunId: options.run })
+ : await client.verify.listResults.query({ operationId: options.operation! });
if (options.json !== undefined) {
outputJson(results, typeof options.json === 'string' ? options.json : undefined);
return;
@@ -421,6 +589,143 @@ export function registerVerifyCommand(program: Command) {
printResults(results);
});
+ // ════════════ evidence (artifact entity) ════════════
+ const evidence = verify.command('evidence').description('Evidence artifacts (verify_evidence)');
+
+ evidence
+ .command('upload')
+ .description('Attach an evidence artifact (file or inline text) to a check result')
+ .requiredOption('--check <checkResultId>', 'Target check result id')
+ .requiredOption('--type <type>', 'screenshot|gif|video|text|dom_snapshot|transcript')
+ .option('--file <path>', 'Local file to upload as the artifact')
+ .option('--content <text>', 'Inline text payload (instead of a file)')
+ .option('--by <capturedBy>', 'agent-browser|cdp|cli|program|llm_judge', 'cli')
+ .option('--desc <text>', 'Human-readable caption')
+ .option('--json [fields]', 'Output JSON')
+ .action(
+ async (options: {
+ by?: string;
+ check: string;
+ content?: string;
+ desc?: string;
+ file?: string;
+ json?: boolean | string;
+ type: string;
+ }) => {
+ if (Boolean(options.file) === Boolean(options.content)) {
+ log.error('Provide exactly one of --file or --content');
+ process.exit(1);
+ }
+ const client = await getTrpcClient();
+ let fileId: string | undefined;
+ if (options.file) {
+ const uploaded = await uploadLocalFile(client, options.file);
+ fileId = uploaded.id;
+ }
+ const ev = await client.verify.uploadEvidence.mutate({
+ capturedBy: options.by as any,
+ checkResultId: options.check,
+ content: options.content,
+ description: options.desc,
+ fileId,
+ type: options.type as any,
+ });
+ if (options.json !== undefined) {
+ outputJson(ev, typeof options.json === 'string' ? options.json : undefined);
+ return;
+ }
+ console.log(
+ `${pc.green('βœ“')} Evidence ${pc.bold(ev.id)}${fileId ? ` (file ${fileId})` : ''}`,
+ );
+ },
+ );
+
+ evidence
+ .command('list <checkResultId>')
+ .description('List evidence for a check result')
+ .option('--json [fields]', 'Output JSON')
+ .action(async (checkResultId: string, options: { json?: boolean | string }) => {
+ const client = await getTrpcClient();
+ const rows = await client.verify.listEvidence.query({ checkResultId });
+ if (options.json !== undefined) {
+ outputJson(rows, typeof options.json === 'string' ? options.json : undefined);
+ return;
+ }
+ if (rows.length === 0) return void console.log('No evidence.');
+ printTable(
+ rows.map((e: any) => [
+ e.id,
+ e.type,
+ e.capturedBy ?? '',
+ e.fileId ? 'file' : 'inline',
+ truncate(e.description || '', 40),
+ ]),
+ ['ID', 'TYPE', 'BY', 'PAYLOAD', 'DESC'],
+ );
+ });
+
+ // ════════════ report (narrative entity) ════════════
+ const report = verify.command('report').description('Verification reports (verify_reports)');
+
+ report
+ .command('upsert')
+ .description('Write (overwrite) the report for a session')
+ .requiredOption('--run <verifyRunId>', 'Target session id')
+ .option('--verdict <verdict>', 'passed|failed|uncertain')
+ .option('--summary <text>', 'Short summary')
+ .option('--content <markdown>', 'Full markdown body')
+ .option('--total <n>', 'Total checks')
+ .option('--passed <n>', 'Passed checks')
+ .option('--failed <n>', 'Failed checks')
+ .option('--uncertain <n>', 'Uncertain checks')
+ .option('--json [fields]', 'Output JSON')
+ .action(
+ async (options: {
+ content?: string;
+ failed?: string;
+ json?: boolean | string;
+ passed?: string;
+ run: string;
+ summary?: string;
+ total?: string;
+ uncertain?: string;
+ verdict?: string;
+ }) => {
+ const num = (s?: string) => (s === undefined ? undefined : Number.parseInt(s, 10));
+ const client = await getTrpcClient();
+ const created = await client.verify.upsertReport.mutate({
+ content: options.content,
+ failedChecks: num(options.failed),
+ passedChecks: num(options.passed),
+ summary: options.summary,
+ totalChecks: num(options.total),
+ uncertainChecks: num(options.uncertain),
+ verdict: options.verdict as any,
+ verifyRunId: options.run,
+ });
+ if (options.json !== undefined) {
+ outputJson(created, typeof options.json === 'string' ? options.json : undefined);
+ return;
+ }
+ console.log(`${pc.green('βœ“')} Report ${pc.bold(created.id)} (${created.verdict ?? 'β€”'})`);
+ },
+ );
+
+ report
+ .command('get <runId>')
+ .description('Show the report for a session')
+ .option('--json [fields]', 'Output JSON')
+ .action(async (runId: string, options: { json?: boolean | string }) => {
+ const client = await getTrpcClient();
+ const item = await client.verify.getReport.query({ verifyRunId: runId });
+ if (options.json !== undefined) {
+ outputJson(item, typeof options.json === 'string' ? options.json : undefined);
+ return;
+ }
+ if (!item) return void console.log('No report.');
+ console.log(JSON.stringify(item, null, 2));
+ });
+
// ════════════ feedback ════════════
verify
.command('decision <resultId> <decision>')
@@ -431,6 +736,128 @@ export function registerVerifyCommand(program: Command) {
await client.verify.submitDecision.mutate({ decision, resultId });
console.log(`${pc.green('βœ“')} Recorded ${pc.bold(decision)} on result ${pc.bold(resultId)}`);
});
+
+ // ════════════ ingest (aggregate convenience over the atomic commands) ════════════
+ verify
+ .command('ingest-report <reportDir>')
+ .description(
+ 'Ingest a local agent-testing report (result.json + report.md + assets) as a verify session',
+ )
+ .option('--source <source>', 'agent | agent-testing', 'agent-testing')
+ .option('--operation <id>', 'Link the session to an existing Agent Run')
+ .option('--title <title>', 'Override the session title')
+ .option('--goal <goal>', 'The goal/task being verified')
+ .option('--open', 'Print the in-app URL to open the report')
+ .option('--json [fields]', 'Output JSON')
+ .action(
+ async (
+ reportDir: string,
+ options: {
+ goal?: string;
+ json?: boolean | string;
+ open?: boolean;
+ operation?: string;
+ source?: string;
+ title?: string;
+ },
+ ) => {
+ const dir = path.resolve(reportDir);
+ const resultPath = path.join(dir, 'result.json');
+ if (!existsSync(resultPath)) {
+ log.error(`result.json not found in ${dir}`);
+ process.exit(1);
+ }
+
+ let result: any;
+ try {
+ result = JSON.parse(readFileSync(resultPath, 'utf8'));
+ } catch {
+ log.error('result.json is not valid JSON');
+ process.exit(1);
+ }
+
+ const cases: any[] = Array.isArray(result.cases) ? result.cases : [];
+ const summary = result.summary ?? {};
+ const reportMdPath = path.join(dir, 'report.md');
+ const content = existsSync(reportMdPath) ? readFileSync(reportMdPath, 'utf8') : undefined;
+
+ const client = await getTrpcClient();
+
+ // 1. Create the verification session.
+ const run = await client.verify.createRun.mutate({
+ goal: options.goal,
+ operationId: options.operation,
+ source: options.source as any,
+ title: options.title ?? result.title,
+ });
+
+ // 2. Ingest each case as a check result + its evidence.
+ let uploaded = 0;
+ for (const [index, c] of cases.entries()) {
+ const checkItemId = String(c.id ?? c.checkItemId ?? `case-${index + 1}`);
+ const verdict = toVerdict(c.result ?? c.status ?? c.verdict);
+ const observation = c.keyObservation ?? c.observation ?? c.note;
+ const checkResult = await client.verify.ingestResult.mutate({
+ checkItemId,
+ checkItemIndex: index,
+ checkItemTitle: c.name ?? c.case ?? c.title ?? checkItemId,
+ required: c.required ?? true,
+ // The case's key observation is recorded as Toulmin evidence; a real
+ // remediation hint (if the report provides one) goes to `suggestion`.
+ suggestion: typeof c.suggestion === 'string' ? c.suggestion : undefined,
+ toulmin: typeof observation === 'string' ? { evidence: observation } : undefined,
+ verdict,
+ verifierType: 'agent',
+ verifyRunId: run.id,
+ });
+
+ for (const rel of evidencePaths(c.evidence)) {
+ const abs = path.isAbsolute(rel) ? rel : path.join(dir, rel);
+ if (!existsSync(abs)) {
+ log.warn(`evidence not found, skipping: ${rel}`);
+ continue;
+ }
+ const file = await uploadLocalFile(client, abs);
+ await client.verify.uploadEvidence.mutate({
+ capturedBy: 'cli',
+ checkResultId: checkResult.id,
+ description: c.name ?? path.basename(abs),
+ fileId: file.id,
+ type: evidenceTypeForFile(abs),
+ });
+ uploaded += 1;
+ }
+ }
+
+ // 3. Write the report (full markdown + stats snapshot).
+ await client.verify.upsertReport.mutate({
+ content,
+ failedChecks: summary.failed,
+ passedChecks: summary.passed,
+ summary: typeof summary.note === 'string' ? summary.note : undefined,
+ totalChecks: summary.total ?? cases.length,
+ uncertainChecks: (summary.blocked ?? 0) + (summary.uncertain ?? 0) || undefined,
+ verdict: summary.verdict ? toVerdict(summary.verdict) : undefined,
+ verifyRunId: run.id,
+ });
+
+ if (options.json !== undefined) {
+ outputJson(
+ { cases: cases.length, evidence: uploaded, verifyRunId: run.id },
+ typeof options.json === 'string' ? options.json : undefined,
+ );
+ return;
+ }
+
+ console.log(
+ `${pc.green('βœ“')} Ingested ${pc.bold(String(cases.length))} case(s), ${pc.bold(String(uploaded))} evidence file(s)`,
+ );
+ console.log(`${pc.bold('verifyRunId')}: ${run.id}`);
+ if (options.open) {
+ console.log(`${pc.bold('open')}: /verify/${run.id}`);
+ }
+ },
+ );
}
function printResults(results: any[]): void {
diff --git a/apps/server/src/routers/lambda/__tests__/verify.test.ts b/apps/server/src/routers/lambda/__tests__/verify.test.ts
new file mode 100644
index 00000000000..cd339ff1b38
--- /dev/null
+++ b/apps/server/src/routers/lambda/__tests__/verify.test.ts
@@ -0,0 +1,252 @@
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+
+import { verifyRouter } from '@/server/routers/lambda/verify';
+import { FileService } from '@/server/services/file';
+
+const modelMocks = vi.hoisted(() => ({
+ findRunById: vi.fn(),
+ findResultById: vi.fn(),
+ getFullFileUrl: vi.fn(),
+ getServerDB: vi.fn(async () => ({})),
+ upsertByCheckItem: vi.fn(),
+}));
+
+vi.mock('@/database/core/db-adaptor', () => ({
+ getServerDB: modelMocks.getServerDB,
+}));
+
+vi.mock('@/database/models/verifyCheckResult', () => ({
+ VerifyCheckResultModel: vi.fn(() => ({
+ findById: modelMocks.findResultById,
+ upsertByCheckItem: modelMocks.upsertByCheckItem,
+ })),
+}));
+
+vi.mock('@/database/models/verifyRun', () => ({
+ VerifyRunModel: vi.fn(() => ({
+ findById: modelMocks.findRunById,
+ })),
+}));
+
+vi.mock('@/server/services/verify', () => ({
+ VerifyExecutorService: class VerifyExecutorService {},
+ VerifyFeedbackService: class VerifyFeedbackService {},
+ VerifyPlanGeneratorService: class VerifyPlanGeneratorService {},
+}));
+
+vi.mock('@/server/services/file', () => ({
+ FileService: vi.fn(() => ({
+ getFullFileUrl: modelMocks.getFullFileUrl,
+ })),
+}));
+
+const createCaller = () => verifyRouter.createCaller({ userId: 'verify-router-test-user' } as any);
+const createPublicCaller = () => verifyRouter.createCaller({} as any);
+
+const selectRows = <T>(rows: T[]) => ({
+ from: vi.fn(() => ({
+ where: vi.fn(() => ({
+ orderBy: vi.fn(async () => rows),
+ })),
+ })),
+});
+
+describe('verifyRouter', () => {
+ beforeEach(() => {
+ vi.clearAllMocks();
+ modelMocks.getServerDB.mockResolvedValue({});
+ vi.mocked(FileService).mockImplementation(
+ () =>
+ ({
+ getFullFileUrl: modelMocks.getFullFileUrl,
+ }) as any,
+ );
+ });
+
+ describe('ingestResult', () => {
+ it("rejects a run outside the caller's scope before upserting the result", async () => {
+ modelMocks.findRunById.mockResolvedValueOnce(undefined);
+
+ await expect(
+ createCaller().ingestResult({
+ checkItemId: 'shared-check',
+ checkItemTitle: 'attacker update',
+ status: 'passed',
+ verdict: 'passed',
+ verifyRunId: 'other-user-run',
+ }),
+ ).rejects.toThrow('Verification run not found');
+
+ expect(modelMocks.findRunById).toHaveBeenCalledWith('other-user-run');
+ expect(modelMocks.upsertByCheckItem).not.toHaveBeenCalled();
+ });
+ });
+
+ describe('uploadEvidence', () => {
+ it('rejects evidence with both inline content and fileId', async () => {
+ await expect(
+ createCaller().uploadEvidence({
+ checkResultId: 'result-1',
+ content: 'inline payload',
+ fileId: 'files-1',
+ type: 'text',
+ }),
+ ).rejects.toThrow('Provide exactly one of `content` or `fileId`.');
+ });
+
+ it('rejects evidence without inline content or fileId', async () => {
+ await expect(
+ createCaller().uploadEvidence({
+ checkResultId: 'result-1',
+ type: 'text',
+ }),
+ ).rejects.toThrow('Provide exactly one of `content` or `fileId`.');
+ });
+ });
+
+ describe('getReportBundle', () => {
+ it('reads a standalone report without a logged-in user', async () => {
+ const run = {
+ goal: 'Ship a working page',
+ id: 'run-1',
+ title: 'Run report',
+ userId: 'owner-user',
+ workspaceId: null,
+ };
+ const report = {
+ id: 'report-1',
+ totalChecks: 1,
+ verdict: 'passed',
+ verifyRunId: 'run-1',
+ };
+ const result = {
+ checkItemId: 'check-1',
+ checkItemIndex: 0,
+ checkItemTitle: 'Page renders',
+ id: 'result-1',
+ required: true,
+ status: 'passed',
+ verdict: 'passed',
+ verifyRunId: 'run-1',
+ };
+ const evidence = {
+ checkResultId: 'result-1',
+ content: null,
+ description: 'Homepage screenshot',
+ fileId: 'file-1',
+ id: 'evidence-1',
+ type: 'screenshot',
+ };
+ const serverDB = {
+ query: {
+ files: {
+ findFirst: vi.fn(async () => ({ id: 'file-1', url: 'verify/evidence.png' })),
+ },
+ verifyReports: {
+ findFirst: vi.fn(async () => report),
+ },
+ verifyRuns: {
+ findFirst: vi.fn(async () => run),
+ },
+ },
+ select: vi
+ .fn()
+ .mockReturnValueOnce(selectRows([result]))
+ .mockReturnValueOnce(selectRows([evidence])),
+ };
+ modelMocks.getServerDB.mockResolvedValue(serverDB);
+ modelMocks.getFullFileUrl.mockResolvedValue('https://cdn.example.com/verify/evidence.png');
+
+ const bundle = await createPublicCaller().getReportBundle({ verifyRunId: 'run-1' });
+
+ expect(bundle).toMatchObject({
+ report,
+ results: [
+ {
+ checkItemId: 'check-1',
+ evidence: [
+ {
+ fileId: 'file-1',
+ fileUrl: 'https://cdn.example.com/verify/evidence.png',
+ },
+ ],
+ },
+ ],
+ run,
+ });
+ expect(modelMocks.findRunById).not.toHaveBeenCalled();
+ });
+
+ it('keeps returning the bundle when file URL resolution is unavailable', async () => {
+ const consoleErrorSpy = vi.spyOn(console, 'error').mockImplementation(() => {});
+ vi.mocked(FileService).mockImplementation(() => {
+ throw new Error('S3 env missing');
+ });
+
+ const run = {
+ goal: 'Ship a working page',
+ id: 'run-1',
+ title: 'Run report',
+ userId: 'owner-user',
+ workspaceId: null,
+ };
+ const result = {
+ checkItemId: 'check-1',
+ checkItemIndex: 0,
+ checkItemTitle: 'Page renders',
+ id: 'result-1',
+ required: true,
+ status: 'passed',
+ verdict: 'passed',
+ verifyRunId: 'run-1',
+ };
+ const evidence = {
+ checkResultId: 'result-1',
+ content: null,
+ description: 'Homepage screenshot',
+ fileId: 'file-1',
+ id: 'evidence-1',
+ type: 'screenshot',
+ };
+ const serverDB = {
+ query: {
+ files: {
+ findFirst: vi.fn(async () => ({ id: 'file-1', url: 'verify/evidence.png' })),
+ },
+ verifyReports: {
+ findFirst: vi.fn(async () => null),
+ },
+ verifyRuns: {
+ findFirst: vi.fn(async () => run),
+ },
+ },
+ select: vi
+ .fn()
+ .mockReturnValueOnce(selectRows([result]))
+ .mockReturnValueOnce(selectRows([evidence])),
+ };
+ modelMocks.getServerDB.mockResolvedValue(serverDB);
+
+ const bundle = await createPublicCaller().getReportBundle({ verifyRunId: 'run-1' });
+
+ expect(bundle).toMatchObject({
+ results: [
+ {
+ evidence: [
+ {
+ fileId: 'file-1',
+ fileUrl: null,
+ },
+ ],
+ },
+ ],
+ run,
+ });
+ expect(consoleErrorSpy).toHaveBeenCalledWith(
+ '[verify:getReportBundle:resolveFileUrl]',
+ expect.any(Error),
+ );
+ consoleErrorSpy.mockRestore();
+ });
+ });
+});
diff --git a/apps/server/src/routers/lambda/verify.ts b/apps/server/src/routers/lambda/verify.ts
index 4276fbaded1..b9aac51fd4a 100644
--- a/apps/server/src/routers/lambda/verify.ts
+++ b/apps/server/src/routers/lambda/verify.ts
@@ -1,14 +1,26 @@
+import { TRPCError } from '@trpc/server';
+import { asc, eq } from 'drizzle-orm';
import { z } from 'zod';
import { wsCompatProcedure } from '@/business/server/trpc-middlewares/workspaceAuth';
import { AgentOperationModel } from '@/database/models/agentOperation';
+import { FileModel } from '@/database/models/file';
import { LlmGenerationTracingModel } from '@/database/models/llmGenerationTracing';
import { VerifyCheckResultModel } from '@/database/models/verifyCheckResult';
import { VerifyCriterionModel } from '@/database/models/verifyCriterion';
+import { VerifyEvidenceModel } from '@/database/models/verifyEvidence';
+import { VerifyReportModel } from '@/database/models/verifyReport';
import { VerifyRubricModel } from '@/database/models/verifyRubric';
import { VerifyRunModel } from '@/database/models/verifyRun';
-import { router } from '@/libs/trpc/lambda';
+import {
+ verifyCheckResults,
+ verifyEvidence,
+ verifyReports,
+ verifyRuns,
+} from '@/database/schemas/verify';
+import { publicProcedure, router } from '@/libs/trpc/lambda';
import { serverDatabase } from '@/libs/trpc/lambda/middleware';
+import { FileService } from '@/server/services/file';
import {
VerifyExecutorService,
VerifyFeedbackService,
@@ -19,6 +31,28 @@ const verifierTypeSchema = z.enum(['program', 'agent', 'llm']);
const onFailSchema = z.enum(['manual', 'auto_repair']);
const decisionSchema = z.enum(['accepted', 'rejected', 'overridden']);
const modelConfigSchema = z.object({ model: z.string(), provider: z.string() });
+const verdictSchema = z.enum(['passed', 'failed', 'uncertain']);
+const checkStatusSchema = z.enum(['pending', 'running', 'passed', 'failed', 'skipped']);
+const runSourceSchema = z.enum(['agent', 'agent-testing']);
+const evidenceTypeSchema = z.enum([
+ 'screenshot',
+ 'gif',
+ 'video',
+ 'text',
+ 'dom_snapshot',
+ 'transcript',
+]);
+const evidenceCapturedBySchema = z.enum(['agent-browser', 'cdp', 'cli', 'program', 'llm_judge']);
+const toulminSchema = z.object({
+ counterEvidence: z.string().optional(),
+ evidence: z.string().optional(),
+ limitation: z.string().optional(),
+ reasoning: z.string().optional(),
+});
+
+/** Derive the lifecycle status from a verdict when the caller doesn't pin one. */
+const statusForVerdict = (verdict: 'passed' | 'failed' | 'uncertain') =>
+ verdict === 'passed' ? ('passed' as const) : ('failed' as const);
/** Run-policy knobs persisted on a rubric (see VerifyRubricConfig). */
const rubricConfigSchema = z.object({
@@ -37,17 +71,35 @@ const checkItemSchema = z.object({
verifierType: verifierTypeSchema,
});
+const verifyRunIdInputSchema = z.object({ verifyRunId: z.string() });
+
+const uploadEvidenceInputSchema = z
+ .object({
+ capturedBy: evidenceCapturedBySchema.optional(),
+ // Exactly one of `content` (inline text) or `fileId` (already-uploaded artifact).
+ checkResultId: z.string(),
+ content: z.string().min(1).optional(),
+ description: z.string().optional(),
+ fileId: z.string().min(1).optional(),
+ type: evidenceTypeSchema,
+ })
+ .refine((data) => Boolean(data.content) !== Boolean(data.fileId), {
+ message: 'Provide exactly one of `content` or `fileId`.',
+ });
+
const verifyProcedure = wsCompatProcedure.use(serverDatabase).use(async (opts) => {
const { ctx } = opts;
const workspaceId = ctx.workspaceId ?? undefined;
return opts.next({
ctx: {
criterionModel: new VerifyCriterionModel(ctx.serverDB, ctx.userId, workspaceId),
+ evidenceModel: new VerifyEvidenceModel(ctx.serverDB, ctx.userId, workspaceId),
executorService: new VerifyExecutorService(ctx.serverDB, ctx.userId, workspaceId),
tracingModel: new LlmGenerationTracingModel(ctx.serverDB, ctx.userId, workspaceId),
feedbackService: new VerifyFeedbackService(ctx.serverDB, ctx.userId, workspaceId),
operationModel: new AgentOperationModel(ctx.serverDB, ctx.userId, workspaceId),
planGenerator: new VerifyPlanGeneratorService(ctx.serverDB, ctx.userId, workspaceId),
+ reportModel: new VerifyReportModel(ctx.serverDB, ctx.userId, workspaceId),
resultModel: new VerifyCheckResultModel(ctx.serverDB, ctx.userId, workspaceId),
rubricModel: new VerifyRubricModel(ctx.serverDB, ctx.userId, workspaceId),
runModel: new VerifyRunModel(ctx.serverDB, ctx.userId, workspaceId),
@@ -55,6 +107,31 @@ const verifyProcedure = wsCompatProcedure.use(serverDatabase).use(async (opts) =
});
});
+const publicVerifyReportProcedure = publicProcedure.use(serverDatabase);
+
+const resolveVerifyRun = async (ctx: { runModel: VerifyRunModel }, verifyRunId: string) => {
+ const run = await ctx.runModel.findById(verifyRunId);
+
+ if (!run) {
+ throw new TRPCError({ code: 'NOT_FOUND', message: 'Verification run not found' });
+ }
+
+ return run;
+};
+
+const resolveCheckResult = async (
+ ctx: { resultModel: VerifyCheckResultModel },
+ checkResultId: string,
+) => {
+ const result = await ctx.resultModel.findById(checkResultId);
+
+ if (!result) {
+ throw new TRPCError({ code: 'NOT_FOUND', message: 'Verification check result not found' });
+ }
+
+ return result;
+};
+
export const verifyRouter = router({
// ---- criteria (reusable atomic standards) ----
createCriterion: verifyProcedure
@@ -239,4 +316,202 @@ export const verifyRouter = router({
.mutation(async ({ ctx, input }) =>
ctx.feedbackService.submitDecision(input.resultId, input.decision),
),
+
+ // ---- ingest (standalone sessions: results / evidence / report, e.g. agent-testing) ----
+ // A verification session that isn't a live Agent Run (no executor): an external
+ // harness creates the run, ingests each check's verdict + evidence, and writes a
+ // report β€” all keyed by verifyRunId.
+ createRun: verifyProcedure
+ .input(
+ z.object({
+ goal: z.string().optional(),
+ operationId: z.string().optional(),
+ source: runSourceSchema.optional(),
+ title: z.string().optional(),
+ }),
+ )
+ .mutation(async ({ ctx, input }) =>
+ ctx.runModel.create({
+ goal: input.goal,
+ operationId: input.operationId,
+ source: input.source ?? 'agent-testing',
+ title: input.title,
+ }),
+ ),
+
+ getRun: verifyProcedure
+ .input(verifyRunIdInputSchema)
+ .query(async ({ ctx, input }) => ctx.runModel.findById(input.verifyRunId)),
+
+ listRuns: verifyProcedure.query(async ({ ctx }) => ctx.runModel.query()),
+
+ listResultsByRun: verifyProcedure.input(verifyRunIdInputSchema).query(async ({ ctx, input }) => {
+ const run = await resolveVerifyRun(ctx, input.verifyRunId);
+ return ctx.resultModel.listByRun(run.id);
+ }),
+
+ ingestResult: verifyProcedure
+ .input(
+ z.object({
+ checkItemId: z.string(),
+ checkItemIndex: z.number().optional(),
+ checkItemTitle: z.string().optional(),
+ confidence: z.number().min(0).max(1).optional(),
+ required: z.boolean().optional(),
+ status: checkStatusSchema.optional(),
+ suggestion: z.string().optional(),
+ toulmin: toulminSchema.optional(),
+ verdict: verdictSchema,
+ verifierType: verifierTypeSchema.optional(),
+ verifyRunId: z.string(),
+ }),
+ )
+ .mutation(async ({ ctx, input }) => {
+ const run = await resolveVerifyRun(ctx, input.verifyRunId);
+
+ return ctx.resultModel.upsertByCheckItem({
+ checkItemId: input.checkItemId,
+ checkItemIndex: input.checkItemIndex,
+ checkItemTitle: input.checkItemTitle,
+ completedAt: new Date(),
+ confidence: input.confidence,
+ required: input.required ?? true,
+ status: input.status ?? statusForVerdict(input.verdict),
+ suggestion: input.suggestion,
+ toulmin: input.toulmin,
+ verdict: input.verdict,
+ verifierType: input.verifierType ?? 'agent',
+ verifyRunId: run.id,
+ });
+ }),
+
+ uploadEvidence: verifyProcedure
+ .input(uploadEvidenceInputSchema)
+ .mutation(async ({ ctx, input }) => {
+ const result = await resolveCheckResult(ctx, input.checkResultId);
+
+ return ctx.evidenceModel.create({
+ capturedAt: new Date(),
+ capturedBy: input.capturedBy ?? null,
+ checkResultId: result.id,
+ content: input.content ?? null,
+ description: input.description ?? null,
+ fileId: input.fileId ?? null,
+ type: input.type,
+ });
+ }),
+
+ listEvidence: verifyProcedure
+ .input(z.object({ checkResultId: z.string() }))
+ .query(async ({ ctx, input }) => {
+ const result = await resolveCheckResult(ctx, input.checkResultId);
+ return ctx.evidenceModel.listByCheckResult(result.id);
+ }),
+
+ upsertReport: verifyProcedure
+ .input(
+ z.object({
+ content: z.string().optional(),
+ failedChecks: z.number().optional(),
+ generatedBy: z.string().optional(),
+ overallConfidence: z.number().min(0).max(1).optional(),
+ passedChecks: z.number().optional(),
+ summary: z.string().optional(),
+ totalChecks: z.number().optional(),
+ uncertainChecks: z.number().optional(),
+ verdict: verdictSchema.optional(),
+ verifyRunId: z.string(),
+ }),
+ )
+ .mutation(async ({ ctx, input }) => {
+ const run = await resolveVerifyRun(ctx, input.verifyRunId);
+
+ return ctx.reportModel.upsertByRun({
+ content: input.content ?? null,
+ failedChecks: input.failedChecks ?? null,
+ generatedBy: input.generatedBy ?? 'agent-testing',
+ overallConfidence: input.overallConfidence ?? null,
+ passedChecks: input.passedChecks ?? null,
+ summary: input.summary ?? null,
+ totalChecks: input.totalChecks ?? null,
+ uncertainChecks: input.uncertainChecks ?? null,
+ verdict: input.verdict ?? null,
+ verifyRunId: run.id,
+ });
+ }),
+
+ getReport: verifyProcedure.input(verifyRunIdInputSchema).query(async ({ ctx, input }) => {
+ const run = await resolveVerifyRun(ctx, input.verifyRunId);
+ return ctx.reportModel.findByRun(run.id);
+ }),
+
+ /**
+ * One-shot payload for the standalone report viewer: the session, its report,
+ * and every check result with its evidence β€” addressed purely by verifyRunId
+ * (no operation / chat context required).
+ */
+ getReportBundle: publicVerifyReportProcedure
+ .input(verifyRunIdInputSchema)
+ .query(async ({ ctx, input }) => {
+ const run = await ctx.serverDB.query.verifyRuns.findFirst({
+ where: eq(verifyRuns.id, input.verifyRunId),
+ });
+ if (!run) return null;
+ const [report, results] = await Promise.all([
+ ctx.serverDB.query.verifyReports.findFirst({
+ where: eq(verifyReports.verifyRunId, input.verifyRunId),
+ }),
+ ctx.serverDB
+ .select()
+ .from(verifyCheckResults)
+ .where(eq(verifyCheckResults.verifyRunId, input.verifyRunId))
+ .orderBy(asc(verifyCheckResults.checkItemIndex)),
+ ]);
+
+ // Resolve a displayable URL for each file-backed evidence artifact.
+ let fileService: FileService | null | undefined;
+ const getFileService = () => {
+ if (fileService !== undefined) return fileService;
+
+ try {
+ fileService = new FileService(ctx.serverDB, run.userId, run.workspaceId ?? undefined);
+ } catch (error) {
+ console.error('[verify:getReportBundle:resolveFileUrl]', error);
+ fileService = null;
+ }
+
+ return fileService;
+ };
+ const resolveFileUrl = async (fileId: string | null) => {
+ if (!fileId) return null;
+
+ try {
+ const file = await FileModel.getFileById(ctx.serverDB, fileId);
+ if (!file?.url) return null;
+
+ const service = getFileService();
+ return service ? await service.getFullFileUrl(file.url) : null;
+ } catch (error) {
+ console.error('[verify:getReportBundle:resolveFileUrl]', error);
+ return null;
+ }
+ };
+
+ const resultsWithEvidence = await Promise.all(
+ results.map(async (r) => {
+ const evidence = await ctx.serverDB
+ .select()
+ .from(verifyEvidence)
+ .where(eq(verifyEvidence.checkResultId, r.id))
+ .orderBy(asc(verifyEvidence.createdAt));
+ return {
+ ...r,
+ evidence: await Promise.all(
+ evidence.map(async (e) => ({ ...e, fileUrl: await resolveFileUrl(e.fileId) })),
+ ),
+ };
+ }),
+ );
+ return { report: report ?? null, results: resultsWithEvidence, run };
+ }),
});
diff --git a/packages/database/src/models/__tests__/verifyCheckResult.test.ts b/packages/database/src/models/__tests__/verifyCheckResult.test.ts
index 53d417d8301..d3b66ef5e1e 100644
--- a/packages/database/src/models/__tests__/verifyCheckResult.test.ts
+++ b/packages/database/src/models/__tests__/verifyCheckResult.test.ts
@@ -145,6 +145,77 @@ describe('VerifyCheckResultModel', () => {
expect(reloaded?.verifierTracingId).toBe(tracing.id);
});
+ it('upsertByCheckItem inserts then overwrites in place on the (run, item) key', async () => {
+ const model = new VerifyCheckResultModel(serverDB, userId);
+
+ const first = await model.upsertByCheckItem({
+ checkItemId: 'c1',
+ checkItemTitle: 'first',
+ status: 'failed',
+ verdict: 'failed',
+ verifierType: 'agent',
+ verifyRunId,
+ });
+ expect(first.verdict).toBe('failed');
+
+ const second = await model.upsertByCheckItem({
+ checkItemId: 'c1',
+ checkItemTitle: 'second',
+ status: 'passed',
+ verdict: 'passed',
+ verifierType: 'agent',
+ verifyRunId,
+ });
+
+ // same row, overwritten β€” the unique (verify_run_id, check_item_id) guard held
+ expect(second.id).toBe(first.id);
+ expect(second.verdict).toBe('passed');
+ expect(await model.listByRun(verifyRunId)).toHaveLength(1);
+ });
+
+ it('rejects upserting a colliding check item into another user run', async () => {
+ const otherUserId = 'verify-result-other-user';
+ const otherOperationId = 'verify-result-other-op';
+ await serverDB.insert(users).values([{ id: otherUserId }]);
+ await new AgentOperationModel(serverDB, otherUserId).recordStart({
+ operationId: otherOperationId,
+ });
+ const otherRun = await new VerifyRunModel(serverDB, otherUserId).ensureForOperation(
+ otherOperationId,
+ );
+ const otherModel = new VerifyCheckResultModel(serverDB, otherUserId);
+ const original = await otherModel.upsertByCheckItem({
+ checkItemId: 'shared-check',
+ checkItemTitle: 'other owner result',
+ status: 'failed',
+ verdict: 'failed',
+ verifierType: 'agent',
+ verifyRunId: otherRun.id,
+ });
+
+ await expect(
+ new VerifyCheckResultModel(serverDB, userId).upsertByCheckItem({
+ checkItemId: 'shared-check',
+ checkItemTitle: 'attacker update',
+ status: 'passed',
+ verdict: 'passed',
+ verifierType: 'agent',
+ verifyRunId: otherRun.id,
+ }),
+ ).rejects.toThrow('not found in the current workspace');
+
+ const [reloaded] = await otherModel.listByRun(otherRun.id);
+ expect(reloaded).toMatchObject({
+ checkItemTitle: 'other owner result',
+ id: original.id,
+ userId: otherUserId,
+ verdict: 'failed',
+ });
+ expect(await new VerifyCheckResultModel(serverDB, userId).listByRun(otherRun.id)).toHaveLength(
+ 0,
+ );
+ });
+
it('updates a result by its stable (verifyRunId, checkItemId) key', async () => {
const model = new VerifyCheckResultModel(serverDB, userId);
await model.create({ checkItemId: 'a', checkItemIndex: 0, verifierType: 'llm', verifyRunId });
@@ -198,4 +269,19 @@ describe('VerifyRunModel plan', () => {
expect(again.id).toBe(verifyRunId);
expect((await model.findByOperation(operationId))?.id).toBe(verifyRunId);
});
+
+ it('refuses to reserve a run for an operation owned by another user', async () => {
+ const otherUserId = 'verify-run-other-user';
+ await serverDB.insert(users).values([{ id: otherUserId }]);
+ // `operationId` belongs to `userId`; the attacker must not reserve its
+ // globally-unique operation_id under their own ownership.
+ const attacker = new VerifyRunModel(serverDB, otherUserId);
+ await expect(attacker.ensureForOperation(operationId)).rejects.toThrow();
+ await expect(attacker.create({ operationId, source: 'agent-testing' })).rejects.toThrow();
+
+ // The real owner is still able to reserve / find their run.
+ expect((await new VerifyRunModel(serverDB, userId).findByOperation(operationId))?.id).toBe(
+ verifyRunId,
+ );
+ });
});
diff --git a/packages/database/src/models/__tests__/verifyReport.test.ts b/packages/database/src/models/__tests__/verifyReport.test.ts
index 18cb58b713e..e494096d942 100644
--- a/packages/database/src/models/__tests__/verifyReport.test.ts
+++ b/packages/database/src/models/__tests__/verifyReport.test.ts
@@ -89,6 +89,49 @@ describe('VerifyReportModel', () => {
expect(all).toHaveLength(1);
});
+ it('rejects upserting a report for another user run without re-owning it', async () => {
+ const otherUserId = 'verify-report-other-user';
+ const otherOperationId = 'verify-report-other-op';
+ await serverDB.insert(users).values([{ id: otherUserId }]);
+ await new AgentOperationModel(serverDB, otherUserId).recordStart({
+ operationId: otherOperationId,
+ });
+ const otherRun = await new VerifyRunModel(serverDB, otherUserId).ensureForOperation(
+ otherOperationId,
+ );
+ const otherModel = new VerifyReportModel(serverDB, otherUserId);
+ const original = await otherModel.upsertByRun({
+ failedChecks: 1,
+ passedChecks: 0,
+ summary: 'Original owner report',
+ totalChecks: 1,
+ uncertainChecks: 0,
+ verdict: 'failed',
+ verifyRunId: otherRun.id,
+ });
+
+ await expect(
+ new VerifyReportModel(serverDB, userId).upsertByRun({
+ failedChecks: 0,
+ passedChecks: 1,
+ summary: 'Attacker report',
+ totalChecks: 1,
+ uncertainChecks: 0,
+ verdict: 'passed',
+ verifyRunId: otherRun.id,
+ }),
+ ).rejects.toThrow('not found in the current workspace');
+
+ const reloaded = await otherModel.findByRun(otherRun.id);
+ expect(reloaded).toMatchObject({
+ id: original.id,
+ summary: 'Original owner report',
+ userId: otherUserId,
+ verdict: 'failed',
+ });
+ expect(await new VerifyReportModel(serverDB, userId).findByRun(otherRun.id)).toBeUndefined();
+ });
+
it('marks a report reviewed by its run', async () => {
const model = new VerifyReportModel(serverDB, userId);
await model.upsertByRun({
diff --git a/packages/database/src/models/verifyCheckResult.ts b/packages/database/src/models/verifyCheckResult.ts
index a0fc5eb95f9..860ab561f09 100644
--- a/packages/database/src/models/verifyCheckResult.ts
+++ b/packages/database/src/models/verifyCheckResult.ts
@@ -1,7 +1,7 @@
import { and, asc, eq, inArray, isNull } from 'drizzle-orm';
import type { NewVerifyCheckResult, VerifyCheckResultItem } from '../schemas/verify';
-import { verifyCheckResults } from '../schemas/verify';
+import { verifyCheckResults, verifyRuns } from '../schemas/verify';
import type { LobeChatDatabase } from '../type';
import { buildWorkspacePayload, buildWorkspaceWhere } from '../utils/workspace';
@@ -19,7 +19,24 @@ export class VerifyCheckResultModel {
private ownership = () =>
buildWorkspaceWhere({ userId: this.userId, workspaceId: this.workspaceId }, verifyCheckResults);
+ private runOwnership = () =>
+ buildWorkspaceWhere({ userId: this.userId, workspaceId: this.workspaceId }, verifyRuns);
+
+ private assertRunOwned = async (verifyRunId: string): Promise<void> => {
+ const [run] = await this.db
+ .select({ id: verifyRuns.id })
+ .from(verifyRuns)
+ .where(and(eq(verifyRuns.id, verifyRunId), this.runOwnership()))
+ .limit(1);
+
+ if (!run) {
+ throw new Error(`Verify run "${verifyRunId}" not found in the current workspace`);
+ }
+ };
+
create = async (params: Omit<NewVerifyCheckResult, 'userId' | 'workspaceId'>) => {
+ if (typeof params.verifyRunId === 'string') await this.assertRunOwned(params.verifyRunId);
+
const [result] = await this.db
.insert(verifyCheckResults)
.values(buildWorkspacePayload({ userId: this.userId, workspaceId: this.workspaceId }, params))
@@ -31,6 +48,13 @@ export class VerifyCheckResultModel {
/** Batch-insert the initial `pending` rows when verify execution starts. */
createMany = async (rows: Omit<NewVerifyCheckResult, 'userId' | 'workspaceId'>[]) => {
if (rows.length === 0) return [];
+ const verifyRunIds = [
+ ...new Set(
+ rows.map((r) => r.verifyRunId).filter((id): id is string => typeof id === 'string'),
+ ),
+ ];
+ await Promise.all(verifyRunIds.map((verifyRunId) => this.assertRunOwned(verifyRunId)));
+
return this.db
.insert(verifyCheckResults)
.values(
@@ -41,6 +65,46 @@ export class VerifyCheckResultModel {
.returning();
};
+ /**
+ * Insert-or-update a result by its stable `(verifyRunId, checkItemId)` key.
+ * Used by the ingest path (e.g. agent-testing) which supplies a verdict for a
+ * check directly rather than running a verifier. Idempotent β€” re-ingesting the
+ * same check overwrites in place via the unique index.
+ */
+ upsertByCheckItem = async (
+ params: Omit<NewVerifyCheckResult, 'userId' | 'workspaceId'> & {
+ checkItemId: string;
+ verifyRunId: string;
+ },
+ ): Promise<VerifyCheckResultItem> => {
+ await this.assertRunOwned(params.verifyRunId);
+
+ const values = buildWorkspacePayload(
+ { userId: this.userId, workspaceId: this.workspaceId },
+ params,
+ );
+ // The conflict target and ownership keys identify the row, so they're excluded from the set.
+ const { verifyRunId: _r, checkItemId: _c, userId: _u, workspaceId: _w, ...mutable } = values;
+
+ const [row] = await this.db
+ .insert(verifyCheckResults)
+ .values(values)
+ .onConflictDoUpdate({
+ set: mutable,
+ setWhere: this.ownership(),
+ target: [verifyCheckResults.verifyRunId, verifyCheckResults.checkItemId],
+ })
+ .returning();
+
+ if (!row) {
+ throw new Error(
+ `Verify check result "${params.checkItemId}" not found in the current workspace`,
+ );
+ }
+
+ return row;
+ };
+
findById = async (id: string) => {
return this.db.query.verifyCheckResults.findFirst({
where: and(eq(verifyCheckResults.id, id), this.ownership()),
diff --git a/packages/database/src/models/verifyReport.ts b/packages/database/src/models/verifyReport.ts
index 242b16bf6f3..efe85b84ec3 100644
--- a/packages/database/src/models/verifyReport.ts
+++ b/packages/database/src/models/verifyReport.ts
@@ -1,7 +1,7 @@
import type { VerifyReport } from '@lobechat/types';
import { and, eq } from 'drizzle-orm';
-import { verifyReports } from '../schemas/verify';
+import { verifyReports, verifyRuns } from '../schemas/verify';
import type { LobeChatDatabase } from '../type';
import { buildWorkspacePayload, buildWorkspaceWhere } from '../utils/workspace';
@@ -22,26 +22,56 @@ export class VerifyReportModel {
private ownership = () =>
buildWorkspaceWhere({ userId: this.userId, workspaceId: this.workspaceId }, verifyReports);
+ private runOwnership = () =>
+ buildWorkspaceWhere({ userId: this.userId, workspaceId: this.workspaceId }, verifyRuns);
+
+ private assertRunOwned = async (verifyRunId: string): Promise<void> => {
+ const [run] = await this.db
+ .select({ id: verifyRuns.id })
+ .from(verifyRuns)
+ .where(and(eq(verifyRuns.id, verifyRunId), this.runOwnership()))
+ .limit(1);
+
+ if (!run) {
+ throw new Error(`Verify run "${verifyRunId}" not found in the current workspace`);
+ }
+ };
+
/**
* Write the report for a session. A report is unique per run (regenerating
* overwrites in place), so this upserts on the `verify_run_id` unique index
* rather than ever inserting a second row.
*/
upsertByRun = async (params: CreateVerifyReport) => {
+ await this.assertRunOwned(params.verifyRunId);
+
const values = buildWorkspacePayload(
{ userId: this.userId, workspaceId: this.workspaceId },
params,
);
- // `verify_run_id` is the conflict key, so it's excluded from the update set.
- const { verifyRunId: _verifyRunId, ...mutable } = values;
+ // The conflict target and ownership keys identify the row, so they're excluded from the set.
+ const {
+ verifyRunId: _verifyRunId,
+ userId: _userId,
+ workspaceId: _workspaceId,
+ ...mutable
+ } = values;
const [result] = await this.db
.insert(verifyReports)
.values(values)
- .onConflictDoUpdate({ set: mutable, target: verifyReports.verifyRunId })
+ .onConflictDoUpdate({
+ set: mutable,
+ setWhere: this.ownership(),
+ target: verifyReports.verifyRunId,
+ })
.returning();
+ if (!result) {
+ throw new Error(`Verify report "${params.verifyRunId}" not found in the current workspace`);
+ }
+
return result;
};
diff --git a/packages/database/src/models/verifyRun.ts b/packages/database/src/models/verifyRun.ts
index 7244355c93d..7fca9936d95 100644
--- a/packages/database/src/models/verifyRun.ts
+++ b/packages/database/src/models/verifyRun.ts
@@ -1,6 +1,7 @@
import type { VerifyCheckItem, VerifyRunSource, VerifyRunStatus } from '@lobechat/types';
-import { and, eq, isNull } from 'drizzle-orm';
+import { and, desc, eq, isNull } from 'drizzle-orm';
+import { agentOperations } from '../schemas/agentOperations';
import type { NewVerifyRun, VerifyRunItem } from '../schemas/verify';
import { verifyRuns } from '../schemas/verify';
import type { LobeChatDatabase } from '../type';
@@ -48,9 +49,42 @@ export class VerifyRunModel {
private ownership = () =>
buildWorkspaceWhere({ userId: this.userId, workspaceId: this.workspaceId }, verifyRuns);
+ /**
+ * Guard before reserving the (globally-unique) `operation_id` on a new run.
+ *
+ * A verify_run stamps the *current* caller's ownership, but `operation_id` is
+ * unique across the whole table β€” so reserving one for an Agent Run that isn't
+ * ours would (a) mis-attribute that operation's session to the wrong owner and
+ * (b) lock the real owner out: their later insert hits the unique conflict and
+ * the ownership-scoped re-read filters the stolen row away, yielding no run.
+ * Confirm the operation is actually owned by this user/workspace first.
+ */
+ private assertOperationOwned = async (operationId: string): Promise<void> => {
+ const [op] = await this.db
+ .select({ id: agentOperations.id })
+ .from(agentOperations)
+ .where(
+ and(
+ eq(agentOperations.id, operationId),
+ buildWorkspaceWhere(
+ { userId: this.userId, workspaceId: this.workspaceId },
+ agentOperations,
+ ),
+ ),
+ )
+ .limit(1);
+ if (!op) {
+ throw new Error(`Agent operation "${operationId}" not found in the current workspace`);
+ }
+ };
+
create = async (
params: Omit<NewVerifyRun, 'userId' | 'workspaceId'> & { source?: VerifyRunSource },
): Promise<VerifyRunItem> => {
+ // A caller-supplied operation link must belong to this owner before we
+ // reserve its unique operation_id (see {@link assertOperationOwned}).
+ if (params.operationId) await this.assertOperationOwned(params.operationId);
+
const [run] = await this.db
.insert(verifyRuns)
.values(buildWorkspacePayload({ userId: this.userId, workspaceId: this.workspaceId }, params))
@@ -64,6 +98,15 @@ export class VerifyRunModel {
});
};
+ /** Recent verification sessions for the current user/workspace, newest first. */
+ query = async (limit = 50) => {
+ return this.db.query.verifyRuns.findMany({
+ limit,
+ orderBy: [desc(verifyRuns.createdAt)],
+ where: this.ownership(),
+ });
+ };
+
/** The verification session bound to an Agent Run, or undefined when none yet. */
findByOperation = async (operationId: string) => {
return this.db.query.verifyRuns.findFirst({
@@ -82,6 +125,11 @@ export class VerifyRunModel {
const existing = await this.findByOperation(operationId);
if (existing) return existing;
+ // No run yet for an operation we can see β€” but `findByOperation` is scoped to
+ // our ownership, so a row could exist under another owner. Verify the
+ // operation is ours before reserving its unique operation_id.
+ await this.assertOperationOwned(operationId);
+
await this.db
.insert(verifyRuns)
.values(
diff --git a/src/features/Verify/ReportViewer.tsx b/src/features/Verify/ReportViewer.tsx
new file mode 100644
index 00000000000..0c201f97386
--- /dev/null
+++ b/src/features/Verify/ReportViewer.tsx
@@ -0,0 +1,223 @@
+'use client';
+
+import { Block, Flexbox, Icon, Markdown, Tag, Text } from '@lobehub/ui';
+import { createStyles } from 'antd-style';
+import { Check, CircleHelp, X } from 'lucide-react';
+import { memo } from 'react';
+import { useParams } from 'react-router';
+
+import Loading from '@/components/Loading/BrandTextLoading';
+import type { VerifyResultWithEvidence } from '@/services/verify';
+
+import { useVerifyReportBundle } from './hooks';
+
+const useStyles = createStyles(({ css, token }) => ({
+ container: css`
+ width: 100%;
+ max-width: 880px;
+ margin-block: 0;
+ margin-inline: auto;
+ padding: 24px;
+ `,
+ evidenceImg: css`
+ max-width: 100%;
+ max-height: 360px;
+ border: 1px solid ${token.colorBorderSecondary};
+ border-radius: ${token.borderRadiusLG}px;
+ `,
+ evidenceLink: css`
+ display: inline-flex;
+ align-items: center;
+
+ width: fit-content;
+ max-width: 100%;
+ padding-block: 6px;
+ padding-inline: 10px;
+ border: 1px solid ${token.colorBorderSecondary};
+ border-radius: ${token.borderRadius}px;
+
+ color: ${token.colorText};
+ text-decoration: none;
+
+ background: ${token.colorFillQuaternary};
+
+ &:hover {
+ border-color: ${token.colorLink};
+ color: ${token.colorLink};
+ }
+
+ span {
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ }
+ `,
+ evidenceText: css`
+ overflow: auto;
+
+ max-height: 200px;
+ padding-block: 8px;
+ padding-inline: 12px;
+ border-radius: ${token.borderRadius}px;
+
+ font-family: ${token.fontFamilyCode};
+ font-size: 12px;
+ white-space: pre-wrap;
+
+ background: ${token.colorFillQuaternary};
+ `,
+ evidenceVideo: css`
+ max-width: 100%;
+ max-height: 360px;
+ border: 1px solid ${token.colorBorderSecondary};
+ border-radius: ${token.borderRadiusLG}px;
+ `,
+ resultCard: css`
+ padding: 16px;
+ border: 1px solid ${token.colorBorderSecondary};
+ border-radius: ${token.borderRadiusLG}px;
+ background: ${token.colorBgContainer};
+ `,
+ stat: css`
+ font-size: 20px;
+ font-weight: 700;
+ font-variant-numeric: tabular-nums;
+ `,
+}));
+
+const VERDICT_META = {
+ failed: { color: 'error', icon: X, label: 'Failed' },
+ passed: { color: 'success', icon: Check, label: 'Passed' },
+ uncertain: { color: 'warning', icon: CircleHelp, label: 'Uncertain' },
+} as const;
+
+const imageEvidenceTypes = new Set(['gif', 'screenshot']);
+
+const VerdictTag = memo<{ verdict?: string | null }>(({ verdict }) => {
+ const meta = VERDICT_META[(verdict ?? 'uncertain') as keyof typeof VERDICT_META];
+ if (!meta) return null;
+ return (
+ <Tag color={meta.color} icon={<Icon icon={meta.icon} />}>
+ {meta.label}
+ </Tag>
+ );
+});
+
+const ResultItem = memo<{ result: VerifyResultWithEvidence }>(({ result }) => {
+ const { styles } = useStyles();
+ return (
+ <Block className={styles.resultCard} gap={12}>
+ <Flexbox horizontal align="center" gap={8} justify="space-between">
+ <Text strong>{result.checkItemTitle || result.checkItemId}</Text>
+ <Flexbox horizontal align="center" gap={8}>
+ {!result.required && <Tag>soft</Tag>}
+ <VerdictTag verdict={result.verdict ?? result.status} />
+ </Flexbox>
+ </Flexbox>
+ {result.suggestion && <Text type="secondary">{result.suggestion}</Text>}
+ {result.toulmin?.evidence && <Text type="secondary">{result.toulmin.evidence}</Text>}
+ {result.evidence.length > 0 && (
+ <Flexbox gap={8}>
+ {result.evidence.map((e) => (
+ <Flexbox gap={4} key={e.id}>
+ {e.description && (
+ <Text fontSize={12} type="secondary">
+ {e.description}
+ </Text>
+ )}
+ {e.fileUrl && imageEvidenceTypes.has(e.type) ? (
+ <img alt={e.description ?? e.type} className={styles.evidenceImg} src={e.fileUrl} />
+ ) : e.fileUrl && e.type === 'video' ? (
+ <video controls className={styles.evidenceVideo} src={e.fileUrl} />
+ ) : e.fileUrl ? (
+ <a
+ className={styles.evidenceLink}
+ href={e.fileUrl}
+ rel="noreferrer"
+ target="_blank"
+ >
+ <span>{e.description ?? e.type}</span>
+ </a>
+ ) : e.content ? (
+ <div className={styles.evidenceText}>{e.content}</div>
+ ) : (
+ <Tag>{e.type}</Tag>
+ )}
+ </Flexbox>
+ ))}
+ </Flexbox>
+ )}
+ </Block>
+ );
+});
+
+/**
+ * Standalone viewer for a verification session's report, addressed purely by
+ * `?id=<verifyRunId>` β€” no Agent Run / chat context required. Renders the report
+ * narrative plus every check result and its evidence.
+ */
+const ReportViewer = memo(() => {
+ const { styles } = useStyles();
+ const { runId } = useParams<{ runId: string }>();
+ const verifyRunId = runId ?? null;
+ const { data, isLoading } = useVerifyReportBundle(verifyRunId);
+
+ if (!verifyRunId)
+ return <Text type="danger">Missing report id (/verify/&lt;verifyRunId&gt;).</Text>;
+ if (isLoading) return <Loading debugId="verify-report-viewer" />;
+ if (!data) return <Text type="danger">Report not found.</Text>;
+
+ const { run, report, results } = data;
+
+ return (
+ <Flexbox className={styles.container} gap={24}>
+ <Flexbox gap={8}>
+ <Flexbox horizontal align="center" gap={12} justify="space-between">
+ <Text as="h2">{run.title || report?.summary || 'Verification report'}</Text>
+ <VerdictTag verdict={report?.verdict} />
+ </Flexbox>
+ {run.goal && <Text type="secondary">{run.goal}</Text>}
+ <Flexbox horizontal gap={24}>
+ <Flexbox>
+ <span className={styles.stat}>{report?.totalChecks ?? results.length}</span>
+ <Text fontSize={12} type="secondary">
+ total
+ </Text>
+ </Flexbox>
+ <Flexbox>
+ <Text className={styles.stat} type="success">
+ {report?.passedChecks ?? results.filter((r) => r.verdict === 'passed').length}
+ </Text>
+ <Text fontSize={12} type="secondary">
+ passed
+ </Text>
+ </Flexbox>
+ <Flexbox>
+ <Text className={styles.stat} type="danger">
+ {report?.failedChecks ?? results.filter((r) => r.verdict === 'failed').length}
+ </Text>
+ <Text fontSize={12} type="secondary">
+ failed
+ </Text>
+ </Flexbox>
+ </Flexbox>
+ </Flexbox>
+
+ <Flexbox gap={12}>
+ <Text as="h3">Checks</Text>
+ {results.map((r) => (
+ <ResultItem key={r.id} result={r} />
+ ))}
+ </Flexbox>
+
+ {report?.content && (
+ <Flexbox gap={8}>
+ <Text as="h3">Report</Text>
+ <Markdown>{report.content}</Markdown>
+ </Flexbox>
+ )}
+ </Flexbox>
+ );
+});
+
+export default ReportViewer;
diff --git a/src/features/Verify/hooks.ts b/src/features/Verify/hooks.ts
index 24b3a137187..0a84251248b 100644
--- a/src/features/Verify/hooks.ts
+++ b/src/features/Verify/hooks.ts
@@ -15,6 +15,12 @@ export const useVerifyResults = (operationId: string | null) =>
verifyService.listResults(operationId!),
);
+/** Full standalone report bundle (run + report + results + evidence) by verifyRunId. */
+export const useVerifyReportBundle = (verifyRunId: string | null) =>
+ useClientDataSWR(verifyRunId ? verifyKeys.reportBundle(verifyRunId) : null, () =>
+ verifyService.getReportBundle(verifyRunId!),
+ );
+
/** Model / token / latency for an LLM verifier judgment. Pass null to skip. */
export const useVerifierTracing = (tracingId: string | null | undefined) =>
useClientDataSWR(tracingId ? verifyKeys.tracing(tracingId) : null, () =>
diff --git a/src/libs/next/proxy/define-config.ts b/src/libs/next/proxy/define-config.ts
index 1471ae082e5..771048a5bb5 100644
--- a/src/libs/next/proxy/define-config.ts
+++ b/src/libs/next/proxy/define-config.ts
@@ -217,6 +217,9 @@ export function defineConfig() {
'/market-auth-callback',
// public share pages
'/share(.*)',
+ // standalone verification report viewer β€” the run id in the URL is the
+ // read-only capability for viewing the report without a signed-in session.
+ '/verify/(.*)',
// messenger verify-im β€” page itself handles unauth (in-page sign-in CTA)
// and the random_id token is the actual capability check; no need for
// session-protected access at the middleware layer.
diff --git a/src/libs/swr/keys.ts b/src/libs/swr/keys.ts
index 9c5437a4ee4..685a208babd 100644
--- a/src/libs/swr/keys.ts
+++ b/src/libs/swr/keys.ts
@@ -598,6 +598,10 @@ export const verifyKeys = {
'verify:instruction',
documentId,
]),
+ reportBundle: def('verify:reportBundle', (verifyRunId: string) => [
+ 'verify:reportBundle',
+ verifyRunId,
+ ]),
results: def('verify:results', (operationId: string) => ['verify:results', operationId]),
rubric: def('verify:rubric', (rubricId: string) => ['verify:rubric', rubricId]),
state: def('verify:state', (operationId: string) => ['verify:state', operationId]),
diff --git a/src/proxy.ts b/src/proxy.ts
index 02739efdfc3..76b6d412488 100644
--- a/src/proxy.ts
+++ b/src/proxy.ts
@@ -42,6 +42,7 @@ export const config = {
'/signin(.*)',
'/verify-email(.*)',
'/verify-im(.*)',
+ '/verify/(.*)',
'/reset-password(.*)',
'/auth-error(.*)',
'/oauth(.*)',
diff --git a/src/routes/verify/[runId]/index.tsx b/src/routes/verify/[runId]/index.tsx
new file mode 100644
index 00000000000..715b3eb175d
--- /dev/null
+++ b/src/routes/verify/[runId]/index.tsx
@@ -0,0 +1,14 @@
+'use client';
+
+import { Flexbox } from '@lobehub/ui';
+
+import ReportViewer from '@/features/Verify/ReportViewer';
+
+/** Standalone verification-report page: `/verify/:runId`. */
+const VerifyReportPage = () => (
+ <Flexbox height={'100dvh'} style={{ overflow: 'auto' }} width={'100%'}>
+ <ReportViewer />
+ </Flexbox>
+);
+
+export default VerifyReportPage;
diff --git a/src/services/verify.ts b/src/services/verify.ts
index 93fc61cf2e2..f0cefba7c3e 100644
--- a/src/services/verify.ts
+++ b/src/services/verify.ts
@@ -1,7 +1,9 @@
import type {
VerifierType,
VerifyCheckItem,
+ VerifyEvidence,
VerifyOnFailStrategy,
+ VerifyReport,
VerifyRubricConfig,
VerifyUserDecision,
} from '@lobechat/types';
@@ -11,6 +13,7 @@ import type {
VerifyCheckResultItem,
VerifyCriterionItem,
VerifyRubricItem,
+ VerifyRunItem,
} from '@/database/schemas/verify';
import { lambdaClient } from '@/libs/trpc/client';
@@ -31,6 +34,21 @@ export interface VerifyStateResponse {
verifyStatus: VerifyStatus | null;
}
+/** One evidence artifact plus its resolved (signed) file URL, when file-backed. */
+export type VerifyEvidenceWithUrl = VerifyEvidence & { fileUrl: string | null };
+
+/** One check result plus the evidence artifacts attached to it. */
+export type VerifyResultWithEvidence = VerifyCheckResultItem & {
+ evidence: VerifyEvidenceWithUrl[];
+};
+
+/** Everything the standalone report viewer needs for one verification session. */
+export interface VerifyReportBundle {
+ report: VerifyReport | null;
+ results: VerifyResultWithEvidence[];
+ run: VerifyRunItem;
+}
+
export interface GenerateDraftPlanInput {
context?: string;
enableAiGeneration?: boolean;
@@ -83,6 +101,12 @@ export class VerifyService {
listResults = (operationId: string): Promise<VerifyCheckResultItem[]> =>
lambdaClient.verify.listResults.query({ operationId }) as Promise<VerifyCheckResultItem[]>;
+ /** Full report payload for the standalone viewer, addressed by verifyRunId. */
+ getReportBundle = (verifyRunId: string): Promise<VerifyReportBundle | null> =>
+ lambdaClient.verify.getReportBundle.query({
+ verifyRunId,
+ }) as Promise<VerifyReportBundle | null>;
+
executeVerify = (input: {
batchLlm?: boolean;
deliverable: string;
diff --git a/src/spa/router/desktopRouter.config.desktop.tsx b/src/spa/router/desktopRouter.config.desktop.tsx
index 491128cc78e..72c97dc4359 100644
--- a/src/spa/router/desktopRouter.config.desktop.tsx
+++ b/src/spa/router/desktopRouter.config.desktop.tsx
@@ -121,6 +121,7 @@ import SharePagePage from '@/routes/share/page/[id]';
import ShareTopicPage from '@/routes/share/t/[id]';
import ShareTopicLayout from '@/routes/share/t/[id]/_layout';
import { shareTopicRouteMeta } from '@/routes/share/t/[id]/routeMeta';
+import VerifyReportPage from '@/routes/verify/[runId]';
import VerifyImPage from '@/routes/verify-im';
import { routeMeta } from '@/spa/router/routeMeta';
import { SettingsTabs } from '@/store/global/initialState';
@@ -751,6 +752,13 @@ export const desktopRoutes: RouteObject[] = [
path: '/verify-im',
},
+ // Standalone verification-report viewer (outside main layout)
+ {
+ element: <VerifyReportPage />,
+ errorElement: <ErrorBoundary />,
+ path: '/verify/:runId',
+ },
+
// Devtools route (outside main layout, dev-only)
...(__DEV__
? [
diff --git a/src/spa/router/desktopRouter.config.tsx b/src/spa/router/desktopRouter.config.tsx
index 1ef479d2257..ce2cb933c08 100644
--- a/src/spa/router/desktopRouter.config.tsx
+++ b/src/spa/router/desktopRouter.config.tsx
@@ -955,6 +955,13 @@ export const desktopRoutes: RouteObject[] = [
path: '/verify-im',
},
+ // Standalone verification-report viewer (outside main layout)
+ {
+ element: dynamicElement(() => import('@/routes/verify/[runId]'), 'Desktop > VerifyReport'),
+ errorElement: <ErrorBoundary />,
+ path: '/verify/:runId',
+ },
+
// Devtools route (outside main layout, dev-only)
...(__DEV__
? [
diff --git a/src/spa/router/mobileRouter.config.tsx b/src/spa/router/mobileRouter.config.tsx
index 961a8d04ee7..feea94c4acc 100644
--- a/src/spa/router/mobileRouter.config.tsx
+++ b/src/spa/router/mobileRouter.config.tsx
@@ -531,4 +531,11 @@ export const mobileRoutes: RouteObject[] = [
errorElement: <ErrorBoundary />,
path: '/verify-im',
},
+
+ // Standalone verification-report viewer (outside main layout)
+ {
+ element: dynamicElement(() => import('@/routes/verify/[runId]'), 'Mobile > VerifyReport'),
+ errorElement: <ErrorBoundary />,
+ path: '/verify/:runId',
+ },
];