← Back to Research Index View Raw Source

sovereign-plugin-ai-forensic-search-react-source.txt

import { useState, useRef, useEffect, useCallback } from "react"; // ─── CONSTANTS ───────────────────────────────────────────────────────────────── const navy = "#1a2e45"; const gold = "#b8621a"; const cream = "#faf8f4"; const TELEMETRY_SAMPLE_INTERVAL_MS = 250; const TELEMETRY_HISTORY_MAX = 120; // 30 seconds at 250ms const ANOMALY_VELOCITY_TAX_THRESH = 0.40; // 40% velocity loss = flag const ANOMALY_LATENCY_THRESH_MS = 32; // >2 frames = flag // ─── FILE CONTENTS ───────────────────────────────────────────────────────────── const FILES = [ { label: "sovereign-plugin/wrangler.jsonc", content: `/** * ============================================================ * SOVEREIGN PLUGIN — Cloudflare Worker Configuration * ============================================================ * Copyright (c) 2026 Albert Lane. All Rights Reserved. * * Design: Albert Lane * AI Architecture: Google Gemini * Compiled & Reviewed by: Claude (Anthropic) & Google Gemini * * SECURITY NOTICE: * Routes restricted to albertlane.net zone only. * AI binding scoped to this Worker. No secrets in this file. * Use: wrangler secret put SECRET_NAME * LICENSE: Proprietary. See LICENSE.md. * ============================================================ */ { "$schema": "node_modules/wrangler/config-schema.json", "name": "sovereign-plugin", "main": "src/index.js", "compatibility_date": "2025-03-07", "compatibility_flags": ["nodejs_compat"], "workers_dev": false, "routes": [ { "pattern": "albertlane.net", "zone_name": "albertlane.net" }, { "pattern": "albertlane.net/*", "zone_name": "albertlane.net" }, { "pattern": "ai.albertlane.net/*", "zone_name": "albertlane.net" } ], "ai": { "binding": "AI" }, "kv_namespaces": [ { "binding": "SOVEREIGN_CACHE", "id": "241909e73d2e4ff298179c6ba533dff6" } ], "build": { "command": "npm install" }, "observability": { "enabled": true, "head_sampling_rate": 1 }, "rules": [ { "type": "Text", "globs": ["**/*.html", "**/script.js"], "fallthrough": true } ] }` }, { label: "sovereign-plugin/package.json", content: `{ "name": "sovereign-plugin", "version": "1.0.0", "description": "Sovereign Plugin — AI forensic search. Property of Albert Lane.", "main": "src/index.js", "type": "module", "scripts": { "start": "wrangler dev", "deploy": "wrangler deploy" }, "author": "Albert Lane <albert@albertlane.net>", "license": "SEE LICENSE IN LICENSE.md", "repository": { "type": "git", "url": "https://github.com/Albert-lane/ThirdAttempt" }, "devDependencies": { "wrangler": "3.114.7" }, "engines": { "node": ">=18.0.0" } }` }, { label: "sovereign-plugin/src/index.js", content: `/** * ============================================================ * SOVEREIGN PLUGIN — Cloudflare Worker Entry Point * ============================================================ * Copyright (c) 2026 Albert Lane. All Rights Reserved. * * Design: Albert Lane * AI Architecture: Google Gemini * Compiled & Reviewed by: Claude (Anthropic) & Google Gemini * * ROUTES: * GET / → Grid UI (index.html) * GET /script.js → Client logic * POST /api/query → C1 direct AI generation * POST /api/search → S1 AI search + KV cache * OPTIONS * → CORS preflight * * SECURITY: * CORS locked to https://albertlane.net * All AI calls server-side — no keys exposed to client * KV cache keys sanitised and length-capped * Input validation on all POST routes * * DISCLAIMER: * AI output is provided as-is. Albert Lane, Anthropic PBC, * and Google LLC accept no liability for AI-generated content. * * LICENSE: Proprietary. See LICENSE.md. * ============================================================ */ import htmlTemplate from './index.html'; import clientScript from './script.js'; export default { async fetch(request, env, ctx) { const url = new URL(request.url); const path = url.pathname; const method = request.method; // CORS preflight if (method === 'OPTIONS') { return new Response(null, { status: 204, headers: corsHeaders() }); } // Static: client script if (path === '/script.js') { return new Response(clientScript, { headers: { 'Content-Type': 'application/javascript;charset=UTF-8', 'Cache-Control': 'public, max-age=3600, stale-while-revalidate=86400' } }); } // POST /api/query — direct AI (C1 panel) if (path === '/api/query') { if (method !== 'POST') return errorResponse(405, 'Method Not Allowed'); let body; try { body = await request.json(); } catch { return errorResponse(400, 'Invalid JSON body'); } const prompt = (body.prompt || '').trim(); if (!prompt) return errorResponse(400, 'Missing required field: prompt'); const model = body.model || '@cf/meta/llama-3-8b-instruct'; try { const ai = await env.AI.run(model, { messages: [{ role: 'user', content: prompt }] }); return new Response(JSON.stringify(ai), { headers: { 'Content-Type': 'application/json', ...corsHeaders() } }); } catch (err) { console.error('[/api/query]', err.message); return errorResponse(500, 'AI Execution Failure'); } } // POST /api/search — AI search + KV cache (S1 panel) if (path === '/api/search') { if (method !== 'POST') return errorResponse(405, 'Method Not Allowed'); let body; try { body = await request.json(); } catch { return errorResponse(400, 'Invalid JSON body'); } const query = (body.query || '').trim(); if (!query) return errorResponse(400, 'Missing required field: query'); const cacheKey = 'search:' + query.toLowerCase() .slice(0, 200).replace(/[^a-z0-9 _-]/g, ''); try { const cached = await env.SOVEREIGN_CACHE.get(cacheKey); if (cached) { return new Response(cached, { headers: { 'Content-Type': 'application/json', 'X-Cache': 'HIT', ...corsHeaders() } }); } } catch (e) { console.warn('[cache read]', e.message); } const sys = 'You are the Sovereign Plugin search engine for albertlane.net. ' + 'Return a JSON array of results. Each: title, url, description, ' + 'metadata (string|null), schema ("https"|"http"|"ftp"|"other"). ' + 'ONLY return a valid JSON array. No prose. No fences. Max 8 results.'; let results = []; try { const ai = await env.AI.run('@cf/meta/llama-3-8b-instruct', { messages: [{ role: 'system', content: sys }, { role: 'user', content: query }] }); const raw = (ai && ai.response) ? ai.response : String(ai); const parsed = JSON.parse(raw.replace(/\`\`\`json|\`\`\`/g, '').trim()); results = Array.isArray(parsed) ? parsed : []; } catch (e) { console.warn('[search parse]', e.message); results = [{ title: query, url: 'https://albertlane.net/?q=' + encodeURIComponent(query), description: 'Structured results unavailable. Raw AI response returned.', metadata: null, schema: 'https' }]; } const payload = JSON.stringify({ ok: true, query, results }); try { await env.SOVEREIGN_CACHE.put(cacheKey, payload, { expirationTtl: 3600 }); } catch (e) { console.warn('[cache write]', e.message); } return new Response(payload, { headers: { 'Content-Type': 'application/json', 'X-Cache': 'MISS', ...corsHeaders() } }); } // Default — serve grid UI return new Response(htmlTemplate, { headers: { 'Content-Type': 'text/html;charset=UTF-8', 'X-Content-Type-Options': 'nosniff', 'X-Frame-Options': 'SAMEORIGIN', 'Referrer-Policy': 'no-referrer', 'Permissions-Policy': 'camera=(), microphone=(), geolocation=()' } }); } }; function corsHeaders() { return { 'Access-Control-Allow-Origin': 'https://albertlane.net', 'Access-Control-Allow-Methods': 'GET, POST, OPTIONS', 'Access-Control-Allow-Headers': 'Content-Type', 'Access-Control-Max-Age': '86400' }; } function errorResponse(status, message) { return new Response(JSON.stringify({ ok: false, error: message }), { status, headers: { 'Content-Type': 'application/json', ...corsHeaders() } }); }` }, { label: "sovereign-plugin/src/script.js", content: `/** * ============================================================ * SOVEREIGN PLUGIN — Client-Side Interface Logic * ============================================================ * Copyright (c) 2026 Albert Lane. All Rights Reserved. * * Design: Albert Lane * AI Architecture: Google Gemini * Compiled & Reviewed by: Claude (Anthropic) & Google Gemini * * PANELS: S1 (search), R1 (results), L (links), * P (blog iframe), C1 (auditor), B1 (expand toggle) * * SECURITY: * All API calls same-origin only. No third-party runtime scripts. * External links: noopener,noreferrer. No client-side PII storage. * * DISCLAIMER: AI output informational only. * LICENSE: Proprietary. See LICENSE.md. * ============================================================ */ 'use strict'; document.addEventListener('DOMContentLoaded', () => { const b1Button = document.getElementById('b1-btn'); const s1Window = document.getElementById('s1'); const s1Header = document.getElementById('s1-header'); const c1Column = document.getElementById('c1'); const r1Panel = document.getElementById('r1'); const lColumn = document.getElementById('l-col'); const pBlog = document.getElementById('p-blog'); // Blog iframe const blogFrame = document.createElement('iframe'); blogFrame.src = 'https://blog.albertlane.net'; blogFrame.loading = 'lazy'; blogFrame.title = 'Albert Lane — Digital Fraud Audit Series'; blogFrame.setAttribute('sandbox', 'allow-scripts allow-same-origin allow-popups allow-forms'); blogFrame.setAttribute('referrerpolicy', 'no-referrer'); pBlog.appendChild(blogFrame); // B1 expand let s1Expanded = false; b1Button.addEventListener('click', () => { s1Expanded = !s1Expanded; s1Window.classList.toggle('expanded', s1Expanded); r1Panel.classList.toggle('s2-mode', s1Expanded); b1Button.innerHTML = s1Expanded ? '&#9664;' : '&#9654;'; b1Button.setAttribute('aria-expanded', String(s1Expanded)); }); s1Header.addEventListener('click', () => { r1Panel.scrollTop = 0; }); // C1 expand c1Column.addEventListener('click', (e) => { if (['INPUT','SELECT','BUTTON','TEXTAREA'].includes(e.target.tagName)) return; c1Column.classList.toggle('expanded'); }); // Link reveal system function bindLinks(nodeList) { nodeList.forEach((el) => { let timer = null; el.addEventListener('click', (e) => { e.stopPropagation(); if (timer) { clearTimeout(timer); timer = null; el.classList.remove('path-revealed'); const uri = el.dataset.uri; if (uri && uri !== '#') window.open(uri, '_blank', 'noopener,noreferrer'); } else { el.classList.add('path-revealed'); el.setAttribute('title', el.dataset.uri || ''); timer = setTimeout(() => { el.classList.remove('path-revealed'); timer = null; }, 2500); } }); el.addEventListener('dblclick', (e) => { e.stopPropagation(); if (!el.classList.contains('path-revealed')) { el.classList.add('path-revealed'); el.textContent = el.getAttribute('data-uri') || el.textContent; } else { el.classList.remove('path-revealed'); el.textContent = 'Link_Hidden'; } }); }); } // S1 chat const s1Log = document.createElement('div'); s1Log.setAttribute('role', 'log'); s1Log.setAttribute('aria-live', 'polite'); s1Log.style.cssText = 'flex:1;overflow-y:auto;font-size:0.78rem;padding:0.4rem 0;min-height:0;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;touch-action:pan-y;'; const s1Row = document.createElement('div'); s1Row.style.cssText = 'display:flex;gap:0.3rem;flex-shrink:0;padding-top:0.4rem;'; const s1Input = document.createElement('input'); s1Input.type = 'text'; s1Input.placeholder = 'Query the Sovereign\u2026'; s1Input.setAttribute('aria-label', 'Search query'); s1Input.setAttribute('autocomplete', 'off'); s1Input.style.cssText = 'flex:1;background:rgba(255,255,255,0.08);border:1px solid rgba(255,255,255,0.18);color:#fff;padding:0.4rem 0.5rem;font-family:monospace;font-size:0.76rem;outline:none;border-radius:2px;'; const s1Btn = document.createElement('button'); s1Btn.innerHTML = '&#9654;'; s1Btn.style.cssText = 'background:rgba(150,130,200,0.35);color:#fff;border:1px solid rgba(255,255,255,0.2);padding:0.4rem 0.7rem;cursor:pointer;font-family:monospace;border-radius:2px;'; s1Row.appendChild(s1Input); s1Row.appendChild(s1Btn); s1Window.appendChild(s1Log); s1Window.appendChild(s1Row); function s1Append(who, text, color) { const line = document.createElement('div'); line.style.cssText = 'padding:0.25rem 0;border-bottom:1px solid rgba(255,255,255,0.05);word-break:break-word;font-size:0.76rem;'; const lbl = document.createElement('strong'); lbl.style.color = color || 'rgba(150,130,200,0.9)'; lbl.textContent = who + ': '; line.appendChild(lbl); line.appendChild(document.createTextNode(text)); s1Log.appendChild(line); s1Log.scrollTop = s1Log.scrollHeight; } async function handleS1Submit() { const query = s1Input.value.trim(); if (!query) return; s1Input.value = ''; s1Append('You', query, '#8bbfe8'); try { const res = await fetch('/api/search', { method: 'POST', headers: {'Content-Type':'application/json'}, body: JSON.stringify({query}) }); if (!res.ok) throw new Error('HTTP ' + res.status); const data = await res.json(); if (data.ok && data.results.length > 0) { renderR1(data.results, query); s1Append('Sovereign', data.results.length + ' result' + (data.results.length !== 1 ? 's' : '') + ' — see R1.', 'rgba(150,130,200,0.9)'); } else { s1Append('Sovereign', 'No results found.', 'rgba(150,130,200,0.9)'); } } catch (err) { s1Append('Error', err.message, '#ff6666'); } } s1Btn.addEventListener('click', handleS1Submit); s1Input.addEventListener('keydown', e => { if (e.key === 'Enter') handleS1Submit(); }); r1Panel.innerHTML = '<div style="padding:0.8rem;font-size:0.74rem;opacity:0.3;">Awaiting query\u2026</div>'; function renderR1(results, query) { r1Panel.innerHTML = ''; const hdr = document.createElement('div'); hdr.style.cssText = 'padding:0.45rem 0.6rem;font-size:0.68rem;opacity:0.5;border-bottom:1px solid rgba(255,255,255,0.07);position:sticky;top:0;background:rgba(20,15,30,0.95);cursor:pointer;'; hdr.textContent = '\u201C' + query + '\u201D \u2014 ' + results.length + ' results'; hdr.addEventListener('click', () => { r1Panel.scrollTop = 0; }); r1Panel.appendChild(hdr); results.forEach((item, i) => { const entry = document.createElement('div'); entry.style.cssText = 'padding:0.6rem;border-bottom:1px solid rgba(255,255,255,0.04);'; const uriEl = document.createElement('div'); uriEl.className = 'secured-link'; uriEl.dataset.uri = item.url || '#'; uriEl.textContent = item.url || 'unknown'; uriEl.style.cssText = 'color:' + schemaColor(item.schema || item.url || '') + ';margin-bottom:0.15rem;font-size:0.72rem;font-family:monospace;cursor:pointer;'; const titleEl = document.createElement('div'); titleEl.style.cssText = 'color:#c8b8e8;font-size:0.85rem;font-weight:600;line-height:1.3;margin-bottom:0.15rem;'; titleEl.textContent = item.title || ('Result ' + (i+1)); const descEl = document.createElement('div'); descEl.style.cssText = 'font-size:0.74rem;opacity:0.65;line-height:1.5;'; descEl.textContent = item.description || ''; entry.appendChild(uriEl); entry.appendChild(titleEl); entry.appendChild(descEl); if (item.metadata) { const m = document.createElement('div'); m.style.cssText = 'color:#ff4444;font-size:0.66rem;margin-top:0.15rem;'; m.textContent = '[META: ' + item.metadata + ']'; entry.appendChild(m); } r1Panel.appendChild(entry); }); syncL(results); bindLinks(r1Panel.querySelectorAll('.secured-link')); } function syncL(results) { lColumn.innerHTML = ''; results.slice(0, 11).forEach((item, i) => { const link = document.createElement('div'); link.className = 'secured-link'; link.dataset.uri = item.url || '#'; link.textContent = 'L' + String(i+1).padStart(2,'0'); link.style.cssText = 'width:100%;text-align:center;padding:0.3rem 0;border-bottom:1px solid rgba(255,255,255,0.04);flex-shrink:0;color:' + schemaColor(item.schema || item.url || '') + ';font-size:0.72rem;font-family:monospace;cursor:pointer;'; lColumn.appendChild(link); }); bindLinks(lColumn.querySelectorAll('.secured-link')); } function schemaColor(v) { if (/^https/i.test(v)) return '#cccccc'; if (/^http/i.test(v)) return '#999999'; if (/^ftp/i.test(v)) return '#777777'; return '#444444'; } // C1 auditor const MODELS = [ ['Llama 3 8B (default)', '@cf/meta/llama-3-8b-instruct'], ['Llama 3.1 8B', '@cf/meta/llama-3.1-8b-instruct'], ['Llama 3.1 70B', '@cf/meta/llama-3.1-70b-instruct'], ['Mistral 7B', '@cf/mistral/mistral-7b-instruct-v0.1'], ['Gemma 7B', '@cf/google/gemma-7b-it'] ]; const modelSel = document.createElement('select'); modelSel.setAttribute('aria-label', 'Select AI model'); modelSel.style.cssText = 'width:100%;background:rgba(100,80,120,0.55);color:#fff;border:1px solid rgba(255,255,255,0.13);padding:0.25rem 0.35rem;font-family:monospace;font-size:0.65rem;margin-bottom:0.3rem;outline:none;cursor:pointer;flex-shrink:0;border-radius:2px;'; MODELS.forEach(([l,v]) => { const o = document.createElement('option'); o.value=v; o.textContent=l; modelSel.appendChild(o); }); const c1Log = document.createElement('div'); c1Log.style.cssText = 'flex:1;overflow-y:auto;font-size:0.68rem;padding:0.2rem 0;min-height:0;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;touch-action:pan-y;'; const c1Input = document.createElement('input'); c1Input.type='text'; c1Input.placeholder='Auditor query\u2026'; c1Input.setAttribute('aria-label','Auditor query'); c1Input.setAttribute('autocomplete','off'); c1Input.style.cssText = 'width:100%;background:rgba(255,255,255,0.06);border:1px solid rgba(255,255,255,0.13);color:#fff;padding:0.35rem 0.45rem;font-family:monospace;font-size:0.68rem;outline:none;flex-shrink:0;border-radius:2px;'; const c1Btn = document.createElement('button'); c1Btn.innerHTML='&#9654;'; c1Btn.style.cssText = 'width:100%;margin-top:0.25rem;background:rgba(100,80,120,0.45);color:#fff;border:1px solid rgba(255,255,255,0.13);padding:0.28rem;cursor:pointer;font-family:monospace;font-size:0.68rem;flex-shrink:0;border-radius:2px;'; const c1Label = document.createElement('div'); c1Label.style.cssText = 'font-size:0.62rem;opacity:0.4;letter-spacing:0.1em;flex-shrink:0;padding-bottom:0.3rem;text-transform:uppercase;'; c1Label.textContent = 'C1 \u2014 Sovereign Auditor'; c1Column.appendChild(c1Label); c1Column.appendChild(modelSel); c1Column.appendChild(c1Log); c1Column.appendChild(c1Input); c1Column.appendChild(c1Btn); function c1Append(who, text, color) { const line = document.createElement('div'); line.style.cssText = 'padding:0.2rem 0;border-bottom:1px solid rgba(255,255,255,0.04);word-break:break-word;font-size:0.68rem;'; const lbl = document.createElement('strong'); lbl.style.color=color||'rgba(130,100,180,0.9)'; lbl.textContent=who+': '; line.appendChild(lbl); line.appendChild(document.createTextNode(text)); c1Log.appendChild(line); c1Log.scrollTop = c1Log.scrollHeight; } async function handleC1Submit() { const prompt = c1Input.value.trim(); if (!prompt) return; c1Input.value=''; c1Append('\u25B6', prompt, '#8bbfe8'); try { const res = await fetch('/api/query', { method:'POST', headers:{'Content-Type':'application/json'}, body:JSON.stringify({prompt, model:modelSel.value}) }); if (!res.ok) throw new Error('HTTP ' + res.status); const data = await res.json(); const reply = (data && data.response) ? data.response : (data.error || JSON.stringify(data)); c1Append('C1', typeof reply==='string' ? reply : JSON.stringify(reply), 'rgba(130,100,180,0.9)'); } catch (err) { c1Append('ERR', err.message, '#ff6666'); } } c1Btn.addEventListener('click', handleC1Submit); c1Input.addEventListener('keydown', e => { if (e.key==='Enter') handleC1Submit(); }); });` }, { label: "wrangler.jsonc (root)", content: `/** * ============================================================ * THIRDATTEMPT — Blog Worker Configuration * ============================================================ * Copyright (c) 2026 Albert Lane. All Rights Reserved. * Design: Albert Lane | Compiled & Reviewed by: Claude (Anthropic) & Google Gemini * LICENSE: Proprietary. See LICENSE.md. * ============================================================ */ { "$schema": "node_modules/wrangler/config-schema.json", "name": "thirdattempt", "compatibility_date": "2025-09-27", "observability": { "enabled": true }, "assets": { "directory": "." }, "compatibility_flags": ["nodejs_compat"], "routes": [ { "pattern": "blog.albertlane.net", "zone_name": "albertlane.net" }, { "pattern": "blog.albertlane.net/*", "zone_name": "albertlane.net" } ] }` }, { label: "_headers", content: `# ============================================================ # SOVEREIGN PLUGIN — HTTP Security Headers # Copyright (c) 2026 Albert Lane. All Rights Reserved. # Compiled & Reviewed by: Claude (Anthropic) & Google Gemini # # X-Frame-Options permits framing by albertlane.net only (P panel iframe). # CSP frame-ancestors is the modern equivalent. # ============================================================ /* X-Content-Type-Options: nosniff X-Frame-Options: ALLOW-FROM https://albertlane.net Content-Security-Policy: frame-ancestors 'self' https://albertlane.net https://*.albertlane.net Referrer-Policy: no-referrer Permissions-Policy: camera=(), microphone=(), geolocation=(), payment=(), usb=() X-XSS-Protection: 1; mode=block X-Powered-By: SovereignPlugin/1.0 — albertlane.net` }, { label: "robots.txt", content: `# ============================================================ # SOVEREIGN PLUGIN — robots.txt # Copyright (c) 2026 Albert Lane. All Rights Reserved. # ============================================================ User-agent: * Allow: / Allow: /index.html Allow: /forward.html Allow: /introduction.html Allow: /chapter-1.html Allow: /chapter-2.html Allow: /chapter-3.html Disallow: /api/ Disallow: /.wrangler/ Disallow: /node_modules/ Disallow: /.well-known/ Sitemap: https://blog.albertlane.net/sitemap.xml` }, { label: "sitemap.xml", content: `<?xml version="1.0" encoding="UTF-8"?> <!-- SOVEREIGN PLUGIN — XML Sitemap Copyright (c) 2026 Albert Lane. All Rights Reserved. Compiled & Reviewed by: Claude (Anthropic) & Google Gemini --> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <url><loc>https://blog.albertlane.net/</loc> <lastmod>2026-01-14</lastmod><changefreq>monthly</changefreq><priority>1.0</priority></url> <url><loc>https://blog.albertlane.net/forward.html</loc> <lastmod>2026-01-14</lastmod><changefreq>monthly</changefreq><priority>0.9</priority></url> <url><loc>https://blog.albertlane.net/introduction.html</loc> <lastmod>2026-01-14</lastmod><changefreq>monthly</changefreq><priority>0.9</priority></url> <url><loc>https://blog.albertlane.net/chapter-1.html</loc> <lastmod>2026-01-14</lastmod><changefreq>monthly</changefreq><priority>0.9</priority></url> <url><loc>https://blog.albertlane.net/chapter-2.html</loc> <lastmod>2026-01-14</lastmod><changefreq>monthly</changefreq><priority>0.9</priority></url> <url><loc>https://blog.albertlane.net/chapter-3.html</loc> <lastmod>2026-01-14</lastmod><changefreq>monthly</changefreq><priority>0.9</priority></url> </urlset>` }, { label: ".well-known/security.txt", content: `# ============================================================ # RFC 9116 — Security Vulnerability Disclosure # Copyright (c) 2026 Albert Lane. All Rights Reserved. # ============================================================ Contact: mailto:security@albertlane.net Expires: 2027-01-01T00:00:00.000Z Preferred-Languages: en Canonical: https://albertlane.net/.well-known/security.txt Policy: https://albertlane.net/security-policy.html` }, { label: ".gitignore", content: `# ============================================================ # SOVEREIGN PLUGIN — .gitignore # NEVER commit .env, .dev.vars, or any credentials. # Copyright (c) 2026 Albert Lane. All Rights Reserved. # ============================================================ .DS_Store Thumbs.db *.swp *.swo .env .dev.vars .dev.vars.* !.dev.vars.example .wrangler/ node_modules/ .vscode/ .idea/` }, { label: "LICENSE.md", content: `# SOVEREIGN PLUGIN — LICENSE Copyright (c) 2026 **Albert Lane**. All Rights Reserved. ## Ownership **Design:** Albert Lane **AI Architecture:** Google Gemini **Compiled & Reviewed by:** Claude (Anthropic) & Google Gemini The UI/UX design, grid architecture, forensic methodology, and structural framework are the original creative work of Albert Lane. AI systems served as compilation tools and technical reviewers under the author's direction. ## No Licence Granted No licence is granted to use, copy, modify, merge, publish, distribute, sublicense, or sell this software without express written authorisation from Albert Lane. ## AI Liability Disclaimer Portions generated with Google Gemini and Claude (Anthropic). Albert Lane, Google LLC, and Anthropic PBC accept no liability for errors, security vulnerabilities, data loss, or any harm arising from use of this software or its AI-generated outputs. Software provided **"AS IS"** without warranty of any kind. ## AI Output Disclaimer AI endpoint content is informational only. It does not constitute legal, financial, or professional advice. Users are solely responsible for verifying AI-generated content. ## Security Vulnerability disclosures: security@albertlane.net See .well-known/security.txt ## Governing Law State of Oregon, United States of America. --- *No Kents Allowed.*` } ]; // ─── TELEMETRY ENGINE ────────────────────────────────────────────────────────── function useTelemetry(targetRef) { const samples = useRef([]); const touchState = useRef({ startY: 0, startX: 0, startTime: 0, lastY: 0, lastScrollTop: 0 }); const eventLog = useRef([]); const [report, setReport] = useState(null); const frameRef = useRef(null); const intervalRef = useRef(null); const logEvent = useCallback((type, data) => { const entry = { t: performance.now(), type, ...data }; eventLog.current.push(entry); if (eventLog.current.length > 500) eventLog.current.shift(); }, []); useEffect(() => { const el = targetRef.current; if (!el) return; // ── Touch instrumentation ──────────────────────────────────────────────── const onTouchStart = (e) => { const t = e.touches[0]; touchState.current = { startY: t.clientY, startX: t.clientX, startTime: performance.now(), lastY: t.clientY, lastScrollTop: el.scrollTop }; logEvent('touchstart', { y: t.clientY, x: t.clientX, scrollTop: el.scrollTop, defaultPrevented: e.defaultPrevented, cancelBubble: e.cancelBubble }); }; const onTouchMove = (e) => { const ts = touchState.current; const t = e.touches[0]; const now = performance.now(); const dt = now - ts.startTime; const dy = ts.startY - t.clientY; // positive = scroll down const dx = ts.startX - t.clientX; const vel = dt > 0 ? Math.abs(dy) / dt : 0; // px/ms const actualScroll = el.scrollTop - ts.lastScrollTop; const expectedScroll = ts.lastY - t.clientY; const tax = expectedScroll !== 0 ? 1 - Math.abs(actualScroll) / Math.abs(expectedScroll) : 0; logEvent('touchmove', { dy, dx, dt, vel, scrollTop: el.scrollTop, actualScroll, expectedScroll, velocityTax: tax, defaultPrevented: e.defaultPrevented, cancelBubble: e.cancelBubble, targetTag: e.target.tagName }); touchState.current.lastY = t.clientY; touchState.current.lastScrollTop = el.scrollTop; }; const onTouchEnd = (e) => { const ts = touchState.current; const now = performance.now(); const dt = now - ts.startTime; logEvent('touchend', { duration: dt, finalScrollTop: el.scrollTop }); }; const onScroll = () => { logEvent('scroll', { scrollTop: el.scrollTop, scrollHeight: el.scrollHeight, clientHeight: el.clientHeight }); }; el.addEventListener('touchstart', onTouchStart, { passive: true }); el.addEventListener('touchmove', onTouchMove, { passive: true }); el.addEventListener('touchend', onTouchEnd, { passive: true }); el.addEventListener('scroll', onScroll, { passive: true }); // ── Telemetry sampler ─────────────────────────────────────────────────── intervalRef.current = setInterval(() => { const now = performance.now(); const recent = eventLog.current.filter(e => now - e.t < TELEMETRY_SAMPLE_INTERVAL_MS * 2); const moves = recent.filter(e => e.type === 'touchmove'); const avgTax = moves.length > 0 ? moves.reduce((s, e) => s + (e.velocityTax || 0), 0) / moves.length : 0; const avgVel = moves.length > 0 ? moves.reduce((s, e) => s + (e.vel || 0), 0) / moves.length : 0; const anyPrevented = recent.some(e => e.defaultPrevented); const anyCancelled = recent.some(e => e.cancelBubble); const sample = { t: now, avgVelocityTax: avgTax, avgVelocity: avgVel, eventCount: recent.length, anyPrevented, anyCancelled, scrollable: el.scrollHeight > el.clientHeight, anomaly: avgTax > ANOMALY_VELOCITY_TAX_THRESH || anyPrevented }; samples.current.push(sample); if (samples.current.length > TELEMETRY_HISTORY_MAX) samples.current.shift(); }, TELEMETRY_SAMPLE_INTERVAL_MS); return () => { el.removeEventListener('touchstart', onTouchStart); el.removeEventListener('touchmove', onTouchMove); el.removeEventListener('touchend', onTouchEnd); el.removeEventListener('scroll', onScroll); clearInterval(intervalRef.current); }; }, [targetRef, logEvent]); const generateReport = useCallback(() => { const all = samples.current; const events = eventLog.current; const now = performance.now(); if (all.length === 0) { return { error: "No telemetry collected yet. Interact with the scroll area first." }; } const anomalousSamples = all.filter(s => s.anomaly); const avgTax = all.reduce((s, x) => s + x.avgVelocityTax, 0) / all.length; const maxTax = Math.max(...all.map(s => s.avgVelocityTax)); const preventedCount = events.filter(e => e.defaultPrevented).length; const cancelledCount = events.filter(e => e.cancelBubble).length; const scrollEvents = events.filter(e => e.type === 'scroll'); const scrollWorked = scrollEvents.some(e => e.scrollTop > 0); const moves = events.filter(e => e.type === 'touchmove'); const highTaxMoves = moves.filter(e => (e.velocityTax || 0) > ANOMALY_VELOCITY_TAX_THRESH); // Overlay injection heuristics const overlaySignals = []; if (avgTax > 0.5) overlaySignals.push(`High average velocity tax: ${(avgTax*100).toFixed(1)}% of scroll movement suppressed`); if (preventedCount > 0) overlaySignals.push(`${preventedCount} events had defaultPrevented=true — upstream handler intercepting events`); if (cancelledCount > 0) overlaySignals.push(`${cancelledCount} events had cancelBubble=true — propagation stopped above target`); if (!scrollWorked && moves.length > 5) overlaySignals.push(`Touch movement detected but scrollTop never changed — scroll container not receiving events`); if (highTaxMoves.length / Math.max(moves.length, 1) > 0.3) overlaySignals.push(`${highTaxMoves.length}/${moves.length} move events show >40% velocity tax — consistent with application-layer interception`); const bugs = []; if (!scrollWorked && moves.length > 0) bugs.push({ id: "BUG-001", severity: "HIGH", description: "Scroll container not responding to touch events", hypothesis: "touch-action or overscroll-behavior may be preventing scroll, or parent element is capturing events", fix: "Ensure scrollable element has: touch-action:pan-y, overscroll-behavior:contain, -webkit-overflow-scrolling:touch" }); if (preventedCount > 0) bugs.push({ id: "BUG-002", severity: "HIGH", description: "Touch events being preventDefault()ed by an upstream handler", hypothesis: "Host application (Claude app) or an overlay layer is calling preventDefault on touchmove events before they reach this component", fix: "Cannot fix from within component. Indicates application-layer gesture interceptor. Test: run same code in standalone browser." }); if (avgTax > 0.5) bugs.push({ id: "BUG-003", severity: "MED", description: `Scroll velocity tax ${(avgTax*100).toFixed(0)}% — user-initiated scroll movement is being damped`, hypothesis: "Application frame or WebView is applying friction to scroll events. May indicate an overlay gesture recognizer competing with native scroll.", fix: "Add passive:true to all touch listeners. Test velocity tax in standalone browser vs in-app WebView to isolate the interception layer." }); return { generatedAt: new Date().toISOString(), sessionDurationMs: now, telemetrySamples: all.length, totalEvents: events.length, touchMoveEvents: moves.length, scrollEvents: scrollEvents.length, scrollPositionReached: scrollEvents.length > 0 ? Math.max(...scrollEvents.map(e => e.scrollTop)) : 0, averageVelocityTax: avgTax, maxVelocityTax: maxTax, anomalousSampleCount: anomalousSamples.length, anomalousSampleRate: all.length > 0 ? anomalousSamples.length / all.length : 0, preventedEventCount: preventedCount, cancelledEventCount: cancelledCount, overlayInjectionSignals: overlaySignals, overlayInjectionLikelihood: overlaySignals.length === 0 ? "LOW" : overlaySignals.length <= 1 ? "MEDIUM" : "HIGH", bugs, verificationProtocol: [ "1. Open albertlane.net/sovereign-debug.html in Chrome DevTools (desktop) — establishes clean baseline", "2. Run same test in Claude.ai artifact viewer — compare velocity tax delta", "3. If Claude.ai tax > desktop tax by >20%: confirmed application-layer interception", "4. Check chrome://flags/#touch-events in Android WebView context", "5. Use DevTools > Performance > Interactions to verify touchmove latency", "6. Sample telemetry at 250ms intervals for 60 seconds minimum for statistical significance" ], recommendation: overlaySignals.length > 0 ? "Evidence suggests an application-layer event filter (likely Claude app WebView gesture recognizer) is intercepting scroll events before they reach this component. This cannot be fixed within the React component — it requires either: (a) the host app to configure its WebView to pass scroll events through, or (b) deploying this component in a standalone browser context where WebView gesture interception does not apply." : "No overlay injection signals detected. Scroll issues are likely component-level and addressable via CSS touch-action and overscroll-behavior fixes." }; }, []); return { generateReport, setReport, report, samples }; } // ─── MAIN COMPONENT ──────────────────────────────────────────────────────────── export default function SovereignFiles() { const [tab, setTab] = useState("files"); const [open, setOpen] = useState(0); const [copied, setCopied] = useState(null); const [report, setReport] = useState(null); const [isRunning, setIsRunning] = useState(false); const scrollRef = useRef(null); const { generateReport, samples } = useTelemetry(isRunning ? scrollRef : { current: null }); function copyFile(i, content) { if (!navigator.clipboard) return; navigator.clipboard.writeText(content).then(() => { setCopied(i); setTimeout(() => setCopied(c => c === i ? null : c), 2200); }); } function runDebugger() { setIsRunning(true); setReport(null); setTab("debug"); } function exportReport() { const r = generateReport(); setReport(r); } const bug = { borderLeft: `3px solid ${gold}`, background: "#fff8f0", padding: "0.6rem 0.8rem", marginBottom: "0.5rem", fontSize: "0.76rem", borderRadius: "0 3px 3px 0" }; return ( <div style={{ fontFamily: "'Gill Sans','Calibri',Arial,sans-serif", background: cream, minHeight: "100vh" }}> {/* ── Header ──────────────────────────────────────────────────────────── */} <div style={{ background: navy, color: "white", padding: "0.9rem 1.2rem" }}> <div style={{ maxWidth: 860, margin: "0 auto" }}> <div style={{ fontSize: "0.65rem", letterSpacing: "0.18em", textTransform: "uppercase", color: "#f0a84a", marginBottom: "0.2rem" }}> Sovereign Plugin — Source Files </div> <div style={{ fontFamily: "'Palatino Linotype',Georgia,serif", fontSize: "clamp(1rem,3vw,1.4rem)", fontWeight: 700, marginBottom: "0.3rem" }}> albertlane.net </div> <div style={{ fontSize: "0.68rem", opacity: 0.7, lineHeight: 1.6 }}> Design: <strong style={{color:"#f0a84a"}}>Albert Lane</strong> &nbsp;·&nbsp; AI Architecture: <strong style={{color:"#f0a84a"}}>Google Gemini</strong> &nbsp;·&nbsp; Compiled &amp; Reviewed by: <strong style={{color:"#f0a84a"}}>Claude (Anthropic)</strong> &amp; <strong style={{color:"#f0a84a"}}>Google Gemini</strong> </div> <div style={{ fontSize: "0.62rem", opacity: 0.45, marginTop: "0.2rem" }}> © 2026 Albert Lane · All Rights Reserved · Proprietary — See LICENSE.md </div> </div> </div> {/* ── Tab Bar ─────────────────────────────────────────────────────────── */} <div style={{ background: "#f0ece4", borderBottom: "1px solid #d8d0c4", padding: "0 1.2rem", display: "flex", gap: "0.15rem", maxWidth: 860, margin: "0 auto" }}> {[["files","Files"], ["debug","UX Debugger"]].map(([id, label]) => ( <button key={id} onClick={() => setTab(id)} style={{ fontFamily: "'Gill Sans','Calibri',Arial,sans-serif", fontSize: "0.75rem", fontWeight: 600, padding: "0.5rem 1rem", border: "none", borderBottom: tab === id ? `2.5px solid ${navy}` : "2.5px solid transparent", background: "none", color: tab === id ? navy : "#6b6560", cursor: "pointer" }}>{label}</button> ))} </div> <div style={{ maxWidth: 860, margin: "0 auto", padding: "1rem 1rem 2rem" }}> {/* ══ FILES TAB ═══════════════════════════════════════════════════════ */} {tab === "files" && ( <> {/* File tab strip */} <div style={{ display: "flex", flexWrap: "wrap", gap: "0.3rem", marginBottom: "0.75rem" }}> {FILES.map((f, i) => ( <button key={i} onClick={() => setOpen(i)} style={{ fontFamily: "'Cascadia Code','Consolas',monospace", fontSize: "0.65rem", padding: "0.28rem 0.6rem", border: `1.5px solid ${open === i ? navy : "#c8b8a0"}`, borderRadius: 3, background: open === i ? navy : "white", color: open === i ? "white" : "#3a3630", cursor: "pointer", whiteSpace: "nowrap" }}> {f.label.split("/").pop()} </button> ))} </div> {/* Active file */} {FILES.map((file, i) => i !== open ? null : ( <div key={i} style={{ background: "white", border: "1px solid #d8d0c4", borderTop: `3px solid ${navy}`, borderRadius: "0 0 4px 4px", overflow: "hidden" }}> {/* File bar */} <div style={{ display: "flex", alignItems: "center", justifyContent: "space-between", padding: "0.5rem 0.8rem", background: navy, gap: "0.8rem" }}> <span style={{ fontFamily: "'Cascadia Code','Consolas',monospace", fontSize: "0.7rem", color: "rgba(255,255,255,0.8)", minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}> {file.label} </span> <button onClick={() => copyFile(i, file.content)} style={{ fontFamily: "'Gill Sans','Calibri',Arial,sans-serif", fontSize: "0.7rem", fontWeight: 700, padding: "0.26rem 0.8rem", border: `1.5px solid ${copied === i ? "#66bb6a" : "rgba(255,255,255,0.28)"}`, borderRadius: 3, background: copied === i ? "rgba(102,187,106,0.2)" : "rgba(255,255,255,0.07)", color: copied === i ? "#a5d6a7" : "rgba(255,255,255,0.85)", cursor: "pointer", whiteSpace: "nowrap", flexShrink: 0, transition: "all 0.18s" }} > {copied === i ? "✓ Copied" : "Copy"} </button> </div> {/* Scrollable code — KEY FIX: touch-action + overscroll-behavior */} <pre ref={scrollRef} style={{ margin: 0, padding: "0.85rem 1rem", overflowX: "auto", overflowY: "auto", fontFamily: "'Cascadia Code','Fira Mono','Consolas','Courier New',monospace", fontSize: "0.72rem", lineHeight: 1.65, color: "#1c1a18", background: "#faf8f4", whiteSpace: "pre", /* ── Scroll fixes ── */ height: "60vh", touchAction: "pan-y pan-x", overscrollBehavior: "contain", WebkitOverflowScrolling: "touch", userSelect: "text", WebkitUserSelect: "text" }} > <code>{file.content}</code> </pre> {/* Byte count */} <div style={{ padding: "0.3rem 0.8rem", background: "#f0ece4", fontSize: "0.63rem", color: "#9b9490", borderTop: "1px solid #d8d0c4" }}> {file.content.length.toLocaleString()} chars &nbsp;·&nbsp; {file.content.split("\n").length} lines </div> </div> ))} </> )} {/* ══ DEBUG TAB ═══════════════════════════════════════════════════════ */} {tab === "debug" && ( <div> <div style={{ fontFamily: "'Palatino Linotype',Georgia,serif", fontSize: "1.1rem", fontWeight: 700, color: navy, marginBottom: "0.3rem" }}> UX / Event Layer Debugger </div> <div style={{ fontSize: "0.74rem", color: "#6b6560", lineHeight: 1.7, marginBottom: "0.8rem" }}> This tool instruments touch and scroll events on the code viewer to detect application-layer filtering, overlay injection, and event interception. It samples telemetry at {TELEMETRY_SAMPLE_INTERVAL_MS}ms intervals and computes a velocity tax — the ratio of expected scroll distance suppressed before reaching the DOM element. A consistent tax above {ANOMALY_VELOCITY_TAX_THRESH*100}% indicates an upstream gesture recogniser (such as a WebView or host app) intercepting events. </div> {/* Control strip */} <div style={{ display: "flex", gap: "0.5rem", flexWrap: "wrap", marginBottom: "1rem" }}> <button onClick={runDebugger} style={{ padding: "0.45rem 1rem", background: navy, color: "white", border: "none", borderRadius: 3, fontFamily: "inherit", fontSize: "0.76rem", fontWeight: 600, cursor: "pointer" }}> {isRunning ? "▶ Running — Scroll the code block" : "▶ Start Instrumentation"} </button> <button onClick={exportReport} disabled={!isRunning} style={{ padding: "0.45rem 1rem", background: isRunning ? gold : "#ccc", color: "white", border: "none", borderRadius: 3, fontFamily: "inherit", fontSize: "0.76rem", fontWeight: 600, cursor: isRunning ? "pointer" : "not-allowed" }}> Export Bug Report </button> {isRunning && ( <button onClick={() => { setIsRunning(false); }} style={{ padding: "0.45rem 1rem", background: "white", color: navy, border: `1.5px solid ${navy}`, borderRadius: 3, fontFamily: "inherit", fontSize: "0.76rem", fontWeight: 600, cursor: "pointer" }}> Stop </button> )} </div> {/* Live sample count */} {isRunning && ( <div style={{ fontSize: "0.72rem", color: gold, fontFamily: "'Cascadia Code',monospace", marginBottom: "0.8rem", padding: "0.4rem 0.6rem", background: "#fdf5ea", border: `1px solid ${gold}`, borderRadius: 3 }}> ● LIVE &nbsp;·&nbsp; Samples: {samples.current.length} &nbsp;·&nbsp; Go to the Files tab and scroll the code block to generate telemetry. </div> )} {/* Instrumented scroll target */} {isRunning && ( <div style={{ marginBottom: "1rem" }}> <div style={{ fontSize: "0.68rem", color: "#9b9490", marginBottom: "0.3rem" }}> Instrumented scroll target (scroll this area aggressively): </div> <pre ref={scrollRef} style={{ height: "22vh", overflow: "auto", background: "#1a2e45", color: "#a0b8cc", padding: "0.6rem 0.8rem", fontFamily: "'Cascadia Code','Consolas',monospace", fontSize: "0.68rem", lineHeight: 1.6, borderRadius: 4, touchAction: "pan-y pan-x", overscrollBehavior: "contain", WebkitOverflowScrolling: "touch" }} > {FILES[2].content} </pre> </div> )} {/* Bug Report Output */} {report && ( <div> {/* Summary header */} <div style={{ background: navy, color: "white", padding: "0.6rem 0.9rem", borderRadius: "4px 4px 0 0", display: "flex", justifyContent: "space-between", alignItems: "center" }}> <span style={{ fontWeight: 700, fontSize: "0.8rem" }}>Bug Report — {report.generatedAt}</span> <span style={{ fontSize: "0.68rem", fontWeight: 700, padding: "0.2rem 0.55rem", borderRadius: 10, background: report.overlayInjectionLikelihood === "HIGH" ? "#c62828" : report.overlayInjectionLikelihood === "MEDIUM" ? gold : "#2e7d32", color: "white" }}> Overlay: {report.overlayInjectionLikelihood} </span> </div> <div style={{ background: "white", border: "1px solid #d8d0c4", borderTop: "none", borderRadius: "0 0 4px 4px", padding: "0.9rem" }}> {/* Metrics grid */} <div style={{ display: "grid", gridTemplateColumns: "repeat(auto-fit,minmax(140px,1fr))", gap: "0.5rem", marginBottom: "0.9rem" }}> {[ ["Velocity Tax", `${(report.averageVelocityTax*100).toFixed(1)}%`, report.averageVelocityTax > 0.4 ? "#c62828" : "#2e7d32"], ["Max Tax", `${(report.maxVelocityTax*100).toFixed(1)}%`, report.maxVelocityTax > 0.4 ? "#c62828" : "#2e7d32"], ["Prevented", report.preventedEventCount, report.preventedEventCount > 0 ? "#c62828" : "#2e7d32"], ["Touch Events", report.touchMoveEvents, "#1a2e45"], ["Scroll Events", report.scrollEvents, "#1a2e45"], ["Max ScrollTop", `${report.scrollPositionReached}px`, report.scrollPositionReached > 0 ? "#2e7d32" : "#c62828"] ].map(([label, val, col]) => ( <div key={label} style={{ background: "#f8f6f2", border: "1px solid #e0d8cc", borderRadius: 3, padding: "0.45rem 0.6rem", textAlign: "center" }}> <div style={{ fontFamily: "'Palatino Linotype',Georgia,serif", fontSize: "1.1rem", fontWeight: 700, color: col || navy }}>{val}</div> <div style={{ fontSize: "0.62rem", color: "#9b9490", textTransform: "uppercase", letterSpacing: "0.08em" }}>{label}</div> </div> ))} </div> {/* Overlay signals */} {report.overlayInjectionSignals.length > 0 && ( <div style={{ marginBottom: "0.9rem" }}> <div style={{ fontSize: "0.7rem", fontWeight: 700, color: navy, textTransform: "uppercase", letterSpacing: "0.1em", marginBottom: "0.4rem" }}> Overlay Injection Signals </div> {report.overlayInjectionSignals.map((s, i) => ( <div key={i} style={{ ...bug, borderColor: "#c62828", background: "#fff5f5" }}> ⚠ {s} </div> ))} </div> )} {/* Bugs */} {report.bugs.length > 0 && ( <div style={{ marginBottom: "0.9rem" }}> <div style={{ fontSize: "0.7rem", fontWeight: 700, color: navy, textTransform: "uppercase", letterSpacing: "0.1em", marginBottom: "0.4rem" }}> Bug Report </div> {report.bugs.map(b => ( <div key={b.id} style={{ ...bug, borderColor: b.severity === "HIGH" ? "#c62828" : gold }}> <div style={{ fontWeight: 700, color: navy, marginBottom: "0.2rem" }}> [{b.id}] <span style={{ color: b.severity === "HIGH" ? "#c62828" : gold }}>{b.severity}</span> — {b.description} </div> <div style={{ color: "#5a5048", marginBottom: "0.2rem" }}> <strong>Hypothesis:</strong> {b.hypothesis} </div> <div style={{ color: "#3a6b3a" }}> <strong>Fix:</strong> {b.fix} </div> </div> ))} </div> )} {/* Verification protocol */} <div style={{ marginBottom: "0.9rem" }}> <div style={{ fontSize: "0.7rem", fontWeight: 700, color: navy, textTransform: "uppercase", letterSpacing: "0.1em", marginBottom: "0.4rem" }}> Verification Protocol </div> {report.verificationProtocol.map((step, i) => ( <div key={i} style={{ fontSize: "0.73rem", color: "#3a3630", padding: "0.25rem 0", borderBottom: "1px solid #eee" }}> {step} </div> ))} </div> {/* Recommendation */} <div style={{ background: "#edf2f8", borderLeft: `3px solid ${navy}`, padding: "0.6rem 0.8rem", fontSize: "0.74rem", color: "#1a2e45", borderRadius: "0 3px 3px 0" }}> <strong>Recommendation:</strong> {report.recommendation} </div> {/* Raw JSON export */} <button onClick={() => { const blob = new Blob([JSON.stringify(report, null, 2)], { type: "application/json" }); const a = document.createElement("a"); a.href = URL.createObjectURL(blob); a.download = "sovereign-ux-report.json"; a.click(); }} style={{ marginTop: "0.8rem", padding: "0.4rem 0.9rem", background: navy, color: "white", border: "none", borderRadius: 3, fontFamily: "inherit", fontSize: "0.72rem", fontWeight: 600, cursor: "pointer" }} > Download JSON </button> </div> </div> )} {/* Telemetry methodology note */} {!report && ( <div style={{ background: "#edf2f8", borderLeft: `3px solid ${navy}`, padding: "0.8rem 1rem", fontSize: "0.73rem", color: "#1a2e45", borderRadius: "0 4px 4px 0", lineHeight: 1.7 }}> <strong>Telemetry methodology:</strong> The debugger compares the expected scroll distance from touch delta to the actual <code>scrollTop</code> change on the target element. The ratio of suppressed movement — the velocity tax — is sampled every {TELEMETRY_SAMPLE_INTERVAL_MS}ms. A consistent tax above {ANOMALY_VELOCITY_TAX_THRESH*100}% indicates an upstream process (WebView gesture recogniser, application frame, or injected overlay) is consuming touch events before they propagate to the DOM element. The debugger also tracks <code>event.defaultPrevented</code> and <code>event.cancelBubble</code> to distinguish between passive damping and active interception. </div> )} </div> )} {/* Footer */} <div style={{ marginTop: "1.5rem", paddingTop: "0.8rem", borderTop: "1px solid #d8d0c4", fontSize: "0.68rem", color: "#9b9490", lineHeight: 1.7 }}> Disclaimer: Software provided "AS IS". Albert Lane, Anthropic PBC, and Google LLC accept no liability for AI-generated content, data loss, or harm arising from use of this software. &nbsp;·&nbsp; SEC Whistleblower No. 17684-273-411-436 &nbsp;·&nbsp; security@albertlane.net </div> </div> </div> ); }