import assert from 'node:assert/strict' import { execFileSync } from 'node:child_process' import { readdirSync, readFileSync, statSync } from 'node:fs' import test from 'node:test' import { fileURLToPath } from 'node:url' function readSource(path) { try { return readFileSync(fileURLToPath(new URL(path, import.meta.url)), 'utf8') } catch { return '' } } function readRuleBody(source, selector) { const escapedSelector = selector.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') const match = source.match(new RegExp(`${escapedSelector}\\s*\\{([\\s\\S]*?)\\}`)) return match?.[1] || '' } function countGifFrameBlocks(buffer) { let count = 0 for (let index = 0; index < buffer.length - 2; index += 1) { if (buffer[index] === 0x21 && buffer[index + 1] === 0xf9 && buffer[index + 2] === 0x04) { count += 1 } } return count } function measureGifMotion(assetPath) { const script = ` from PIL import Image, ImageSequence import json import sys image = Image.open(sys.argv[1]) frames = [frame.convert("RGB").resize((64, 64)) for frame in ImageSequence.Iterator(image)] def delta(left, right): left_pixels = left.load() right_pixels = right.load() total = 0 for y in range(64): for x in range(64): a = left_pixels[x, y] b = right_pixels[x, y] total += abs(a[0] - b[0]) + abs(a[1] - b[1]) + abs(a[2] - b[2]) return total / (64 * 64 * 3) adjacent = [delta(frames[index], frames[index + 1]) for index in range(len(frames) - 1)] adjacent_sorted = sorted(adjacent) median = adjacent_sorted[len(adjacent_sorted) // 2] print(json.dumps({ "medianAdjacentDelta": median, "seamDelta": delta(frames[-1], frames[0]) })) ` return JSON.parse(execFileSync('python3', ['-', assetPath], { encoding: 'utf8', input: script }).trim()) } function measureGifDuration(assetPath) { const script = ` from PIL import Image import sys image = Image.open(sys.argv[1]) total = 0 for index in range(getattr(image, "n_frames", 1)): image.seek(index) total += image.info.get("duration", 0) print(total) ` return Number(execFileSync('python3', ['-', assetPath], { encoding: 'utf8', input: script }).trim()) } function measureOrbAssetPresentation(assetPath) { const script = ` from PIL import Image import json import sys image = Image.open(sys.argv[1]) frame_count = getattr(image, "n_frames", 1) width, height = image.size minimum_corner_luma = 255 maximum_corner_luma = 0 minimum_background_similarity_ratio = 1 minimum_foreground_width_ratio = 1 minimum_foreground_height_ratio = 1 for index in range(frame_count): if frame_count > 1: image.seek(index) rgb = image.convert("RGB") corners = [ rgb.getpixel((0, 0)), rgb.getpixel((width - 1, 0)), rgb.getpixel((0, height - 1)), rgb.getpixel((width - 1, height - 1)), ] corner_lumas = [sum(pixel) / 3 for pixel in corners] minimum_corner_luma = min(minimum_corner_luma, min(corner_lumas)) maximum_corner_luma = max(maximum_corner_luma, max(corner_lumas)) background = tuple(round(sum(pixel[channel] for pixel in corners) / len(corners)) for channel in range(3)) foreground_mask = Image.new("L", (width, height), 0) foreground_pixels = foreground_mask.load() background_similarity = 0 rgb_pixels = rgb.load() for y in range(height): for x in range(width): pixel = rgb_pixels[x, y] diff = sum(abs(pixel[channel] - background[channel]) for channel in range(3)) if diff > 22: foreground_pixels[x, y] = 255 if diff <= 12: background_similarity += 1 foreground_box = foreground_mask.getbbox() if foreground_box: minimum_foreground_width_ratio = min( minimum_foreground_width_ratio, (foreground_box[2] - foreground_box[0]) / width ) minimum_foreground_height_ratio = min( minimum_foreground_height_ratio, (foreground_box[3] - foreground_box[1]) / height ) minimum_background_similarity_ratio = min( minimum_background_similarity_ratio, background_similarity / (width * height) ) print(json.dumps({ "minimumCornerLuma": minimum_corner_luma, "maximumCornerLuma": maximum_corner_luma, "minimumBackgroundSimilarityRatio": minimum_background_similarity_ratio, "minimumForegroundWidthRatio": minimum_foreground_width_ratio, "minimumForegroundHeightRatio": minimum_foreground_height_ratio, "width": width, "height": height })) ` return JSON.parse(execFileSync('python3', ['-', assetPath], { encoding: 'utf8', input: script }).trim()) } const appShell = readSource('../src/views/AppShellRouteView.vue') const workbenchView = readSource('../src/views/PersonalWorkbenchView.vue') const aiMode = readSource('../src/components/business/PersonalWorkbenchAiMode.vue') const aiModeTemplate = readSource('../src/components/business/PersonalWorkbenchAiMode.template.html') const aiModeComposer = readSource('../src/components/business/workbench-ai/WorkbenchAiComposer.vue') const aiModeFileStrip = readSource('../src/components/business/workbench-ai/WorkbenchAiFileStrip.vue') const aiModeRuntimeDir = fileURLToPath(new URL('../src/composables/workbenchAiMode/', import.meta.url)) const aiModeRuntime = readdirSync(aiModeRuntimeDir) .filter((file) => file.endsWith('.js')) .sort() .map((file) => readFileSync(new URL(`../src/composables/workbenchAiMode/${file}`, import.meta.url), 'utf8')) .join('\n') const aiModeSurface = `${aiMode}\n${aiModeTemplate}\n${aiModeComposer}\n${aiModeFileStrip}\n${aiModeRuntime}` const aiModeStyles = readSource('../src/assets/styles/components/personal-workbench-ai-mode.css') const workbenchViewStyles = readSource('../src/assets/styles/views/personal-workbench-view.css') const appStyles = readSource('../src/assets/styles/app.css') const aiBackgroundRule = readRuleBody(aiModeStyles, '.workbench-ai-mode::after') const orbRule = readRuleBody(aiModeStyles, '.workbench-ai-orb') const orbImageRule = readRuleBody(aiModeStyles, '.workbench-ai-orb__image') const composerRule = readRuleBody(aiModeStyles, '.workbench-ai-composer') const composerTextareaRule = readRuleBody(aiModeStyles, '.workbench-ai-composer textarea') const fileStripRule = readRuleBody(aiModeStyles, '.workbench-ai-file-strip') const fileCardRule = readRuleBody(aiModeStyles, '.workbench-ai-file-card') const orbIconAsset = fileURLToPath( new URL('../src/assets/workbench-ai-mode-orb-icon.gif', import.meta.url) ) const orbIconPngAsset = fileURLToPath( new URL('../src/assets/workbench-ai-mode-orb-icon.png', import.meta.url) ) const orbIconBuffer = readFileSync(orbIconAsset) test('app shell owns the workbench mode and wires it through topbar and content', () => { assert.match(appShell, /function resolveDefaultWorkbenchMode\(user\)\s*\{[\s\S]*isPlatformAdminUser\(user\)[\s\S]*'traditional'[\s\S]*'ai'/) assert.match(appShell, /const workbenchMode = ref\(resolveDefaultWorkbenchMode\(currentUser\.value\)\)/) assert.doesNotMatch(appShell, /const workbenchMode = ref\('traditional'\)/) assert.match(appShell, /watch\(\s*\(\) => currentUser\.value,[\s\S]*resolveDefaultWorkbenchMode\(user\)/) assert.match(appShell, /function toggleWorkbenchMode\(\)/) assert.match(appShell, /const nextMode = workbenchMode\.value === 'ai' \? 'traditional' : 'ai'/) assert.match(appShell, /sidebarCollapsedBeforeAiMode\.value = sidebarCollapsed\.value/) assert.match(appShell, /workbenchMode\.value = nextMode/) assert.match(appShell, /sidebarCollapsed\.value = sidebarCollapsedBeforeAiMode\.value/) assert.match(appShell, / workbenchMode\.value === 'ai'\)/) assert.match(appShell, /const isWorkbenchAiMode = computed\(\(\) => activeView\.value === 'workbench' && workbenchMode\.value === 'ai'\)/) assert.match(appShell, /'workbench-ai-sidebar-active': isAiShellMode/) assert.match(appShell, /'workbench-workarea-ai-mode': isWorkbenchAiMode/) assert.match(appStyles, /\.workarea\.workbench-workarea\.workbench-workarea-ai-mode\s*\{[\s\S]*padding:\s*0;[\s\S]*background:\s*transparent;/) }) test('personal workbench view swaps the traditional dashboard with the AI mode screen', () => { assert.match(workbenchView, /import PersonalWorkbenchAiMode from '\.\.\/components\/business\/PersonalWorkbenchAiMode\.vue'/) assert.match(workbenchView, / { assert.match(aiModeSurface, /personal-workbench-ai-mode\.css/) assert.doesNotMatch(aiModeSurface, /workbench-ai-mode-robot-bg\.png/) assert.match(aiModeSurface, /workbench-ai-mode-orb-icon\.gif/) assert.match(aiModeSurface, / isLikelyReceiptAssociationFile\(file\)\)/) assert.match(aiModeSurface, /!shouldKeepAiAttachmentInAssistantReply\(prompt\)/) assert.match(aiModeSurface, /const aiAttachmentAssociationRuntime = new Map\(\)/) assert.match(aiModeSurface, /function findAiAttachmentAssociationRuntime\(options = \{\}\)/) assert.match(aiModeSurface, /resolveAiAttachmentAssociationClaimNo\(actionPayload\)/) assert.match(aiModeSurface, /if \(actionType === AI_ATTACHMENT_OCR_DETAIL_ACTION\)/) assert.match(aiModeSurface, /const collected = await collectAiModeReceiptContext\(files\)/) assert.match(aiModeSurface, /const claims = extractExpenseClaimItems\(claimsPayload\)/) assert.match(aiModeSurface, /aiAttachmentAssociationModel\.resolveAiAttachmentAssociationMatch\(claims, collected\.ocrDocuments\)/) assert.match(aiModeSurface, /aiAttachmentAssociationRuntime\.set\(associationId/) assert.match(aiModeSurface, /attachmentOcrDetails,\s*[\s\S]*includeOcrDetails: Boolean\(attachmentOcrDetails\)/) assert.match(aiModeSurface, /async function confirmAiAttachmentAssociation\(actionPayload = \{\}, sourceMessage = null\)/) assert.match(aiModeSurface, /syncExpenseClaimFilesToDraft\(\{[\s\S]*fetchExpenseClaimDetail,[\s\S]*createExpenseClaimItem,[\s\S]*uploadExpenseClaimItemAttachment/) assert.match(aiModeSurface, /if \(actionType === AI_ATTACHMENT_ASSOCIATION_CONFIRM_ACTION\)/) assert.match(aiModeSurface, /if \(shouldRunAiAttachmentAutoAssociation\(entry, files, cleanPrompt\)\) \{[\s\S]*requestAiAttachmentAssociationReply\(cleanPrompt, entry, files\)/) assert.match(aiModeSurface, /const fileMergeResult = mergeFilesWithLimit\(selectedFiles\.value, Array\.from\(event\.target\.files \|\| \[\]\), MAX_ATTACHMENTS\)/) assert.match(aiModeSurface, /selectedFiles\.value = fileMergeResult\.files/) assert.doesNotMatch(aiModeSurface, /selectedFiles\.value = Array\.from\(event\.target\.files \|\| \[\]\)\.slice\(0, 10\)/) assert.doesNotMatch(aiModeSurface, /已选择 \{\{ selectedFiles\.length \}\} 份附件/) assert.match(aiModeSurface, /Axiom Ultra 3\.1/) assert.match(aiModeSurface, /mdi mdi-calendar-range/) assert.match(aiModeSurface, /workbench-ai-date-popover/) assert.match(aiModeSurface, /type="date"/) assert.match(aiModeSurface, /:min="resolveInlineApplicationPreviewEditorDateMin\(message, row\.key\)"/) assert.match(aiModeSurface, /:max="resolveInlineApplicationPreviewEditorDateMax\(message, row\.key\)"/) assert.match(aiModeSurface, /resolveInlineApplicationPreviewEditorControl\(row\.key\) === 'date'/) assert.match(aiModeSurface, /class="\['application-preview-input', 'application-preview-date-input', `application-preview-input--\$\{row\.key\}`\]"/) assert.match(aiModeSurface, /function resolveInlineApplicationPreviewEditorControl\(fieldKey\) \{[\s\S]*return resolveApplicationPreviewEditorControl\(fieldKey\)/) assert.match(aiModeSurface, /function resolveInlineApplicationPreviewEditorDateMin\(message, fieldKey\) \{[\s\S]*return resolveApplicationPreviewEditorDateMin\?\.\(message, fieldKey\) \|\| ''/) assert.match(aiModeSurface, /function resolveInlineApplicationPreviewEditorDateMax\(message, fieldKey\) \{[\s\S]*return resolveApplicationPreviewEditorDateMax\?\.\(message, fieldKey\) \|\| ''/) assert.doesNotMatch(aiModeSurface, /return control === 'date' \? 'text' : control/) assert.doesNotMatch(aiModeSurface, /mdi mdi-web/) assert.match(aiModeSurface, /mdi mdi-microphone-outline/) assert.match(aiModeSurface, /mdi mdi-arrow-up/) assert.match(aiModeSurface, /快速开始/) assert.match(aiModeSurface, /action-icon-wrapper/) assert.match(aiModeSurface, /发起报销/) assert.match(aiModeSurface, /查询预算/) assert.match(aiModeSurface, /解释制度/) assert.match(aiModeSurface, /催办审批/) assert.match(aiModeSurface, //) assert.match(aiModeSurface, /@submit\.prevent="runtime\.submitAiModePrompt"/) assert.equal((aiModeSurface.match(/ \{[\s\S]*forceInlineConversationToBottom\(\)[\s\S]*\}\)/) assert.match(aiModeSurface, /window\.setTimeout\(\(\) => \{[\s\S]*if \(inlineConversationAutoScrollPinned\.value\) \{[\s\S]*forceInlineConversationToBottom\(\)[\s\S]*\}[\s\S]*\}, INLINE_LAYOUT_SETTLE_SCROLL_DELAY_MS\)/) assert.match(aiModeSurface, /const shouldAutoScroll = inlineConversationAutoScrollPinned\.value[\s\S]*updateInlineMessageContent\(message, streamedContent\)[\s\S]*scrollInlineConversationToBottom\(\{ force: shouldAutoScroll \}\)/) assert.match(aiModeSurface, /const shouldAutoScroll = inlineConversationAutoScrollPinned\.value[\s\S]*appendInlineMessageContent\(message, data\.delta \|\| data\.content \|\| data\.text \|\| ''\)[\s\S]*scrollInlineConversationToBottom\(\{ force: shouldAutoScroll \}\)/) assert.match(aiModeSurface, /inlineConversationAutoScrollPinned\.value = true[\s\S]*conversationMessages\.value\.push\(createInlineMessage\('user', cleanPrompt\)\)/) assert.match(aiModeSurface, /function openInlineRecentConversation\(item = \{\}\) \{[\s\S]*inlineConversationAutoScrollPinned\.value = true[\s\S]*conversationMessages\.value =/) assert.doesNotMatch(aiModeSurface, /scrollTo\(\{ top: el\.scrollHeight, behavior: 'smooth' \}\)/) assert.match(aiModeStyles, /\.workbench-ai-thread\s*\{[\s\S]*display:\s*flex;[\s\S]*flex-direction:\s*column;[\s\S]*overflow-y:\s*auto;[\s\S]*scrollbar-width:\s*none;/) assert.match(aiModeStyles, /\.workbench-ai-thread\s*>\s*:first-child\s*\{[\s\S]*margin-top:\s*auto;/) assert.match(aiModeStyles, /\.workbench-ai-message\s*\{[\s\S]*flex:\s*0 0 auto;/) assert.match(aiModeStyles, /\.workbench-ai-empty-thread\s*\{[\s\S]*flex:\s*0 0 auto;/) assert.doesNotMatch(aiModeStyles, /align-content:\s*end;/) assert.doesNotMatch(aiModeStyles, /\.workbench-ai-thread\s*\{[\s\S]*scroll-behavior:\s*smooth;/) assert.match(aiModeStyles, /\.workbench-ai-thread::-webkit-scrollbar\s*\{[\s\S]*display:\s*none;/) assert.match(aiModeStyles, /\.workbench-ai-conversation-bottom\s*\{[\s\S]*position:\s*relative;[\s\S]*z-index:\s*6;/) assert.doesNotMatch(aiModeStyles, /\.workbench-ai-conversation-bottom\s*\{[\s\S]*position:\s*sticky;/) assert.doesNotMatch(aiModeStyles, /\.workbench-ai-conversation-bottom\s*\{[\s\S]*bottom:\s*0;/) assert.match(aiModeStyles, /\.workbench-ai-conversation-bottom::before\s*\{[\s\S]*display:\s*none;/) assert.match(aiModeStyles, /\.workbench-ai-thinking-panel\s*\{[\s\S]*display:\s*grid;[\s\S]*border:\s*1px solid rgba\(191,\s*219,\s*254,\s*0\.58\);/) assert.match(aiModeStyles, /\.workbench-ai-thinking-toggle\s*\{[\s\S]*border:\s*0;[\s\S]*background:\s*transparent;/) assert.match(aiModeStyles, /\.workbench-ai-thinking-list\s*\{[\s\S]*border:\s*0;[\s\S]*background:\s*transparent;[\s\S]*overflow:\s*visible;/) assert.match(aiModeStyles, /\.workbench-ai-thinking-item\s*\{[\s\S]*grid-template-columns:\s*18px minmax\(0,\s*1fr\);/) assert.match(aiModeStyles, /\.workbench-ai-thinking-dot\s*\{[\s\S]*justify-self:\s*center;/) assert.doesNotMatch(aiModeStyles, /\.workbench-ai-thinking-collapse-btn:disabled/) assert.match(aiModeStyles, /\.workbench-ai-thinking-collapse-enter-active,[\s\S]*\.workbench-ai-thinking-collapse-leave-active\s*\{[\s\S]*max-height 220ms ease/) assert.match(aiModeStyles, /\.workbench-ai-confirm-dialog\s*\{[\s\S]*border-radius:\s*18px;/) assert.match(aiModeStyles, /\.workbench-ai-answer-card\s*\{[\s\S]*box-shadow:\s*none;[\s\S]*backdrop-filter:\s*none;/) assert.match(aiModeStyles, /\.workbench-ai-answer-markdown\s*\{[\s\S]*line-height:\s*1\.86;/) assert.match(aiModeStyles, /\.workbench-ai-answer-markdown :deep\(h3\)\s*\{[\s\S]*font-size:\s*21px;/) assert.match(aiModeStyles, /\.workbench-ai-answer-markdown :deep\(\.ai-html-focus-grid\)\s*\{[\s\S]*border-left:\s*3px solid/) assert.match(aiModeStyles, /\.workbench-ai-answer-markdown :deep\(\.ai-html-focus-card\)\s*\{[\s\S]*background:\s*transparent;/) assert.match(aiModeStyles, /\.workbench-ai-answer-markdown :deep\(\.ai-html-step-index\)\s*\{[\s\S]*background:\s*transparent;[\s\S]*font-size:\s*17px;/) assert.match(aiModeStyles, /\.workbench-ai-date-popover\s*\{[\s\S]*animation:\s*workbenchAiPopoverIn/) assert.match(aiModeStyles, /\.workbench-ai-send-btn:not\(:disabled\)\s*\{[\s\S]*linear-gradient\(135deg,[\s\S]*#1d4ed8/) assert.match(aiModeStyles, /\.workbench-ai-composer--inline\s*\{[\s\S]*min-height:\s*126px;[\s\S]*box-shadow:\s*none;/) assert.match(aiModeStyles, /@media \(prefers-reduced-motion:\s*reduce\)[\s\S]*\.workbench-ai-action,[\s\S]*\.workbench-ai-message,[\s\S]*\.workbench-ai-composer--inline,[\s\S]*\.workbench-ai-date-popover,[\s\S]*\.workbench-ai-thinking-dot\s*\{[\s\S]*animation:\s*none;/) assert.ok(statSync(orbIconAsset).size > 100 * 1024) assert.ok(statSync(orbIconAsset).size < 3 * 1024 * 1024) assert.ok(statSync(orbIconPngAsset).size > 100 * 1024) assert.equal(orbIconBuffer.subarray(0, 6).toString('ascii'), 'GIF89a') assert.ok(countGifFrameBlocks(orbIconBuffer) >= 120) const gifMotion = measureGifMotion(orbIconAsset) assert.ok(gifMotion.seamDelta > gifMotion.medianAdjacentDelta * 0.35) assert.ok(gifMotion.seamDelta < gifMotion.medianAdjacentDelta * 1.8) assert.ok(measureGifDuration(orbIconAsset) >= 8000) assert.ok(measureGifDuration(orbIconAsset) / countGifFrameBlocks(orbIconBuffer) <= 75) const gifPresentation = measureOrbAssetPresentation(orbIconAsset) assert.equal(gifPresentation.width, 192) assert.equal(gifPresentation.height, 192) assert.ok(gifPresentation.minimumCornerLuma > 225) assert.ok(gifPresentation.maximumCornerLuma < 250) assert.ok(gifPresentation.minimumBackgroundSimilarityRatio > 0.25) assert.ok(gifPresentation.minimumForegroundWidthRatio > 0.9) assert.ok(gifPresentation.minimumForegroundHeightRatio > 0.9) const pngPresentation = measureOrbAssetPresentation(orbIconPngAsset) assert.ok(pngPresentation.minimumCornerLuma > 225) assert.ok(pngPresentation.maximumCornerLuma < 250) assert.ok(pngPresentation.minimumBackgroundSimilarityRatio > 0.25) assert.ok(pngPresentation.minimumForegroundWidthRatio > 0.9) assert.ok(pngPresentation.minimumForegroundHeightRatio > 0.9) }) test('AI attachment association notifies shell to refresh the target detail page', () => { const aiModeComponent = readSource('../src/components/business/PersonalWorkbenchAiMode.vue') const workbenchView = readSource('../src/views/PersonalWorkbenchView.vue') const appShellRouteView = readSource('../src/views/AppShellRouteView.vue') const aiModeComposable = readSource('../src/composables/workbenchAiMode/usePersonalWorkbenchAiMode.js') const attachmentFlow = readSource('../src/composables/workbenchAiMode/useWorkbenchAiAttachmentAssociationFlow.js') assert.match(aiModeComponent, /defineEmits\(\[[^\]]*'request-updated'/) assert.match(workbenchView, /@request-updated="emit\('request-updated', \$event\)"/) assert.match(workbenchView, /defineEmits\(\[[^\]]*'request-updated'/) assert.match(appShellRouteView, /\s*emit\('request-updated', payload\)/ ) assert.match( attachmentFlow, /notifyRequestUpdated\?\.\(\{[\s\S]*claimId:[\s\S]*runtime\.claimId[\s\S]*uploadedCount:[\s\S]*syncResult\?\.uploadedCount/ ) }) test('AI mode normal assistant requests include OCR context for uploaded receipts', () => { assert.match(aiModeSurface, /function isLikelyAiModeOcrFile\(file = \{\}\)/) assert.match(aiModeSurface, /const aiModeReceiptContextCache = new Map\(\)/) assert.match(aiModeSurface, /const aiModeReceiptRecognitionState = reactive\(\{\}\)/) assert.match(aiModeSurface, /function resolveAiModeReceiptRecognitionState\(file\)/) assert.match(aiModeSurface, /resolveAiModeReceiptRecognitionState\(selectedFiles\.value\[index\]\)/) assert.match(aiModeSurface, /status:\s*'recognizing'[\s\S]*label:\s*'智能录入识别中'/) assert.match(aiModeSurface, /status:\s*'recognized'[\s\S]*label:\s*detail \? `已识别票据/) assert.match(aiModeSurface, /status:\s*'failed'[\s\S]*label:\s*'识别失败'/) assert.match(aiModeSurface, /function primeAiModeReceiptContext\(files = \[\]\)/) assert.match(aiModeSurface, /function startAiModeReceiptRecognition\(files = \[\]\)/) assert.match(aiModeSurface, /function buildAiModeReceiptContextCacheKey\(ocrFiles = \[\]\)/) assert.match(aiModeSurface, /applyAiModeReceiptRecognitionResult\(ocrFiles, context\)/) assert.match(aiModeSurface, /buildFileIdentity\(file\)/) assert.match(aiModeSurface, /watch\(selectedFiles, \(files\) => \{[\s\S]*attachmentFlow\.primeAiModeReceiptContext\(files\)/) assert.match(aiModeSurface, /async function collectAiModeReceiptContext\(files = \[\]\)/) assert.match(aiModeSurface, /cached\?\.status === 'pending'[\s\S]*await cached\.promise/) assert.match(aiModeSurface, /collectReceiptFiles\(\{[\s\S]*files:\s*ocrFiles,[\s\S]*recognizeOcrFiles[\s\S]*\}\)/) assert.match(aiModeSurface, /const receiptContext = await collectAiModeReceiptContext\(files\)/) assert.match(aiModeSurface, /const attachmentOcrDetails = buildInlineAttachmentOcrDetails\(receiptContext, files\)/) assert.match(aiModeSurface, /ocr_summary:\s*receiptContext\.ocrSummary/) assert.match(aiModeSurface, /ocr_documents:\s*receiptContext\.ocrDocuments/) assert.match(aiModeSurface, /attachment_names:\s*receiptContext\.attachmentNames/) assert.match(aiModeSurface, /attachment_count:\s*receiptContext\.attachmentCount/) assert.match(aiModeSurface, /ocr_source_file_names:\s*receiptContext\.ocrSourceFileNames/) assert.match(aiModeSurface, /attachmentOcrDetails/) })