@detiq/crawler 1.0.5 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/crawler.js +680 -38
- package/dist/crawler.js.map +3 -3
- package/dist/extractors/advanced.js +20 -0
- package/dist/extractors/advanced.js.map +2 -2
- package/dist/interactive-probe.js +334 -2
- package/dist/interactive-probe.js.map +3 -3
- package/dist/screen-reader.js +4 -3
- package/dist/screen-reader.js.map +2 -2
- package/package.json +1 -1
- package/src/crawler.ts +758 -52
- package/src/extractors/advanced.ts +27 -1
- package/src/interactive-probe.ts +407 -3
- package/src/screen-reader.ts +12 -6
- package/types/extractors/advanced.d.ts +10 -0
- package/types/interactive-probe.d.ts +36 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/interactive-probe.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Interactive Probe \u2014 Phase 2 Dynamic Observation\n *\n * The static crawl captures DOM structure at rest. This module runs AFTER the static crawl\n * to observe dynamic behaviour by actually interacting with the UI:\n *\n * 1. Empty submit \u2192 captures required-field validation error messages\n * 2. Invalid format \u2192 captures format validation errors (bad email, short password)\n * 3. Button clicks \u2192 captures modal/dialog contents\n * 4. Select changes \u2192 captures conditional reveals (show/hide logic)\n * 5. Success paths \u2192 captures toast/banner messages (where input is safe)\n *\n * Results are stored as KnowledgeChunks (sourceType='probe') and update the\n * ERROR_CATALOGUE + INTERACTION_PATTERNS skill files with real observed data\n * instead of LLM inference.\n *\n * Call signature: probeScreen(page, screenId, elements, opts)\n * Called from crawlProject() after static element extraction when opts.interactive=true.\n */\n\nimport type { Page } from 'playwright';\nimport { AppBrain } from '@detiq/app-brain';\n\nexport interface ProbeElementFact {\n meaning: string;\n role: string;\n expectedData?: string;\n}\n\nexport interface ValidationError {\n field: string;\n trigger: 'empty_submit' | 'invalid_format' | 'boundary';\n errorText: string;\n}\n\nexport interface SuccessMessage {\n type: 'toast' | 'inline_success' | 'redirect';\n content: string;\n}\n\nexport interface ModalObservation {\n triggerElement: string;\n title: string;\n content: string;\n fields: string[];\n}\n\nexport interface ConditionalReveal {\n triggerElement: string;\n triggerValue: string;\n revealedText: string;\n}\n\nexport interface ProbeResult {\n screenId: string;\n url: string;\n validationErrors: ValidationError[];\n successMessages: SuccessMessage[];\n modals: ModalObservation[];\n conditionals: ConditionalReveal[];\n loadingPatterns: string[];\n}\n\n// \u2500\u2500 CSS selectors that reliably find error messages across frameworks \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nconst ERROR_SELECTORS = [\n '[role=\"alert\"]',\n '[aria-live=\"assertive\"]',\n '[aria-live=\"polite\"]',\n '.invalid-feedback',\n '.field-error',\n '.error-message',\n '.form-error',\n '.validation-error',\n '[class*=\"error\" i]',\n '[class*=\"invalid\" i]',\n '[class*=\"Error\"]',\n 'p.text-red-500', 'p.text-red-600', 'p.text-destructive', 'p.text-danger',\n '[data-error]', '[data-invalid]',\n '.ant-form-item-explain-error', // Ant Design\n '.el-form-item__error', // Element UI\n '.chakra-form__error-message', // Chakra UI\n '.mantine-InputWrapper-error', // Mantine\n].join(', ');\n\n// \u2500\u2500 Toast / notification selectors \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nconst TOAST_SELECTORS = [\n '[role=\"status\"]',\n '[data-sonner-toast]',\n '[data-toast]',\n '[data-hot-toast]',\n '.Toastify__toast',\n '.toast-message',\n '.notification-body',\n '.notistack-snackbar',\n '[class*=\"toast\" i]',\n '[class*=\"Toast\"]',\n '[class*=\"snackbar\" i]',\n '[class*=\"notification\" i]',\n].join(', ');\n\n/** Wait up to `maxMs` for any selector to appear, then return its text content. */\nasync function waitForAny(page: Page, selector: string, maxMs = 2500): Promise<string[]> {\n try {\n await page.waitForSelector(selector, { timeout: maxMs, state: 'visible' });\n } catch { return []; }\n return page.$$eval(selector, (els) =>\n els.map((el) => (el as HTMLElement).innerText?.replace(/\\s+/g, ' ').trim()).filter(Boolean)\n );\n}\n\n/** Collect all currently-visible error messages. */\nasync function collectErrors(page: Page): Promise<string[]> {\n try {\n return page.$$eval(ERROR_SELECTORS, (els) =>\n els\n .filter((el) => {\n const style = window.getComputedStyle(el);\n return style.display !== 'none' && style.visibility !== 'hidden' && (el as HTMLElement).innerText?.trim().length > 0;\n })\n .map((el) => (el as HTMLElement).innerText?.replace(/\\s+/g, ' ').trim())\n .filter(Boolean)\n );\n } catch { return []; }\n}\n\n/** Collect any visible toast / notification content. */\nasync function collectToasts(page: Page): Promise<string[]> {\n try {\n return page.$$eval(TOAST_SELECTORS, (els) =>\n els\n .filter((el) => {\n const style = window.getComputedStyle(el);\n return style.display !== 'none' && (el as HTMLElement).innerText?.trim().length > 0;\n })\n .map((el) => (el as HTMLElement).innerText?.replace(/\\s+/g, ' ').trim())\n .filter(Boolean)\n );\n } catch { return []; }\n}\n\n/** Find the primary submit button on the page. */\nasync function findSubmitButton(page: Page): Promise<string | null> {\n return page.evaluate(() => {\n const SUBMIT_KW = /submit|send|save|create|confirm|continue|proceed|register|sign.?in|log.?in|apply|verify|search|next|finish|complete|order|buy|checkout/i;\n const candidates = Array.from(document.querySelectorAll('button, [role=\"button\"], input[type=\"submit\"]')) as HTMLElement[];\n const primary = candidates.find((el) => {\n const style = window.getComputedStyle(el);\n if (style.display === 'none' || style.visibility === 'hidden') return false;\n const text = el.innerText || (el as HTMLInputElement).value || el.getAttribute('aria-label') || '';\n return SUBMIT_KW.test(text);\n });\n if (!primary) return null;\n return primary.getAttribute('data-testid') || primary.getAttribute('aria-label') || primary.innerText?.trim().slice(0, 60);\n });\n}\n\n/** Find all modal-trigger buttons (non-submit buttons). */\nasync function findModalTriggers(page: Page): Promise<Array<{ selector: string; label: string }>> {\n return page.evaluate(() => {\n const SKIP = /submit|send|save|create|log.?in|sign.?in|register|continue|checkout|buy|order|search|close|cancel|dismiss/i;\n const NAV_PARENTS = new Set(['NAV', 'HEADER', 'FOOTER']);\n return Array.from(document.querySelectorAll('button, [role=\"button\"]'))\n .filter((el) => {\n const style = window.getComputedStyle(el as HTMLElement);\n if (style.display === 'none' || style.visibility === 'hidden') return false;\n const label = (el as HTMLElement).innerText?.trim() || el.getAttribute('aria-label') || '';\n if (!label || SKIP.test(label)) return false;\n // Skip nav chrome\n let p = el.parentElement;\n while (p) { if (NAV_PARENTS.has(p.tagName)) return false; p = p.parentElement; }\n return true;\n })\n .slice(0, 8) // probe at most 8 buttons per screen to keep it fast\n .map((el) => {\n const label = (el as HTMLElement).innerText?.trim() || el.getAttribute('aria-label') || 'button';\n return { selector: `[aria-label=\"${label}\"]`, label: label.slice(0, 60) };\n });\n });\n}\n\n/** Try to interact with select elements and observe conditional reveals. */\nasync function probeConditionals(page: Page): Promise<ConditionalReveal[]> {\n const results: ConditionalReveal[] = [];\n try {\n const selects = await page.$$('select');\n for (const sel of selects.slice(0, 5)) {\n const label = await sel.getAttribute('aria-label') || await sel.getAttribute('name') || 'select';\n const options = await sel.$$eval('option', (opts) => opts.slice(1, 3).map((o) => ({ value: o.value, text: o.textContent?.trim() })));\n for (const opt of options) {\n if (!opt.value) continue;\n const domBefore = await page.evaluate(() => document.body.innerText.length);\n await sel.selectOption(opt.value);\n await page.waitForTimeout(500);\n const domAfter = await page.evaluate(() => document.body.innerText.length);\n if (Math.abs(domAfter - domBefore) > 50) {\n const revealed = await page.evaluate(() => {\n // Grab text from any newly-visible sections\n return Array.from(document.querySelectorAll('[data-conditional],[data-show],[class*=\"conditional\"]'))\n .filter((el) => window.getComputedStyle(el).display !== 'none')\n .map((el) => (el as HTMLElement).innerText?.trim())\n .filter((t) => t && t.length > 10)\n .slice(0, 3)\n .join(' | ');\n });\n if (revealed) {\n results.push({ triggerElement: label, triggerValue: opt.text || opt.value, revealedText: revealed.slice(0, 200) });\n }\n }\n }\n }\n } catch { /* non-fatal */ }\n return results;\n}\n\n/**\n * Run interactive probing on a single screen page.\n * The page must already be navigated to the screen URL.\n * `elements` is the output of the static extractElements pass.\n */\nexport async function probeScreen(\n page: Page,\n screenId: string,\n url: string,\n elements: ProbeElementFact[],\n): Promise<ProbeResult> {\n const result: ProbeResult = {\n screenId, url,\n validationErrors: [], successMessages: [], modals: [], conditionals: [], loadingPatterns: [],\n };\n\n const formInputs = elements.filter((e) =>\n /input|text|email|password|tel|search|textarea|select/i.test(e.role)\n );\n const hasForm = formInputs.length > 0;\n\n // \u2500\u2500 Probe 1: Empty submit \u2192 capture required-field errors \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n if (hasForm) {\n try {\n const submitLabel = await findSubmitButton(page);\n if (submitLabel) {\n // Click submit with no data filled in\n const submitBtn = page.locator(`button:has-text(\"${submitLabel}\")`).first();\n await submitBtn.click({ timeout: 2000 });\n await page.waitForTimeout(1500);\n\n const errors = await collectErrors(page);\n for (const errorText of errors) {\n // Try to match error back to a field\n const matchedField = formInputs.find((el) =>\n errorText.toLowerCase().includes(el.meaning.toLowerCase().split(' ')[0]) ||\n el.meaning.toLowerCase().includes(errorText.toLowerCase().split(' ')[0])\n );\n result.validationErrors.push({\n field: matchedField?.meaning ?? 'unknown',\n trigger: 'empty_submit',\n errorText: errorText.slice(0, 150),\n });\n }\n\n // Check for loading state text during submit\n const loadingText = await page.evaluate(() => {\n const loading = Array.from(document.querySelectorAll('button, [aria-busy=\"true\"], [class*=\"loading\" i], [class*=\"spinner\" i]'))\n .map((el) => (el as HTMLElement).innerText?.trim())\n .filter((t) => t && /loading|saving|submitting|sending|processing/i.test(t));\n return loading.slice(0, 3);\n });\n result.loadingPatterns.push(...loadingText);\n }\n } catch { /* non-fatal \u2014 form probe failed, continue */ }\n }\n\n // \u2500\u2500 Probe 2: Invalid format inputs \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n if (hasForm) {\n try {\n const emailField = formInputs.find((e) => e.expectedData === 'valid_email' || /email/i.test(e.meaning));\n const passwordField = formInputs.find((e) => e.expectedData === 'password' || /password/i.test(e.meaning));\n\n if (emailField) {\n const emailLocator = page.locator('input[type=\"email\"], input[name*=\"email\"], input[placeholder*=\"email\" i]').first();\n try {\n await emailLocator.fill('notanemail', { timeout: 1000 });\n await emailLocator.blur();\n await page.waitForTimeout(600);\n const errors = await collectErrors(page);\n for (const errorText of errors) {\n result.validationErrors.push({ field: emailField.meaning, trigger: 'invalid_format', errorText: errorText.slice(0, 150) });\n }\n } catch { /* locator not found */ }\n }\n\n if (passwordField) {\n const pwLocator = page.locator('input[type=\"password\"]').first();\n try {\n await pwLocator.fill('123', { timeout: 1000 });\n await pwLocator.blur();\n await page.waitForTimeout(600);\n const errors = await collectErrors(page);\n for (const errorText of errors) {\n if (!result.validationErrors.some((e) => e.errorText === errorText)) {\n result.validationErrors.push({ field: passwordField.meaning, trigger: 'invalid_format', errorText: errorText.slice(0, 150) });\n }\n }\n } catch { /* locator not found */ }\n }\n } catch { /* non-fatal */ }\n }\n\n // \u2500\u2500 Probe 3: Button clicks \u2192 discover modal/dialog contents \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n try {\n const triggers = await findModalTriggers(page);\n for (const trigger of triggers) {\n try {\n const btn = page.locator(`button:has-text(\"${trigger.label}\")`).first();\n const domBefore = await page.evaluate(() => document.body.innerText.length);\n\n await btn.click({ timeout: 1500 });\n await page.waitForTimeout(1000);\n\n // Check if a dialog/modal appeared\n const dialogText = await page.evaluate(() => {\n const DIALOG_SEL = '[role=\"dialog\"], [role=\"alertdialog\"], .modal, .Modal, [class*=\"modal\" i], [class*=\"dialog\" i], [class*=\"Dialog\"]';\n const dialogs = Array.from(document.querySelectorAll(DIALOG_SEL))\n .filter((el) => window.getComputedStyle(el).display !== 'none');\n if (dialogs.length === 0) return null;\n const d = dialogs[0] as HTMLElement;\n const title = d.querySelector('[role=\"heading\"], h1, h2, h3')?.textContent?.trim() || '';\n const content = d.innerText?.replace(/\\s+/g, ' ').trim().slice(0, 400);\n const fields = Array.from(d.querySelectorAll('input, select, textarea, button'))\n .map((f) => (f as HTMLElement).getAttribute('aria-label') || (f as HTMLElement).getAttribute('placeholder') || (f as HTMLInputElement).value || '')\n .filter((t) => t.trim().length > 0);\n return { title, content, fields };\n });\n\n if (dialogText && dialogText.content.length > 20) {\n result.modals.push({\n triggerElement: trigger.label,\n title: dialogText.title,\n content: dialogText.content,\n fields: dialogText.fields.slice(0, 10),\n });\n }\n\n // Dismiss: Escape key first, then close button\n await page.keyboard.press('Escape');\n await page.waitForTimeout(400);\n\n // Check if toast appeared after the click\n const toasts = await collectToasts(page);\n for (const t of toasts) {\n if (t.length > 5) result.successMessages.push({ type: 'toast', content: t.slice(0, 200) });\n }\n } catch { /* this button's probe failed, try next */ }\n }\n } catch { /* non-fatal */ }\n\n // \u2500\u2500 Probe 4: Select/radio \u2192 conditional reveals \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n try {\n const conditionals = await probeConditionals(page);\n result.conditionals.push(...conditionals);\n } catch { /* non-fatal */ }\n\n return result;\n}\n\n/** Phase 5: Convert ProbeResult to typed ProbeObservationFact rows for direct DB storage. */\nexport function probeResultToObservations(result: ProbeResult): Array<{\n elementMeaning: string; observationType: string; observedText: string; triggeredBy: string;\n}> {\n const obs: Array<{ elementMeaning: string; observationType: string; observedText: string; triggeredBy: string }> = [];\n for (const ve of result.validationErrors) {\n obs.push({ elementMeaning: ve.field, observationType: 'VALIDATION_ERROR', observedText: ve.errorText, triggeredBy: ve.trigger });\n }\n for (const sm of result.successMessages) {\n obs.push({ elementMeaning: '(page)', observationType: 'SUCCESS_TOAST', observedText: sm.content, triggeredBy: sm.type });\n }\n for (const m of result.modals) {\n obs.push({ elementMeaning: m.triggerElement, observationType: 'MODAL', observedText: [m.title, m.content].filter(Boolean).join(' \u2014 ').slice(0, 500), triggeredBy: `button_click:${m.triggerElement}` });\n }\n for (const c of result.conditionals) {\n obs.push({ elementMeaning: c.triggerElement, observationType: 'CONDITIONAL_REVEAL', observedText: c.revealedText, triggeredBy: `select_change:${c.triggerElement}:${c.triggerValue}` });\n }\n for (const lp of result.loadingPatterns) {\n obs.push({ elementMeaning: '(submit button)', observationType: 'LOADING_STATE', observedText: lp, triggeredBy: 'form_submit' });\n }\n return obs;\n}\n\n/**\n * Convert a ProbeResult into markdown to store as KnowledgeChunks\n * and update ERROR_CATALOGUE + INTERACTION_PATTERNS skill files.\n */\nexport function probeResultToMarkdown(result: ProbeResult): {\n errorCatalogueChunk: string;\n interactionPatternsChunk: string;\n} {\n const lines: string[] = [`## Probe Observations \u2014 ${result.url}\\n`];\n\n if (result.validationErrors.length > 0) {\n lines.push('### Validation Errors (observed)');\n for (const ve of result.validationErrors) {\n lines.push(`- **${ve.field}** (${ve.trigger}): \"${ve.errorText}\"`);\n }\n }\n\n if (result.successMessages.length > 0) {\n lines.push('\\n### Success / Feedback Messages (observed)');\n for (const sm of result.successMessages) {\n lines.push(`- ${sm.type}: \"${sm.content}\"`);\n }\n }\n\n if (result.modals.length > 0) {\n lines.push('\\n### Modal / Dialog Contents (observed)');\n for (const m of result.modals) {\n lines.push(`- **Trigger:** ${m.triggerElement}`);\n if (m.title) lines.push(` - Title: ${m.title}`);\n lines.push(` - Content: ${m.content.slice(0, 200)}`);\n if (m.fields.length > 0) lines.push(` - Fields: ${m.fields.join(', ')}`);\n }\n }\n\n if (result.conditionals.length > 0) {\n lines.push('\\n### Conditional UI (observed)');\n for (const c of result.conditionals) {\n lines.push(`- **${c.triggerElement}** = \"${c.triggerValue}\" reveals: ${c.revealedText}`);\n }\n }\n\n if (result.loadingPatterns.length > 0) {\n lines.push('\\n### Loading State Text (observed)');\n for (const lp of result.loadingPatterns) lines.push(`- \"${lp}\"`);\n }\n\n const full = lines.join('\\n');\n\n const errorSection = result.validationErrors.length > 0\n ? `## Real Validation Errors \u2014 ${result.url}\\n` +\n result.validationErrors.map((e) => `- **${e.field}**: \"${e.errorText}\"`).join('\\n')\n : '';\n\n const interactionSection = [\n result.successMessages.length > 0\n ? `## Success Messages \u2014 ${result.url}\\n` + result.successMessages.map((s) => `- ${s.type}: \"${s.content}\"`).join('\\n')\n : '',\n result.loadingPatterns.length > 0\n ? `## Loading Patterns \u2014 ${result.url}\\n` + result.loadingPatterns.map((lp) => `- \"${lp}\"`).join('\\n')\n : '',\n result.modals.length > 0\n ? `## Modal Contents \u2014 ${result.url}\\n` + result.modals.map((m) => `### ${m.triggerElement}\\n${m.content}`).join('\\n')\n : '',\n ].filter(Boolean).join('\\n\\n');\n\n return {\n errorCatalogueChunk: errorSection,\n interactionPatternsChunk: interactionSection,\n };\n}\n\n/**\n * Run interactive probing for all screens discovered in a crawl session.\n * Called from crawlProject() when opts.interactive = true.\n */\nexport async function probeAllScreens(\n page: any,\n tenantId: string,\n projectId: string,\n discovered: Array<{ url: string; screenId?: string; elements?: any[] }>,\n onProgress?: (pct: number, step: string) => Promise<void>,\n): Promise<void> {\n const probeable = discovered.filter((d) => d.screenId && d.url && !d.url.includes('#'));\n if (probeable.length === 0) return;\n\n const errorCatalogueChunks: string[] = [];\n const interactionChunks: string[] = [];\n\n for (let i = 0; i < probeable.length; i++) {\n const screen = probeable[i];\n const pct = 88 + Math.round((i / probeable.length) * 10);\n await onProgress?.(pct, `Probing screen ${i + 1}/${probeable.length}: ${screen.url}`);\n\n try {\n // Navigate to screen\n if (page.url() !== screen.url) {\n await page.goto(screen.url, { waitUntil: 'domcontentloaded' });\n await page.waitForTimeout(1500); // SPA hydration\n }\n\n const result = await probeScreen(page, screen.screenId!, screen.url, screen.elements ?? []);\n\n // Phase 5: save structured probe observations (replaces per-re-probe)\n const observations = probeResultToObservations(result);\n if (observations.length > 0) {\n await AppBrain.saveProbeObservations(tenantId, projectId, screen.screenId!, observations).catch(console.warn);\n }\n\n // Store raw probe result as KnowledgeChunk (kept for BM25 / oversized projects)\n const md = probeResultToMarkdown(result);\n if (md.errorCatalogueChunk) errorCatalogueChunks.push(md.errorCatalogueChunk);\n if (md.interactionPatternsChunk) interactionChunks.push(md.interactionPatternsChunk);\n\n const probeMarkdown = [md.errorCatalogueChunk, md.interactionPatternsChunk].filter(Boolean).join('\\n\\n');\n if (probeMarkdown.length > 50) {\n await AppBrain.saveKnowledgeChunk(tenantId, projectId, 'probe', screen.screenId!, probeMarkdown, `Probe \u2014 ${screen.url}`).catch(console.warn);\n }\n\n if (result.validationErrors.length > 0) {\n console.log(`[probe] ${screen.url}: ${result.validationErrors.length} validation errors, ${result.modals.length} modals`);\n }\n } catch (err) {\n console.warn(`[probe] \u2717 ${screen.url}:`, err instanceof Error ? err.message : err);\n }\n }\n\n // Update ERROR_CATALOGUE skill file with all real observed errors\n if (errorCatalogueChunks.length > 0) {\n const combined = `# Error Catalogue (Real Observed \u2014 Interactive Probe)\\n\\n${errorCatalogueChunks.join('\\n\\n')}`;\n await AppBrain.upsertSkillFile(tenantId, projectId, 'ERROR_CATALOGUE', combined, {\n summary: `Real validation error messages observed via interactive probe across ${errorCatalogueChunks.length} screens`,\n scope: 'PROJECT',\n }).catch(console.warn);\n }\n\n // Update INTERACTION_PATTERNS skill file with real observed patterns\n if (interactionChunks.length > 0) {\n const combined = `# Interaction Patterns (Real Observed \u2014 Interactive Probe)\\n\\n${interactionChunks.join('\\n\\n')}`;\n await AppBrain.upsertSkillFile(tenantId, projectId, 'INTERACTION_PATTERNS', combined, {\n summary: `Real loading states, success messages, and modal contents observed via interactive probe`,\n scope: 'PROJECT',\n }).catch(console.warn);\n }\n\n await onProgress?.(98, 'Interactive probe complete');\n console.log(`[probe] Probed ${probeable.length} screens. Errors: ${errorCatalogueChunks.length}, Interactions: ${interactionChunks.length}`);\n}\n\n// \u2500\u2500 Keyboard Navigation Probe \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport interface FocusableElement {\n tag: string;\n role: string | null;\n ariaLabel: string | null;\n text: string | null;\n hasFocusIndicator: boolean;\n tabIndex: number | null;\n}\n\nexport interface KeyboardNavResult {\n focusableCount: number;\n elementsWithNoFocusIndicator: number;\n sequence: FocusableElement[];\n issues: string[];\n}\n\n/**\n * Probe keyboard navigation accessibility by pressing Tab up to 50 times and\n * recording each focused element's properties and focus-indicator visibility.\n * Stops early if focus wraps back to the start or hits the same element twice.\n */\nexport async function probeKeyboardNav(page: Page): Promise<KeyboardNavResult> {\n const sequence: FocusableElement[] = [];\n const issues: string[] = [];\n const seenKeys = new Set<string>();\n let firstKey: string | null = null;\n\n for (let i = 0; i < 50; i++) {\n await page.keyboard.press('Tab');\n\n const el = await page.evaluate(() => {\n const active = document.activeElement as HTMLElement | null;\n if (!active || active === document.body) return null;\n const outline = window.getComputedStyle(active).outline;\n return {\n tag: active.tagName.toLowerCase(),\n role: active.getAttribute('role'),\n ariaLabel: active.getAttribute('aria-label'),\n text: (active.innerText ?? '').trim().slice(0, 60) || null,\n outline,\n tabIndex: active.tabIndex ?? null,\n };\n });\n\n if (!el) break;\n\n const hasFocusIndicator =\n el.outline !== 'none' &&\n el.outline !== '' &&\n !el.outline.startsWith('0px') &&\n !el.outline.startsWith('rgba(0, 0, 0, 0)') &&\n !el.outline.startsWith('rgba(0,0,0,0)');\n\n const focusable: FocusableElement = {\n tag: el.tag,\n role: el.role,\n ariaLabel: el.ariaLabel,\n text: el.text,\n hasFocusIndicator,\n tabIndex: el.tabIndex,\n };\n\n const key = `${el.tag}|${el.text ?? ''}|${el.role ?? ''}`;\n\n if (i === 0) {\n firstKey = key;\n } else if (key === firstKey || seenKeys.has(key)) {\n // Focus wrapped back to start or hit a duplicate \u2014 stop probing\n break;\n }\n\n seenKeys.add(key);\n sequence.push(focusable);\n\n if (!hasFocusIndicator) {\n issues.push(`Element #${i + 1} (${el.tag}) has no visible focus indicator`);\n }\n }\n\n return {\n focusableCount: sequence.length,\n elementsWithNoFocusIndicator: issues.length,\n sequence,\n issues,\n };\n}\n"],
|
|
5
|
-
"mappings": "AAqBA,SAAS,gBAAgB;AA2CzB,MAAM,kBAAkB;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAAkB;AAAA,EAAkB;AAAA,EAAsB;AAAA,EAC1D;AAAA,EAAgB;AAAA,EAChB;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AACF,EAAE,KAAK,IAAI;AAGX,MAAM,kBAAkB;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,EAAE,KAAK,IAAI;AAGX,eAAe,WAAW,MAAY,UAAkB,QAAQ,MAAyB;AACvF,MAAI;AACF,UAAM,KAAK,gBAAgB,UAAU,EAAE,SAAS,OAAO,OAAO,UAAU,CAAC;AAAA,EAC3E,QAAQ;AAAE,WAAO,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AAY;AAAA,MAC/B;AAAA,IACF,CAAC;AAED,QAAI,CAAC,GAAI;AAET,UAAM,oBACJ,GAAG,YAAY,UACf,GAAG,YAAY,MACf,CAAC,GAAG,QAAQ,WAAW,KAAK,KAC5B,CAAC,GAAG,QAAQ,WAAW,kBAAkB,KACzC,CAAC,GAAG,QAAQ,WAAW,eAAe;AAExC,UAAM,YAA8B;AAAA,MAClC,KAAK,GAAG;AAAA,MACR,MAAM,GAAG;AAAA,MACT,WAAW,GAAG;AAAA,MACd,MAAM,GAAG;AAAA,MACT;AAAA,MACA,UAAU,GAAG;AAAA,IACf;AAEA,UAAM,MAAM,GAAG,GAAG,GAAG,IAAI,GAAG,QAAQ,EAAE,IAAI,GAAG,QAAQ,EAAE;AAEvD,QAAI,MAAM,GAAG;AACX,iBAAW;AAAA,IACb,WAAW,QAAQ,YAAY,SAAS,IAAI,GAAG,GAAG;AAEhD;AAAA,IACF;AAEA,aAAS,IAAI,GAAG;AAChB,aAAS,KAAK,SAAS;AAEvB,QAAI,CAAC,mBAAmB;AACtB,aAAO,KAAK,YAAY,IAAI,CAAC,KAAK,GAAG,GAAG,kCAAkC;AAAA,IAC5E;AAAA,EACF;AAEA,SAAO;AAAA,IACL,gBAAgB,SAAS;AAAA,IACzB,8BAA8B,OAAO;AAAA,IACrC;AAAA,IACA;AAAA,EACF;AACF;",
|
|
6
|
-
"names": []
|
|
4
|
+
"sourcesContent": ["/**\n * Interactive Probe \u2014 Phase 2 Dynamic Observation\n *\n * The static crawl captures DOM structure at rest. This module runs AFTER the static crawl\n * to observe dynamic behaviour by actually interacting with the UI:\n *\n * 1. Empty submit \u2192 captures required-field validation error messages\n * 2. Invalid format \u2192 captures format validation errors (bad email, short password)\n * 3. Button clicks \u2192 captures modal/dialog contents\n * 4. Select changes \u2192 captures conditional reveals (show/hide logic)\n * 5. Success paths \u2192 captures toast/banner messages (where input is safe)\n *\n * Results are stored as KnowledgeChunks (sourceType='probe') and update the\n * ERROR_CATALOGUE + INTERACTION_PATTERNS skill files with real observed data\n * instead of LLM inference.\n *\n * Call signature: probeScreen(page, screenId, elements, opts)\n * Called from crawlProject() after static element extraction when opts.interactive=true.\n */\n\nimport type { Page } from 'playwright';\nimport { AppBrain } from '@detiq/app-brain';\n\nexport interface ProbeElementFact {\n meaning: string;\n role: string;\n expectedData?: string;\n}\n\nexport interface ValidationError {\n field: string;\n trigger: 'empty_submit' | 'invalid_format' | 'boundary';\n errorText: string;\n}\n\nexport interface SuccessMessage {\n type: 'toast' | 'inline_success' | 'redirect';\n content: string;\n}\n\nexport interface ModalObservation {\n triggerElement: string;\n title: string;\n content: string;\n fields: string[];\n}\n\nexport interface ConditionalReveal {\n triggerElement: string;\n triggerValue: string;\n revealedText: string;\n}\n\nexport interface TooltipCapture {\n triggerLabel: string;\n tooltipText: string;\n}\n\nexport interface TabPanelCapture {\n tabLabel: string;\n panelContent: string;\n panelHeading?: string;\n}\n\nexport interface CarouselSlide {\n slideIndex: number;\n heading?: string;\n content: string;\n}\n\nexport interface WizardStep {\n stepIndex: number;\n stepLabel?: string;\n content: string;\n fields: string[];\n}\n\nexport interface FocusTrapResult {\n modalTrigger: string;\n focusTrapped: boolean;\n sampledFocused: string[];\n}\n\nexport interface ContextMenuCapture {\n trigger: string;\n items: string[];\n}\n\nexport interface ProbeResult {\n screenId: string;\n url: string;\n validationErrors: ValidationError[];\n successMessages: SuccessMessage[];\n modals: ModalObservation[];\n conditionals: ConditionalReveal[];\n loadingPatterns: string[];\n tooltips?: TooltipCapture[];\n tabPanels?: TabPanelCapture[];\n carouselSlides?: CarouselSlide[];\n wizardSteps?: WizardStep[];\n focusTraps?: FocusTrapResult[];\n skipNavIssues?: string[];\n contextMenus?: ContextMenuCapture[];\n}\n\n// \u2500\u2500 CSS selectors that reliably find error messages across frameworks \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nconst ERROR_SELECTORS = [\n '[role=\"alert\"]',\n '[aria-live=\"assertive\"]',\n '[aria-live=\"polite\"]',\n '.invalid-feedback',\n '.field-error',\n '.error-message',\n '.form-error',\n '.validation-error',\n '[class*=\"error\" i]',\n '[class*=\"invalid\" i]',\n '[class*=\"Error\"]',\n 'p.text-red-500', 'p.text-red-600', 'p.text-destructive', 'p.text-danger',\n '[data-error]', '[data-invalid]',\n '.ant-form-item-explain-error', // Ant Design\n '.el-form-item__error', // Element UI\n '.chakra-form__error-message', // Chakra UI\n '.mantine-InputWrapper-error', // Mantine\n].join(', ');\n\n// \u2500\u2500 Toast / notification selectors \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nconst TOAST_SELECTORS = [\n '[role=\"status\"]',\n '[data-sonner-toast]',\n '[data-toast]',\n '[data-hot-toast]',\n '.Toastify__toast',\n '.toast-message',\n '.notification-body',\n '.notistack-snackbar',\n '[class*=\"toast\" i]',\n '[class*=\"Toast\"]',\n '[class*=\"snackbar\" i]',\n '[class*=\"notification\" i]',\n].join(', ');\n\n/** Wait up to `maxMs` for any selector to appear, then return its text content. */\nasync function waitForAny(page: Page, selector: string, maxMs = 2500): Promise<string[]> {\n try {\n await page.waitForSelector(selector, { timeout: maxMs, state: 'visible' });\n } catch { return []; }\n return page.$$eval(selector, (els) =>\n els.map((el) => (el as HTMLElement).innerText?.replace(/\\s+/g, ' ').trim()).filter(Boolean)\n );\n}\n\n/** Collect all currently-visible error messages. */\nasync function collectErrors(page: Page): Promise<string[]> {\n try {\n return page.$$eval(ERROR_SELECTORS, (els) =>\n els\n .filter((el) => {\n const style = window.getComputedStyle(el);\n return style.display !== 'none' && style.visibility !== 'hidden' && (el as HTMLElement).innerText?.trim().length > 0;\n })\n .map((el) => (el as HTMLElement).innerText?.replace(/\\s+/g, ' ').trim())\n .filter(Boolean)\n );\n } catch { return []; }\n}\n\n/** Collect any visible toast / notification content. */\nasync function collectToasts(page: Page): Promise<string[]> {\n try {\n return page.$$eval(TOAST_SELECTORS, (els) =>\n els\n .filter((el) => {\n const style = window.getComputedStyle(el);\n return style.display !== 'none' && (el as HTMLElement).innerText?.trim().length > 0;\n })\n .map((el) => (el as HTMLElement).innerText?.replace(/\\s+/g, ' ').trim())\n .filter(Boolean)\n );\n } catch { return []; }\n}\n\n/** Find the primary submit button on the page. */\nasync function findSubmitButton(page: Page): Promise<string | null> {\n return page.evaluate(() => {\n const SUBMIT_KW = /submit|send|save|create|confirm|continue|proceed|register|sign.?in|log.?in|apply|verify|search|next|finish|complete|order|buy|checkout/i;\n const candidates = Array.from(document.querySelectorAll('button, [role=\"button\"], input[type=\"submit\"]')) as HTMLElement[];\n const primary = candidates.find((el) => {\n const style = window.getComputedStyle(el);\n if (style.display === 'none' || style.visibility === 'hidden') return false;\n const text = el.innerText || (el as HTMLInputElement).value || el.getAttribute('aria-label') || '';\n return SUBMIT_KW.test(text);\n });\n if (!primary) return null;\n return primary.getAttribute('data-testid') || primary.getAttribute('aria-label') || primary.innerText?.trim().slice(0, 60);\n });\n}\n\n/** Find all modal-trigger buttons (non-submit buttons). */\nasync function findModalTriggers(page: Page): Promise<Array<{ selector: string; label: string }>> {\n return page.evaluate(() => {\n const SKIP = /submit|send|save|create|log.?in|sign.?in|register|continue|checkout|buy|order|search|close|cancel|dismiss/i;\n const NAV_PARENTS = new Set(['NAV', 'HEADER', 'FOOTER']);\n return Array.from(document.querySelectorAll('button, [role=\"button\"]'))\n .filter((el) => {\n const style = window.getComputedStyle(el as HTMLElement);\n if (style.display === 'none' || style.visibility === 'hidden') return false;\n const label = (el as HTMLElement).innerText?.trim() || el.getAttribute('aria-label') || '';\n if (!label || SKIP.test(label)) return false;\n // Skip nav chrome\n let p = el.parentElement;\n while (p) { if (NAV_PARENTS.has(p.tagName)) return false; p = p.parentElement; }\n return true;\n })\n .slice(0, 20) // probe at most 20 buttons per screen\n .map((el) => {\n const label = (el as HTMLElement).innerText?.trim() || el.getAttribute('aria-label') || 'button';\n return { selector: `[aria-label=\"${label}\"]`, label: label.slice(0, 60) };\n });\n });\n}\n\n/** Try to interact with select elements and observe conditional reveals. */\nasync function probeConditionals(page: Page): Promise<ConditionalReveal[]> {\n const results: ConditionalReveal[] = [];\n try {\n const selects = await page.$$('select');\n for (const sel of selects.slice(0, 5)) {\n const label = await sel.getAttribute('aria-label') || await sel.getAttribute('name') || 'select';\n const options = await sel.$$eval('option', (opts) => opts.slice(1, 3).map((o) => ({ value: o.value, text: o.textContent?.trim() })));\n for (const opt of options) {\n if (!opt.value) continue;\n const domBefore = await page.evaluate(() => document.body.innerText.length);\n await sel.selectOption(opt.value);\n await page.waitForTimeout(500);\n const domAfter = await page.evaluate(() => document.body.innerText.length);\n if (Math.abs(domAfter - domBefore) > 50) {\n const revealed = await page.evaluate(() => {\n // Grab text from any newly-visible sections\n return Array.from(document.querySelectorAll('[data-conditional],[data-show],[class*=\"conditional\"]'))\n .filter((el) => window.getComputedStyle(el).display !== 'none')\n .map((el) => (el as HTMLElement).innerText?.trim())\n .filter((t) => t && t.length > 10)\n .slice(0, 3)\n .join(' | ');\n });\n if (revealed) {\n results.push({ triggerElement: label, triggerValue: opt.text || opt.value, revealedText: revealed.slice(0, 200) });\n }\n }\n }\n }\n } catch { /* non-fatal */ }\n return results;\n}\n\n/**\n * Run interactive probing on a single screen page.\n * The page must already be navigated to the screen URL.\n * `elements` is the output of the static extractElements pass.\n */\nexport async function probeScreen(\n page: Page,\n screenId: string,\n url: string,\n elements: ProbeElementFact[],\n): Promise<ProbeResult> {\n const result: ProbeResult = {\n screenId, url,\n validationErrors: [], successMessages: [], modals: [], conditionals: [], loadingPatterns: [],\n };\n\n const formInputs = elements.filter((e) =>\n /input|text|email|password|tel|search|textarea|select/i.test(e.role)\n );\n const hasForm = formInputs.length > 0;\n\n // \u2500\u2500 Probe 1: Empty submit \u2192 capture required-field errors \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n if (hasForm) {\n try {\n const submitLabel = await findSubmitButton(page);\n if (submitLabel) {\n // Click submit with no data filled in\n const submitBtn = page.locator(`button:has-text(\"${submitLabel}\")`).first();\n await submitBtn.click({ timeout: 2000 });\n await page.waitForTimeout(1500);\n\n const errors = await collectErrors(page);\n // Prefer DOM-proximity mapping via aria-invalid + aria-describedby\n const ariaFieldErrors = await page.evaluate(() =>\n Array.from(document.querySelectorAll('[aria-invalid=\"true\"]')).map((el) => {\n const describedBy = el.getAttribute('aria-describedby');\n const errorEl = describedBy ? document.getElementById(describedBy) : null;\n const label = el.getAttribute('aria-label') || el.getAttribute('placeholder') || (el as HTMLInputElement).name || '';\n return { label, errorText: errorEl?.textContent?.trim() || '' };\n }).filter((f) => f.errorText)\n );\n const ariaMatched = new Set<string>();\n for (const af of ariaFieldErrors) {\n ariaMatched.add(af.errorText);\n result.validationErrors.push({ field: af.label || 'unknown', trigger: 'empty_submit', errorText: af.errorText.slice(0, 150) });\n }\n // Fallback: text-proximity match for errors not covered by aria-invalid\n for (const errorText of errors.filter((e) => !ariaMatched.has(e))) {\n const matchedField = formInputs.find((el) =>\n errorText.toLowerCase().includes(el.meaning.toLowerCase().split(' ')[0]) ||\n el.meaning.toLowerCase().includes(errorText.toLowerCase().split(' ')[0])\n );\n result.validationErrors.push({\n field: matchedField?.meaning ?? 'unknown',\n trigger: 'empty_submit',\n errorText: errorText.slice(0, 150),\n });\n }\n\n // Check for loading state text during submit\n const loadingText = await page.evaluate(() => {\n const loading = Array.from(document.querySelectorAll('button, [aria-busy=\"true\"], [class*=\"loading\" i], [class*=\"spinner\" i]'))\n .map((el) => (el as HTMLElement).innerText?.trim())\n .filter((t) => t && /loading|saving|submitting|sending|processing/i.test(t));\n return loading.slice(0, 3);\n });\n result.loadingPatterns.push(...loadingText);\n }\n } catch { /* non-fatal \u2014 form probe failed, continue */ }\n }\n\n // \u2500\u2500 Probe 2: Invalid format inputs \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n if (hasForm) {\n try {\n const emailField = formInputs.find((e) => e.expectedData === 'valid_email' || /email/i.test(e.meaning));\n const passwordField = formInputs.find((e) => e.expectedData === 'password' || /password/i.test(e.meaning));\n\n if (emailField) {\n const emailLocator = page.locator('input[type=\"email\"], input[name*=\"email\"], input[placeholder*=\"email\" i]').first();\n try {\n await emailLocator.fill('notanemail', { timeout: 1000 });\n await emailLocator.blur();\n await page.waitForTimeout(600);\n const errors = await collectErrors(page);\n for (const errorText of errors) {\n result.validationErrors.push({ field: emailField.meaning, trigger: 'invalid_format', errorText: errorText.slice(0, 150) });\n }\n } catch { /* locator not found */ }\n }\n\n if (passwordField) {\n const pwLocator = page.locator('input[type=\"password\"]').first();\n try {\n await pwLocator.fill('123', { timeout: 1000 });\n await pwLocator.blur();\n await page.waitForTimeout(600);\n const errors = await collectErrors(page);\n for (const errorText of errors) {\n if (!result.validationErrors.some((e) => e.errorText === errorText)) {\n result.validationErrors.push({ field: passwordField.meaning, trigger: 'invalid_format', errorText: errorText.slice(0, 150) });\n }\n }\n } catch { /* locator not found */ }\n }\n } catch { /* non-fatal */ }\n }\n\n // \u2500\u2500 Probe 3: Button clicks \u2192 discover modal/dialog contents \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n try {\n const triggers = await findModalTriggers(page);\n for (const trigger of triggers) {\n try {\n const btn = page.locator(`button:has-text(\"${trigger.label}\")`).first();\n const domBefore = await page.evaluate(() => document.body.innerText.length);\n\n await btn.click({ timeout: 1500 });\n await page.waitForTimeout(1000);\n\n // Check if a dialog/modal appeared\n const dialogText = await page.evaluate(() => {\n const DIALOG_SEL = '[role=\"dialog\"], [role=\"alertdialog\"], .modal, .Modal, [class*=\"modal\" i], [class*=\"dialog\" i], [class*=\"Dialog\"]';\n const dialogs = Array.from(document.querySelectorAll(DIALOG_SEL))\n .filter((el) => window.getComputedStyle(el).display !== 'none');\n if (dialogs.length === 0) return null;\n const d = dialogs[0] as HTMLElement;\n const title = d.querySelector('[role=\"heading\"], h1, h2, h3')?.textContent?.trim() || '';\n const content = d.innerText?.replace(/\\s+/g, ' ').trim().slice(0, 400);\n const fields = Array.from(d.querySelectorAll('input, select, textarea, button'))\n .map((f) => (f as HTMLElement).getAttribute('aria-label') || (f as HTMLElement).getAttribute('placeholder') || (f as HTMLInputElement).value || '')\n .filter((t) => t.trim().length > 0);\n return { title, content, fields };\n });\n\n if (dialogText && dialogText.content.length > 20) {\n result.modals.push({\n triggerElement: trigger.label,\n title: dialogText.title,\n content: dialogText.content,\n fields: dialogText.fields.slice(0, 10),\n });\n } else {\n // No modal appeared \u2014 check for accordion/disclosure panel reveals\n // Clicks on accordion triggers change aria-expanded but don't open a dialog.\n const accordionText = await page.evaluate(() => {\n const panels = Array.from(document.querySelectorAll(\n '[aria-expanded=\"true\"] + *, details[open] > :not(summary), [data-state=\"open\"]:not([role=\"dialog\"]):not([class*=\"modal\" i]), [data-headlessui-state=\"open\"] > *'\n )).filter((el) => {\n const s = window.getComputedStyle(el as HTMLElement);\n return s.display !== 'none' && s.visibility !== 'hidden';\n });\n if (panels.length === 0) return null;\n const panel = panels[0] as HTMLElement;\n const heading = panel.querySelector('h2,h3,h4')?.textContent?.replace(/\\s+/g, ' ').trim() || '';\n const content = panel.innerText?.replace(/\\s+/g, ' ').trim().slice(0, 400) || '';\n return content.length > 15 ? { heading, content } : null;\n });\n if (accordionText) {\n result.modals.push({\n triggerElement: trigger.label,\n title: accordionText.heading || `${trigger.label} (revealed)`,\n content: accordionText.content,\n fields: [],\n });\n }\n }\n\n // Dismiss: Escape key first, then close button\n await page.keyboard.press('Escape');\n await page.waitForTimeout(400);\n\n // Check if toast appeared after the click\n const toasts = await collectToasts(page);\n for (const t of toasts) {\n if (t.length > 5) result.successMessages.push({ type: 'toast', content: t.slice(0, 200) });\n }\n } catch { /* this button's probe failed, try next */ }\n }\n } catch { /* non-fatal */ }\n\n // \u2500\u2500 Probe 4: Select/radio \u2192 conditional reveals \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n try {\n const conditionals = await probeConditionals(page);\n result.conditionals.push(...conditionals);\n } catch { /* non-fatal */ }\n\n // \u2500\u2500 Probe 5: Tab panels \u2014 click each tab, capture revealed content \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n try {\n result.tabPanels = await probeTabPanels(page);\n } catch { /* non-fatal */ }\n\n // \u2500\u2500 Probe 6: Tooltips \u2014 hover/title/describedby capture \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n try {\n result.tooltips = await probeTooltips(page);\n } catch { /* non-fatal */ }\n\n // \u2500\u2500 Probe 7: Carousel/slider slides \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n try {\n result.carouselSlides = await probeCarousels(page);\n } catch { /* non-fatal */ }\n\n // \u2500\u2500 Probe 8: Wizard/multi-step form steps \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n try {\n result.wizardSteps = await probeWizardSteps(page);\n } catch { /* non-fatal */ }\n\n // \u2500\u2500 Probe 9: Focus-trap detection on any open dialogs \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n try {\n result.focusTraps = await detectFocusTraps(page);\n } catch { /* non-fatal */ }\n\n // \u2500\u2500 Probe 10: Skip navigation compliance (WCAG 2.4.1) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n try {\n result.skipNavIssues = await probeSkipNavigation(page);\n } catch { /* non-fatal */ }\n\n // \u2500\u2500 Probe 11: Context menu capture on canvas/chart elements \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n try {\n result.contextMenus = await probeContextMenus(page);\n } catch { /* non-fatal */ }\n\n return result;\n}\n\n/** Phase 5: Convert ProbeResult to typed ProbeObservationFact rows for direct DB storage. */\nexport function probeResultToObservations(result: ProbeResult): Array<{\n elementMeaning: string; observationType: string; observedText: string; triggeredBy: string;\n}> {\n const obs: Array<{ elementMeaning: string; observationType: string; observedText: string; triggeredBy: string }> = [];\n for (const ve of result.validationErrors) {\n obs.push({ elementMeaning: ve.field, observationType: 'VALIDATION_ERROR', observedText: ve.errorText, triggeredBy: ve.trigger });\n }\n for (const sm of result.successMessages) {\n obs.push({ elementMeaning: '(page)', observationType: 'SUCCESS_TOAST', observedText: sm.content, triggeredBy: sm.type });\n }\n for (const m of result.modals) {\n obs.push({ elementMeaning: m.triggerElement, observationType: 'MODAL', observedText: [m.title, m.content].filter(Boolean).join(' \u2014 ').slice(0, 500), triggeredBy: `button_click:${m.triggerElement}` });\n }\n for (const c of result.conditionals) {\n obs.push({ elementMeaning: c.triggerElement, observationType: 'CONDITIONAL_REVEAL', observedText: c.revealedText, triggeredBy: `select_change:${c.triggerElement}:${c.triggerValue}` });\n }\n for (const lp of result.loadingPatterns) {\n obs.push({ elementMeaning: '(submit button)', observationType: 'LOADING_STATE', observedText: lp, triggeredBy: 'form_submit' });\n }\n for (const tp of result.tabPanels ?? []) {\n obs.push({ elementMeaning: tp.tabLabel, observationType: 'TAB_PANEL', observedText: tp.panelContent, triggeredBy: `tab_click:${tp.tabLabel}` });\n }\n for (const tt of result.tooltips ?? []) {\n obs.push({ elementMeaning: tt.triggerLabel, observationType: 'TOOLTIP', observedText: tt.tooltipText, triggeredBy: 'hover_or_title' });\n }\n for (const cs of result.carouselSlides ?? []) {\n obs.push({ elementMeaning: `Slide ${cs.slideIndex + 1}`, observationType: 'CAROUSEL_SLIDE', observedText: cs.content, triggeredBy: `carousel_next:${cs.slideIndex}` });\n }\n for (const ws of result.wizardSteps ?? []) {\n obs.push({ elementMeaning: ws.stepLabel ?? `Step ${ws.stepIndex + 1}`, observationType: 'WIZARD_STEP', observedText: ws.content, triggeredBy: `wizard_next:${ws.stepIndex}` });\n }\n for (const ft of result.focusTraps ?? []) {\n obs.push({ elementMeaning: ft.modalTrigger, observationType: 'FOCUS_TRAP', observedText: ft.focusTrapped ? 'Focus correctly trapped inside dialog' : 'FAIL: focus escaped dialog \u2014 WCAG 2.1.2 violation', triggeredBy: 'tab_key_sequence' });\n }\n for (const issue of result.skipNavIssues ?? []) {\n obs.push({ elementMeaning: '(page)', observationType: 'SKIP_NAV_ISSUE', observedText: issue, triggeredBy: 'skip_nav_audit' });\n }\n for (const cm of result.contextMenus ?? []) {\n obs.push({ elementMeaning: cm.trigger, observationType: 'CONTEXT_MENU', observedText: cm.items.join(' | '), triggeredBy: 'right_click' });\n }\n return obs;\n}\n\n/**\n * Convert a ProbeResult into markdown to store as KnowledgeChunks\n * and update ERROR_CATALOGUE + INTERACTION_PATTERNS skill files.\n */\nexport function probeResultToMarkdown(result: ProbeResult): {\n errorCatalogueChunk: string;\n interactionPatternsChunk: string;\n} {\n const lines: string[] = [`## Probe Observations \u2014 ${result.url}\\n`];\n\n if (result.validationErrors.length > 0) {\n lines.push('### Validation Errors (observed)');\n for (const ve of result.validationErrors) {\n lines.push(`- **${ve.field}** (${ve.trigger}): \"${ve.errorText}\"`);\n }\n }\n\n if (result.successMessages.length > 0) {\n lines.push('\\n### Success / Feedback Messages (observed)');\n for (const sm of result.successMessages) {\n lines.push(`- ${sm.type}: \"${sm.content}\"`);\n }\n }\n\n if (result.modals.length > 0) {\n lines.push('\\n### Modal / Dialog Contents (observed)');\n for (const m of result.modals) {\n lines.push(`- **Trigger:** ${m.triggerElement}`);\n if (m.title) lines.push(` - Title: ${m.title}`);\n lines.push(` - Content: ${m.content.slice(0, 200)}`);\n if (m.fields.length > 0) lines.push(` - Fields: ${m.fields.join(', ')}`);\n }\n }\n\n if ((result.tabPanels ?? []).length > 0) {\n lines.push('\\n### Tab Panel Contents (observed)');\n for (const tp of result.tabPanels!) {\n lines.push(`- **Tab: ${tp.tabLabel}**${tp.panelHeading ? ` \u2014 ${tp.panelHeading}` : ''}: ${tp.panelContent.slice(0, 200)}`);\n }\n }\n\n if ((result.tooltips ?? []).length > 0) {\n lines.push('\\n### Tooltips (observed)');\n for (const tt of result.tooltips!) {\n lines.push(`- **${tt.triggerLabel}**: ${tt.tooltipText}`);\n }\n }\n\n if ((result.carouselSlides ?? []).length > 0) {\n lines.push('\\n### Carousel Slides (observed)');\n for (const cs of result.carouselSlides!) {\n lines.push(`- **Slide ${cs.slideIndex + 1}**${cs.heading ? ` \u2014 ${cs.heading}` : ''}: ${cs.content.slice(0, 200)}`);\n }\n }\n\n if ((result.wizardSteps ?? []).length > 0) {\n lines.push('\\n### Wizard / Multi-Step Form (observed)');\n for (const ws of result.wizardSteps!) {\n const label = ws.stepLabel ? ` \u2014 ${ws.stepLabel}` : '';\n lines.push(`- **Step ${ws.stepIndex + 1}${label}**: ${ws.content.slice(0, 200)}`);\n if (ws.fields.length > 0) lines.push(` - Fields: ${ws.fields.join(', ')}`);\n }\n }\n\n if ((result.focusTraps ?? []).length > 0) {\n lines.push('\\n### Focus-Trap Audit (observed)');\n for (const ft of result.focusTraps!) {\n const verdict = ft.focusTrapped ? '\u2705 PASS' : '\u274C FAIL (WCAG 2.1.2)';\n lines.push(`- **${ft.modalTrigger}**: ${verdict} \u2014 focused: [${ft.sampledFocused.slice(0, 4).join(', ')}]`);\n }\n }\n\n if (result.conditionals.length > 0) {\n lines.push('\\n### Conditional UI (observed)');\n for (const c of result.conditionals) {\n lines.push(`- **${c.triggerElement}** = \"${c.triggerValue}\" reveals: ${c.revealedText}`);\n }\n }\n\n if (result.loadingPatterns.length > 0) {\n lines.push('\\n### Loading State Text (observed)');\n for (const lp of result.loadingPatterns) lines.push(`- \"${lp}\"`);\n }\n\n const full = lines.join('\\n');\n\n const errorSection = result.validationErrors.length > 0\n ? `## Real Validation Errors \u2014 ${result.url}\\n` +\n result.validationErrors.map((e) => `- **${e.field}**: \"${e.errorText}\"`).join('\\n')\n : '';\n\n const interactionSection = [\n result.successMessages.length > 0\n ? `## Success Messages \u2014 ${result.url}\\n` + result.successMessages.map((s) => `- ${s.type}: \"${s.content}\"`).join('\\n')\n : '',\n result.loadingPatterns.length > 0\n ? `## Loading Patterns \u2014 ${result.url}\\n` + result.loadingPatterns.map((lp) => `- \"${lp}\"`).join('\\n')\n : '',\n result.modals.length > 0\n ? `## Modal Contents \u2014 ${result.url}\\n` + result.modals.map((m) => `### ${m.triggerElement}\\n${m.content}`).join('\\n')\n : '',\n ].filter(Boolean).join('\\n\\n');\n\n return {\n errorCatalogueChunk: errorSection,\n interactionPatternsChunk: interactionSection,\n };\n}\n\n/**\n * Run interactive probing for all screens discovered in a crawl session.\n * Called from crawlProject() when opts.interactive = true.\n */\nexport async function probeAllScreens(\n page: any,\n tenantId: string,\n projectId: string,\n discovered: Array<{ url: string; screenId?: string; elements?: any[] }>,\n onProgress?: (pct: number, step: string) => Promise<void>,\n): Promise<void> {\n const probeable = discovered.filter((d) => d.screenId && d.url && !d.url.includes('#'));\n if (probeable.length === 0) return;\n\n const errorCatalogueChunks: string[] = [];\n const interactionChunks: string[] = [];\n\n for (let i = 0; i < probeable.length; i++) {\n const screen = probeable[i];\n const pct = 88 + Math.round((i / probeable.length) * 10);\n await onProgress?.(pct, `Probing screen ${i + 1}/${probeable.length}: ${screen.url}`);\n\n try {\n // Navigate to screen\n if (page.url() !== screen.url) {\n await page.goto(screen.url, { waitUntil: 'domcontentloaded' });\n await page.waitForTimeout(1500); // SPA hydration\n }\n\n const result = await probeScreen(page, screen.screenId!, screen.url, screen.elements ?? []);\n\n // Phase 5: save structured probe observations (replaces per-re-probe)\n const observations = probeResultToObservations(result);\n if (observations.length > 0) {\n await AppBrain.saveProbeObservations(tenantId, projectId, screen.screenId!, observations).catch(console.warn);\n }\n\n // Store raw probe result as KnowledgeChunk (kept for BM25 / oversized projects)\n const md = probeResultToMarkdown(result);\n if (md.errorCatalogueChunk) errorCatalogueChunks.push(md.errorCatalogueChunk);\n if (md.interactionPatternsChunk) interactionChunks.push(md.interactionPatternsChunk);\n\n const probeMarkdown = [md.errorCatalogueChunk, md.interactionPatternsChunk].filter(Boolean).join('\\n\\n');\n if (probeMarkdown.length > 50) {\n await AppBrain.saveKnowledgeChunk(tenantId, projectId, 'probe', screen.screenId!, probeMarkdown, `Probe \u2014 ${screen.url}`).catch(console.warn);\n }\n\n if (result.validationErrors.length > 0) {\n console.log(`[probe] ${screen.url}: ${result.validationErrors.length} validation errors, ${result.modals.length} modals`);\n }\n } catch (err) {\n console.warn(`[probe] \u2717 ${screen.url}:`, err instanceof Error ? err.message : err);\n }\n }\n\n // Update ERROR_CATALOGUE skill file with all real observed errors\n if (errorCatalogueChunks.length > 0) {\n const combined = `# Error Catalogue (Real Observed \u2014 Interactive Probe)\\n\\n${errorCatalogueChunks.join('\\n\\n')}`;\n await AppBrain.upsertSkillFile(tenantId, projectId, 'ERROR_CATALOGUE', combined, {\n summary: `Real validation error messages observed via interactive probe across ${errorCatalogueChunks.length} screens`,\n scope: 'PROJECT',\n }).catch(console.warn);\n }\n\n // Update INTERACTION_PATTERNS skill file with real observed patterns\n if (interactionChunks.length > 0) {\n const combined = `# Interaction Patterns (Real Observed \u2014 Interactive Probe)\\n\\n${interactionChunks.join('\\n\\n')}`;\n await AppBrain.upsertSkillFile(tenantId, projectId, 'INTERACTION_PATTERNS', combined, {\n summary: `Real loading states, success messages, and modal contents observed via interactive probe`,\n scope: 'PROJECT',\n }).catch(console.warn);\n }\n\n await onProgress?.(98, 'Interactive probe complete');\n console.log(`[probe] Probed ${probeable.length} screens. Errors: ${errorCatalogueChunks.length}, Interactions: ${interactionChunks.length}`);\n}\n\n// \u2500\u2500 Keyboard Navigation Probe \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport interface FocusableElement {\n tag: string;\n role: string | null;\n ariaLabel: string | null;\n text: string | null;\n hasFocusIndicator: boolean;\n tabIndex: number | null;\n}\n\nexport interface KeyboardNavResult {\n focusableCount: number;\n elementsWithNoFocusIndicator: number;\n sequence: FocusableElement[];\n issues: string[];\n}\n\n/** Verify skip-navigation links exist and their targets are present in the DOM. */\nasync function probeSkipNavigation(page: Page): Promise<string[]> {\n const issues: string[] = [];\n try {\n const skipLinks = await page.evaluate(() =>\n Array.from(document.querySelectorAll('a[href^=\"#\"]'))\n .filter((el) => /skip|jump to|main content|content|nav/i.test((el as HTMLElement).innerText?.toLowerCase().trim() || ''))\n .map((el) => ({\n text: (el as HTMLElement).innerText?.trim() || '',\n href: el.getAttribute('href') || '',\n hasTarget: !!document.querySelector(el.getAttribute('href') || '#__invalid__'),\n }))\n );\n if (skipLinks.length === 0) {\n issues.push('No skip navigation links found (WCAG 2.4.1 \u2014 keyboard users cannot bypass nav blocks)');\n }\n for (const link of skipLinks) {\n if (!link.hasTarget) issues.push(`Skip link \"${link.text}\" \u2192 \"${link.href}\" target not found in DOM`);\n }\n } catch { /* non-fatal */ }\n return issues;\n}\n\n/** Right-click on canvas, chart, and context-menu elements to capture context menu items. */\nasync function probeContextMenus(page: Page): Promise<ContextMenuCapture[]> {\n const results: ContextMenuCapture[] = [];\n try {\n const targets = await page.$$('canvas, [data-contextmenu], [oncontextmenu], [class*=\"chart\" i]:not(script)');\n for (const t of targets.slice(0, 4)) {\n try {\n await t.click({ button: 'right', timeout: 1000 });\n await page.waitForTimeout(350);\n const items = await page.evaluate(() =>\n Array.from(document.querySelectorAll('[role=\"menu\"] [role=\"menuitem\"], .context-menu-item, [class*=\"contextmenu\" i] li'))\n .map((el) => (el as HTMLElement).innerText?.trim())\n .filter(Boolean).slice(0, 12)\n );\n if (items.length > 0) {\n const trigger = await t.evaluate((el) => (el as HTMLElement).getAttribute('aria-label') || (el as HTMLElement).className.slice(0, 40) || el.tagName).catch(() => '');\n results.push({ trigger, items });\n }\n await page.keyboard.press('Escape').catch(() => { });\n } catch { /* skip this target */ }\n }\n } catch { /* non-fatal */ }\n return results;\n}\n\n/** Click carousel next buttons up to 8 slides and record content of each revealed slide. */\nasync function probeCarousels(page: Page): Promise<CarouselSlide[]> {\n const results: CarouselSlide[] = [];\n try {\n const CAROUSEL_SEL = '[class*=\"carousel\" i], [class*=\"slider\" i], [class*=\"swiper\" i], [role=\"region\"][aria-roledescription*=\"carousel\" i]';\n const hasCarousel = await page.evaluate((sel) => !!document.querySelector(sel), CAROUSEL_SEL);\n if (!hasCarousel) return results;\n\n const NEXT_SEL = '[aria-label*=\"next\" i], [aria-label*=\"Next\"], [class*=\"next\" i]:not([class*=\"footnext\"]):not(a), button[class*=\"arrow-right\" i], button[class*=\"chevron-right\" i]';\n\n // Capture slide 0 (current state)\n const slide0 = await page.evaluate((carSel) => {\n const car = document.querySelector(carSel) as HTMLElement | null;\n if (!car) return null;\n const active = car.querySelector('[aria-hidden=\"false\"], .active, [class*=\"active\" i], [class*=\"current\" i]') as HTMLElement | null;\n const target = active ?? car;\n return { heading: target.querySelector('h2,h3,h4')?.textContent?.trim() ?? '', content: target.innerText?.replace(/\\s+/g, ' ').trim().slice(0, 300) ?? '' };\n }, CAROUSEL_SEL);\n if (slide0?.content && slide0.content.length > 15) results.push({ slideIndex: 0, heading: slide0.heading || undefined, content: slide0.content });\n\n const seen = new Set<string>(slide0?.content ? [slide0.content] : []);\n for (let i = 1; i < 8; i++) {\n try {\n const nextBtn = page.locator(NEXT_SEL).first();\n const visible = await nextBtn.isVisible().catch(() => false);\n if (!visible) break;\n await nextBtn.click({ timeout: 1000 });\n await page.waitForTimeout(600);\n const slide = await page.evaluate((carSel) => {\n const car = document.querySelector(carSel) as HTMLElement | null;\n if (!car) return null;\n const active = car.querySelector('[aria-hidden=\"false\"], .active, [class*=\"active\" i], [class*=\"current\" i]') as HTMLElement | null;\n const target = active ?? car;\n return { heading: target.querySelector('h2,h3,h4')?.textContent?.trim() ?? '', content: target.innerText?.replace(/\\s+/g, ' ').trim().slice(0, 300) ?? '' };\n }, CAROUSEL_SEL);\n if (!slide?.content || slide.content.length < 15 || seen.has(slide.content)) break;\n seen.add(slide.content);\n results.push({ slideIndex: i, heading: slide.heading || undefined, content: slide.content });\n } catch { break; }\n }\n } catch { /* non-fatal */ }\n return results;\n}\n\n/** Follow Next/Continue buttons to capture each wizard step's fields and content. */\nasync function probeWizardSteps(page: Page): Promise<WizardStep[]> {\n const results: WizardStep[] = [];\n try {\n const NEXT_LABELS = /^(next|continue|proceed|step \\d|\u203A|\u2192|forward)/i;\n const BACK_LABELS = /^(back|previous|prev|\u2039|\u2190)/i;\n const WIZARD_INDICATORS = '[role=\"progressbar\"], [class*=\"stepper\" i], [class*=\"wizard\" i], [class*=\"progress-step\" i], [aria-label*=\"step\" i]';\n const isWizard = await page.evaluate((sel) => !!document.querySelector(sel), WIZARD_INDICATORS);\n if (!isWizard) return results;\n\n const captureStep = async (stepIndex: number): Promise<WizardStep> => {\n const data = await page.evaluate(() => {\n const content = (document.querySelector('main, [role=\"main\"], form') as HTMLElement | null)?.innerText?.replace(/\\s+/g, ' ').trim().slice(0, 400) ?? '';\n const stepLabel = document.querySelector('[aria-current=\"step\"], [class*=\"step-label\" i], [class*=\"stepper-label\" i]')?.textContent?.trim() ?? '';\n const fields = Array.from(document.querySelectorAll('input:not([type=\"hidden\"]), select, textarea'))\n .map((el) => (el as HTMLElement).getAttribute('aria-label') || (el as HTMLInputElement).placeholder || (el as HTMLInputElement).name || '')\n .filter(Boolean).slice(0, 10);\n return { content, stepLabel, fields };\n });\n return { stepIndex, stepLabel: data.stepLabel || undefined, content: data.content, fields: data.fields };\n };\n\n results.push(await captureStep(0));\n\n for (let i = 1; i < 6; i++) {\n try {\n const nextLabel = await page.evaluate((nextRe) => {\n const btns = Array.from(document.querySelectorAll('button, [role=\"button\"]'));\n const btn = btns.find((b) => new RegExp(nextRe).test((b as HTMLElement).innerText?.trim() || ''));\n return (btn as HTMLElement)?.innerText?.trim() || null;\n }, NEXT_LABELS.source);\n if (!nextLabel) break;\n const btn = page.locator(`button:has-text(\"${nextLabel}\")`).first();\n await btn.click({ timeout: 1500 });\n await page.waitForTimeout(800);\n results.push(await captureStep(i));\n } catch { break; }\n }\n } catch { /* non-fatal */ }\n return results;\n}\n\n/** For each open modal, Tab 8\u00D7 and verify focus stays inside the dialog (focus-trap check). */\nasync function detectFocusTraps(page: Page): Promise<FocusTrapResult[]> {\n const results: FocusTrapResult[] = [];\n try {\n const openDialogs = await page.evaluate(() => {\n return Array.from(document.querySelectorAll('[role=\"dialog\"], [role=\"alertdialog\"]'))\n .filter((el) => window.getComputedStyle(el).display !== 'none')\n .map((el) => el.getAttribute('aria-label') || el.querySelector('[role=\"heading\"]')?.textContent?.trim() || 'dialog');\n });\n for (const dialogLabel of openDialogs.slice(0, 3)) {\n const sampled: string[] = [];\n let allInside = true;\n for (let i = 0; i < 8; i++) {\n await page.keyboard.press('Tab');\n await page.waitForTimeout(80);\n const focused = await page.evaluate(() => {\n const el = document.activeElement as HTMLElement | null;\n const inDialog = !!el?.closest('[role=\"dialog\"], [role=\"alertdialog\"]');\n return { label: el?.getAttribute('aria-label') || el?.textContent?.trim().slice(0, 40) || el?.tagName || '', inDialog };\n });\n sampled.push(focused.label);\n if (!focused.inDialog) { allInside = false; break; }\n }\n results.push({ modalTrigger: dialogLabel, focusTrapped: allInside, sampledFocused: sampled });\n }\n } catch { /* non-fatal */ }\n return results;\n}\n\n/** Click each visible tab and record the panel content revealed. */\nasync function probeTabPanels(page: Page): Promise<TabPanelCapture[]> {\n const results: TabPanelCapture[] = [];\n try {\n const tabs = await page.$$('[role=\"tab\"]:not([aria-disabled=\"true\"])');\n for (const tab of tabs.slice(0, 10)) {\n try {\n const tabLabel = await tab.evaluate((el) => (el as HTMLElement).innerText?.trim() || el.getAttribute('aria-label') || '');\n if (!tabLabel) continue;\n await tab.click({ timeout: 1000 });\n await page.waitForTimeout(400);\n const panelContent = await page.evaluate(() => {\n const panel = document.querySelector('[role=\"tabpanel\"]:not([hidden])') as HTMLElement | null;\n if (!panel) return null;\n const style = window.getComputedStyle(panel);\n if (style.display === 'none' || style.visibility === 'hidden') return null;\n return {\n heading: panel.querySelector('h2,h3,h4')?.textContent?.trim() ?? '',\n content: panel.innerText?.replace(/\\s+/g, ' ').trim().slice(0, 400) ?? '',\n };\n });\n if (panelContent?.content && panelContent.content.length > 15) {\n results.push({ tabLabel: tabLabel.slice(0, 60), panelContent: panelContent.content, panelHeading: panelContent.heading || undefined });\n }\n } catch { /* this tab failed, try next */ }\n }\n } catch { /* non-fatal */ }\n return results;\n}\n\n/** Hover elements with title/aria-describedby to capture tooltip text. */\nasync function probeTooltips(page: Page): Promise<TooltipCapture[]> {\n const results: TooltipCapture[] = [];\n try {\n const candidates = await page.evaluate(() => {\n return Array.from(document.querySelectorAll('[title], [aria-describedby], [data-tooltip], [data-tip], [class*=\"tooltip\" i]'))\n .filter((el) => {\n const style = window.getComputedStyle(el as HTMLElement);\n return style.display !== 'none' && style.visibility !== 'hidden';\n })\n .slice(0, 8)\n .map((el) => ({\n label: (el as HTMLElement).innerText?.trim().slice(0, 60) || el.getAttribute('aria-label') || '',\n title: el.getAttribute('title') || '',\n describedBy: el.getAttribute('aria-describedby') || '',\n selector: el.tagName.toLowerCase() + (el.id ? `#${el.id}` : ''),\n }));\n });\n for (const c of candidates) {\n try {\n // Prefer title attribute directly \u2014 no need to hover for static tooltips\n if (c.title && c.title.length > 5) {\n results.push({ triggerLabel: c.label || c.selector, tooltipText: c.title.slice(0, 200) });\n continue;\n }\n if (c.describedBy) {\n const tooltipText = await page.evaluate((id) => document.getElementById(id)?.textContent?.trim() ?? '', c.describedBy);\n if (tooltipText && tooltipText.length > 5) {\n results.push({ triggerLabel: c.label || c.selector, tooltipText: tooltipText.slice(0, 200) });\n }\n }\n } catch { /* skip this element */ }\n }\n } catch { /* non-fatal */ }\n return results;\n}\n\n/**\n * Probe keyboard navigation accessibility by pressing Tab up to 50 times and\n * recording each focused element's properties and focus-indicator visibility.\n * Stops early if focus wraps back to the start or hits the same element twice.\n */\nexport async function probeKeyboardNav(page: Page): Promise<KeyboardNavResult> {\n const sequence: FocusableElement[] = [];\n const issues: string[] = [];\n const seenKeys = new Set<string>();\n let firstKey: string | null = null;\n\n for (let i = 0; i < 50; i++) {\n await page.keyboard.press('Tab');\n\n const el = await page.evaluate(() => {\n const active = document.activeElement as HTMLElement | null;\n if (!active || active === document.body) return null;\n const outline = window.getComputedStyle(active).outline;\n return {\n tag: active.tagName.toLowerCase(),\n role: active.getAttribute('role'),\n ariaLabel: active.getAttribute('aria-label'),\n text: (active.innerText ?? '').trim().slice(0, 60) || null,\n outline,\n tabIndex: active.tabIndex ?? null,\n };\n });\n\n if (!el) break;\n\n const hasFocusIndicator =\n el.outline !== 'none' &&\n el.outline !== '' &&\n !el.outline.startsWith('0px') &&\n !el.outline.startsWith('rgba(0, 0, 0, 0)') &&\n !el.outline.startsWith('rgba(0,0,0,0)');\n\n const focusable: FocusableElement = {\n tag: el.tag,\n role: el.role,\n ariaLabel: el.ariaLabel,\n text: el.text,\n hasFocusIndicator,\n tabIndex: el.tabIndex,\n };\n\n const key = `${el.tag}|${el.text ?? ''}|${el.role ?? ''}`;\n\n if (i === 0) {\n firstKey = key;\n } else if (key === firstKey || seenKeys.has(key)) {\n // Focus wrapped back to start or hit a duplicate \u2014 stop probing\n break;\n }\n\n seenKeys.add(key);\n sequence.push(focusable);\n\n if (!hasFocusIndicator) {\n issues.push(`Element #${i + 1} (${el.tag}) has no visible focus indicator`);\n }\n }\n\n return {\n focusableCount: sequence.length,\n elementsWithNoFocusIndicator: issues.length,\n sequence,\n issues,\n };\n}\n"],
|
|
5
|
+
"mappings": "AAqBA,SAAS,gBAAgB;AAqFzB,MAAM,kBAAkB;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAAkB;AAAA,EAAkB;AAAA,EAAsB;AAAA,EAC1D;AAAA,EAAgB;AAAA,EAChB;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AACF,EAAE,KAAK,IAAI;AAGX,MAAM,kBAAkB;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,EAAE,KAAK,IAAI;AAGX,eAAe,WAAW,MAAY,UAAkB,QAAQ,MAAyB;AACvF,MAAI;AACF,UAAM,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C,KAAK,GAAG,GAAG,kCAAkC;AAAA,IAC5E;AAAA,EACF;AAEA,SAAO;AAAA,IACL,gBAAgB,SAAS;AAAA,IACzB,8BAA8B,OAAO;AAAA,IACrC;AAAA,IACA;AAAA,EACF;AACF;",
|
|
6
|
+
"names": ["btn"]
|
|
7
7
|
}
|
package/dist/screen-reader.js
CHANGED
|
@@ -2,16 +2,17 @@ async function readScreen(page) {
|
|
|
2
2
|
return page.evaluate(() => {
|
|
3
3
|
const out = [];
|
|
4
4
|
const seen = /* @__PURE__ */ new Set();
|
|
5
|
-
const noiseLabel = /^(cookie|consent|privacy policy|terms of use|copyright|©|\bv\d+\.\d+|
|
|
5
|
+
const noiseLabel = /^(cookie|consent|privacy policy|terms of use|copyright|©|\bv\d+\.\d+|got it|dismiss|skip to|powered by|copied|\s*$)/i;
|
|
6
6
|
const nodes = document.querySelectorAll(
|
|
7
|
-
|
|
7
|
+
'input:not([type=hidden]), select, textarea, button, a[href], [role="button"], [role="combobox"], [role="slider"], [role="switch"], [role="tab"], [role="menuitem"], [role="searchbox"], [role="spinbutton"]'
|
|
8
8
|
);
|
|
9
9
|
nodes.forEach((el) => {
|
|
10
10
|
const htmlEl = el;
|
|
11
11
|
const style = window.getComputedStyle(htmlEl);
|
|
12
12
|
if (style.display === "none" || style.visibility === "hidden" || style.opacity === "0") return;
|
|
13
13
|
const rect = el.getBoundingClientRect();
|
|
14
|
-
|
|
14
|
+
const hasAccessibleLabel = !!(el.getAttribute("aria-label") || el.getAttribute("aria-labelledby"));
|
|
15
|
+
if (rect.width === 0 && rect.height === 0 && !hasAccessibleLabel) return;
|
|
15
16
|
const tag = el.tagName.toLowerCase();
|
|
16
17
|
const role = el.getAttribute("role") || (tag === "input" ? el.type || "text" : tag);
|
|
17
18
|
const raw = (el.getAttribute("aria-label") || el.getAttribute("placeholder") || (el.getAttribute("title") ?? "") || htmlEl.innerText?.replace(/\s+/g, " ").trim() || el.getAttribute("name") || "").substring(0, 80);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/screen-reader.ts"],
|
|
4
|
-
"sourcesContent": ["import type { Page } from 'playwright';\n\n/**\n * Reads a page as a structured outline (cheap + reliable), the way\n * Playwright MCP / the accessibility tree works \u2014 NOT by sending pixels to a\n * vision model. Vision is a fallback for image-only pages (added later).\n *\n * Returns the interactive elements found, which the Screen Reader Agent then\n * enriches with MEANING and saves to the Zeta Core.\n */\nexport interface RawElement {\n role: string;\n label: string;\n selectorHint: string;\n expectedData?: string;\n}\n\nexport async function readScreen(page: Page): Promise<RawElement[]> {\n return page.evaluate(() => {\n const out: { role: string; label: string; selectorHint: string; expectedData?: string }[] = [];\n const seen = new Set<string>();\n\n // Noise patterns to skip \u2014 cookie banners, footer
|
|
5
|
-
"mappings": "AAiBA,eAAsB,WAAW,MAAmC;AAClE,SAAO,KAAK,SAAS,MAAM;AACzB,UAAM,MAAsF,CAAC;AAC7F,UAAM,OAAO,oBAAI,IAAY;
|
|
4
|
+
"sourcesContent": ["import type { Page } from 'playwright';\n\n/**\n * Reads a page as a structured outline (cheap + reliable), the way\n * Playwright MCP / the accessibility tree works \u2014 NOT by sending pixels to a\n * vision model. Vision is a fallback for image-only pages (added later).\n *\n * Returns the interactive elements found, which the Screen Reader Agent then\n * enriches with MEANING and saves to the Zeta Core.\n */\nexport interface RawElement {\n role: string;\n label: string;\n selectorHint: string;\n expectedData?: string;\n}\n\nexport async function readScreen(page: Page): Promise<RawElement[]> {\n return page.evaluate(() => {\n const out: { role: string; label: string; selectorHint: string; expectedData?: string }[] = [];\n const seen = new Set<string>();\n\n // Noise patterns to skip \u2014 cookie banners, footer chrome, version strings\n // Intentionally excludes standalone \"close\" and \"copy\" \u2014 too many false positives\n // (Close account, Close preview, Copy link, Copy to clipboard are all valid test targets)\n const noiseLabel =\n /^(cookie|consent|privacy policy|terms of use|copyright|\u00A9|\\bv\\d+\\.\\d+|got it|dismiss|skip to|powered by|copied|\\s*$)/i;\n\n // Include ARIA-role elements \u2014 Headless UI, Radix, Ant Design, Shadcn all use these instead of native tags\n const nodes = document.querySelectorAll(\n 'input:not([type=hidden]), select, textarea, button, a[href], ' +\n '[role=\"button\"], [role=\"combobox\"], [role=\"slider\"], [role=\"switch\"], ' +\n '[role=\"tab\"], [role=\"menuitem\"], [role=\"searchbox\"], [role=\"spinbutton\"]'\n );\n\n nodes.forEach((el) => {\n const htmlEl = el as HTMLElement;\n\n // Skip invisible elements\n const style = window.getComputedStyle(htmlEl);\n if (style.display === 'none' || style.visibility === 'hidden' || style.opacity === '0') return;\n const rect = el.getBoundingClientRect();\n // Allow zero-size elements that carry an accessible label (sr-only icon buttons, skip-nav links)\n const hasAccessibleLabel = !!(el.getAttribute('aria-label') || el.getAttribute('aria-labelledby'));\n if (rect.width === 0 && rect.height === 0 && !hasAccessibleLabel) return;\n\n // Derive role\n const tag = el.tagName.toLowerCase();\n const role =\n el.getAttribute('role') ||\n (tag === 'input' ? ((el as HTMLInputElement).type || 'text') : tag);\n\n // Derive the best human-readable label (prefer aria > placeholder > inner text)\n const raw = (\n el.getAttribute('aria-label') ||\n el.getAttribute('placeholder') ||\n (el.getAttribute('title') ?? '') ||\n htmlEl.innerText?.replace(/\\s+/g, ' ').trim() ||\n el.getAttribute('name') ||\n ''\n ).substring(0, 80);\n\n // Skip empty, noise patterns, or very long labels (likely container text)\n if (!raw || noiseLabel.test(raw) || raw.length > 70) return;\n\n // Deduplicate by role+normalised label\n const key = `${role}:${raw.toLowerCase()}`;\n if (seen.has(key)) return;\n seen.add(key);\n\n let expectedData: string | undefined;\n if (tag === 'input') {\n const input = el as HTMLInputElement;\n if (input.type === 'email' || /email/i.test(raw)) expectedData = 'valid_email';\n else if (input.type === 'password' || /password/i.test(raw)) expectedData = 'password';\n else if (input.type === 'tel' || /phone|mobile/i.test(raw)) expectedData = 'phone';\n else if (input.type === 'date' || /\\bdate\\b/i.test(raw)) expectedData = 'date';\n else if (/\\b(code|otp|token)\\b/i.test(raw)) expectedData = 'one_time_code';\n else if (/\\b(search|query)\\b/i.test(raw)) expectedData = 'search_term';\n }\n\n out.push({ role, label: raw, selectorHint: tag, expectedData });\n });\n\n // Prioritise: form fields > buttons > links; within each group keep order\n const priority = (e: typeof out[0]) => {\n if (['email', 'password', 'text', 'tel', 'date', 'number', 'select', 'textarea'].includes(e.role)) return 0;\n if (e.role === 'button' || e.role === 'submit') return 1;\n return 2;\n };\n out.sort((a, b) => priority(a) - priority(b));\n\n return out.slice(0, 25); // cap at 25 \u2014 enough context, not overwhelming\n });\n}\n"],
|
|
5
|
+
"mappings": "AAiBA,eAAsB,WAAW,MAAmC;AAClE,SAAO,KAAK,SAAS,MAAM;AACzB,UAAM,MAAsF,CAAC;AAC7F,UAAM,OAAO,oBAAI,IAAY;AAK7B,UAAM,aACJ;AAGF,UAAM,QAAQ,SAAS;AAAA,MACrB;AAAA,IAGF;AAEA,UAAM,QAAQ,CAAC,OAAO;AACpB,YAAM,SAAS;AAGf,YAAM,QAAQ,OAAO,iBAAiB,MAAM;AAC5C,UAAI,MAAM,YAAY,UAAU,MAAM,eAAe,YAAY,MAAM,YAAY,IAAK;AACxF,YAAM,OAAO,GAAG,sBAAsB;AAEtC,YAAM,qBAAqB,CAAC,EAAE,GAAG,aAAa,YAAY,KAAK,GAAG,aAAa,iBAAiB;AAChG,UAAI,KAAK,UAAU,KAAK,KAAK,WAAW,KAAK,CAAC,mBAAoB;AAGlE,YAAM,MAAM,GAAG,QAAQ,YAAY;AACnC,YAAM,OACJ,GAAG,aAAa,MAAM,MACrB,QAAQ,UAAY,GAAwB,QAAQ,SAAU;AAGjE,YAAM,OACJ,GAAG,aAAa,YAAY,KAC5B,GAAG,aAAa,aAAa,MAC5B,GAAG,aAAa,OAAO,KAAK,OAC7B,OAAO,WAAW,QAAQ,QAAQ,GAAG,EAAE,KAAK,KAC5C,GAAG,aAAa,MAAM,KACtB,IACA,UAAU,GAAG,EAAE;AAGjB,UAAI,CAAC,OA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