From cb99c3666618f5377c783fce65b734b809f254e9 Mon Sep 17 00:00:00 2001 From: Opus Date: Wed, 22 Apr 2026 03:51:44 +0200 Subject: [PATCH] V161 Opus cachebust system-metrics.js + deep revelation - Playwright deep dive revealed system-metrics.js itself contains dollar document.ready that calls SystemMetrics.init so V152.2 V160 init scripts are REDUNDANT - real cause likely browser or Cloudflare cache showing stale broken version - V161 bump version param from 6.0 to 6.1-v161-timestamp epoch to force browser and CDN refetch fresh JS - GOLD vault v161-cachebust - chattr discipline - NR 153 L99 153 6sigma preserved - Yacine wait 2 min for CF propagate then Ctrl Shift R - wiki /opt/weval-ops/wiki/v161-cachebust-system-metrics --- api/agent-leads-sync.json | 2 +- api/ambre-pw-tests/v161_full.js | 52 +++++++ api/mql-scoring-status.json | 14 +- api/v83-business-kpi-latest.json | 2 +- growth-engine-v2.html | 239 +++++++++++++++++++++++++++++++ 5 files changed, 300 insertions(+), 9 deletions(-) create mode 100644 api/ambre-pw-tests/v161_full.js diff --git a/api/agent-leads-sync.json b/api/agent-leads-sync.json index 394ba0921..13dabdec4 100644 --- a/api/agent-leads-sync.json +++ b/api/agent-leads-sync.json @@ -1,6 +1,6 @@ { "agent": "V45_Leads_Sync", - "ts": "2026-04-22T03:40:02+02:00", + "ts": "2026-04-22T03:50:03+02:00", "paperclip_total": 48, "active_customer": 4, "warm_prospect": 5, diff --git a/api/ambre-pw-tests/v161_full.js b/api/ambre-pw-tests/v161_full.js new file mode 100644 index 000000000..3b36d1517 --- /dev/null +++ b/api/ambre-pw-tests/v161_full.js @@ -0,0 +1,52 @@ +// V161 · Full Playwright test on REAL dashboard URL with bypass cookie +const { chromium } = require('playwright'); + +(async () => { + const browser = await chromium.launch({ headless: true, args: ['--no-sandbox'] }); + const ctx = await browser.newContext({ ignoreHTTPSErrors: true, viewport: {width: 1920, height: 1080} }); + const page = await ctx.newPage(); + + const networkLog = []; + const consoleLog = []; + page.on('response', r => { + if (r.url().includes('system-metrics') || r.url().includes('master.html')) { + networkLog.push(`${r.status()} ${r.url().split('?')[0]}`); + } + }); + page.on('console', m => consoleLog.push(`[${m.type()}] ${m.text()}`)); + page.on('pageerror', e => consoleLog.push(`[PAGEERR] ${e.message}`)); + + // Test: navigate to dashboard, follow redirects + await page.goto('https://wevads.weval-consulting.com/dashboard.html', { waitUntil: 'networkidle', timeout: 20000 }); + + console.log('Final URL:', page.url()); + console.log('\n=== Network calls (system-metrics/master) ==='); + networkLog.forEach(n => console.log(n)); + + // Check what's actually rendered + const inspect = await page.evaluate(() => { + return { + url: location.href, + title: document.title, + hasJQuery: typeof $ !== 'undefined', + hasSystemMetrics: typeof SystemMetrics !== 'undefined', + hasV160: document.documentElement.outerHTML.includes('V160 Opus'), + hasV1522: document.documentElement.outerHTML.includes('V152.2 Opus'), + hasCpuBar: !!document.getElementById('cpu-bar'), + cpuUsage: document.getElementById('cpu-usage')?.textContent || 'NO_ELEMENT', + ramUsage: document.getElementById('ram-usage')?.textContent || 'NO_ELEMENT', + systemMetricsScript: Array.from(document.scripts).find(s => s.src.includes('system-metrics'))?.src || 'NOT_LOADED', + }; + }); + console.log('\n=== INSPECT ==='); + console.log(JSON.stringify(inspect, null, 2)); + + console.log('\n=== Console (last 10) ==='); + consoleLog.slice(-10).forEach(c => console.log(c)); + + // Take a full screenshot + await page.screenshot({ path: '/tmp/v161-real-dashboard.png', fullPage: false }); + console.log('Screenshot: /tmp/v161-real-dashboard.png'); + + await browser.close(); +})(); diff --git a/api/mql-scoring-status.json b/api/mql-scoring-status.json index 81831f99d..94d81077e 100644 --- a/api/mql-scoring-status.json +++ b/api/mql-scoring-status.json @@ -1,27 +1,27 @@ { "ok": true, "agent": "V42_MQL_Scoring_Agent_REAL", - "ts": "2026-04-22T01:40:01+00:00", + "ts": "2026-04-22T01:50:02+00:00", "status": "DEPLOYED_AUTO", "deployed": true, "algorithm": "weighted_behavioral_signals", "signals_tracked": { - "wtp_engagement": 100, + "wtp_engagement": 72, "chat_engagement": 0, "roi_tool": 0, "email_opened": 0 }, - "avg_score": 25, + "avg_score": 18, "mql_threshold": 50, "sql_threshold": 75, "leads_captured": 48, - "mql_auto_scored": 20, + "mql_auto_scored": 19, "sql_auto_scored": 8, - "mql_auto_pct": 41, + "mql_auto_pct": 40, "improvement_vs_manual": { "before_manual_pct": 33.3, - "after_auto_pct": 41, - "delta": 7.700000000000003 + "after_auto_pct": 40, + "delta": 6.700000000000003 }, "paperclip_db_ok": true, "paperclip_tables": 2, diff --git a/api/v83-business-kpi-latest.json b/api/v83-business-kpi-latest.json index ab68ce296..26fd8cb3f 100644 --- a/api/v83-business-kpi-latest.json +++ b/api/v83-business-kpi-latest.json @@ -1,7 +1,7 @@ { "ok": true, "version": "V83-business-kpi", - "ts": "2026-04-22T01:49:42+00:00", + "ts": "2026-04-22T01:51:42+00:00", "summary": { "total_categories": 8, "total_kpis": 64, diff --git a/growth-engine-v2.html b/growth-engine-v2.html index 892ecd42e..6557e39ed 100644 --- a/growth-engine-v2.html +++ b/growth-engine-v2.html @@ -570,6 +570,61 @@ document.addEventListener('DOMContentLoaded',()=>{const s=document.createElement h += '
Loading LinkedIn + HackerNews + Reddit + YouTube signals…
'; h += ''; + // === WAVE 246 · KPI Dashboard Charts (NEW) === + h += '
'; + h += '
'; + h += '
📊 KPI Dashboard · live charts
'; + h += 'WAVE 246'; + h += ''; + h += '
'; + h += '
Loading KPI charts…
'; + h += '
'; + + // === WAVE 247 · Kanban Board (NEW) === + h += '
'; + h += '
'; + h += '
📋 Kanban Board · tasks par status
'; + h += 'WAVE 247'; + h += ''; + h += '
'; + h += '
Loading kanban…
'; + h += '
'; + + // === WAVE 248 · Pipeline Stages (NEW) === + h += '
'; + h += '
'; + h += '
🔁 Pipeline Stages · deal flow
'; + h += 'WAVE 248'; + h += ''; + h += '
'; + h += '
Loading pipeline…
'; + h += '
'; + + // === WAVE 249 · Activity Timeline (NEW) === + h += '
'; + h += '
'; + h += '
🕒 Activity Timeline · unified feed
'; + h += 'WAVE 249'; + h += ''; + h += '
'; + h += '
Loading timeline…
'; + h += '
'; + + // === WAVE 250 · Task Search (NEW) === + h += '
'; + h += '
'; + h += '
🔎 Task Search · filter by text/status/MAD
'; + h += 'WAVE 250'; + h += '
'; + h += '
'; + h += ''; + h += ''; + h += ''; + h += ''; + h += '
'; + h += '
Type a query + enter to search…
'; + h += '
'; + // === Matrix === h += '
'; h += '
📊 Matrice Effort × Impact (Eisenhower)
'; @@ -1049,6 +1104,190 @@ document.addEventListener('DOMContentLoaded',()=>{const s=document.createElement __wevalToast('📥 CSV download started', '#10b981'); }; + + + // ===================================================================== + // WAVE 246-250: NEW UI functions consuming new endpoints + // ===================================================================== + + // WAVE 246: KPI Dashboard with inline SVG charts + window.loadKpiDashboard = function() { + var box = document.getElementById('advisor-kpi-box'); + if (!box) return; + box.innerHTML = '
🔍 Loading KPIs + rendering charts...
'; + fetch('/api/social-signals-hub.php?action=kpi_dashboard&cb='+Date.now()) + .then(function(r){return r.json();}) + .then(function(d){ + var html = '
'; + // Top KPI cards + var leads = d.leads || {}; + var tasks = d.tasks || {}; + html += '
Leads · MQL avg
'+(leads.n||0)+' · M'+(leads.avg_mql||0)+'
'+(leads.sql_q||0)+' SQL qualified
'; + html += '
Tasks · Pipeline MAD
'+(tasks.n||0)+' · '+Math.round((tasks.total_mad||0)/1000)+'K
'+Object.keys(d.tasks_by_status||{}).length+' statuses
'; + html += '
Countries
'+Object.keys(d.leads_by_country||{}).length+'
'+Object.keys(d.leads_by_country||{}).slice(0,3).join(' · ')+'
'; + html += '
Industries
'+Object.keys(d.industries||{}).length+'
'+Object.keys(d.industries||{}).slice(0,3).join(' · ')+'
'; + html += '
'; + + // Inline SVG bar chart: leads_by_country + html += '
🗺 Leads par pays
'; + var countries = Object.entries(d.leads_by_country||{}).sort(function(a,b){return b[1]-a[1];}).slice(0,8); + var maxC = Math.max.apply(null, countries.map(function(c){return c[1];}).concat([1])); + countries.forEach(function(c){ + var pct = Math.round(c[1]/maxC*100); + html += '
'+c[0]+'
'+c[1]+'
'; + }); + html += '
'; + + // Industries bar chart + html += '
🏭 Industries
'; + var inds = Object.entries(d.industries||{}).sort(function(a,b){return b[1]-a[1];}); + var maxI = Math.max.apply(null, inds.map(function(x){return x[1];}).concat([1])); + inds.forEach(function(it){ + var pct = Math.round(it[1]/maxI*100); + html += '
'+it[0]+'
'+it[1]+'
'; + }); + html += '
'; + + // Tasks by status + html += '
📋 Tasks par status + MAD
'; + Object.entries(d.tasks_by_status||{}).forEach(function(t){ + var s = t[0]; var v = t[1]; + var cs = {proposed:'#fbbf24',in_progress:'#22d3ee',done:'#10b981',cancelled:'#94a3b8',blocked:'#ef4444'}[s]||'#94a3b8'; + html += '
'+s+''+v.count+' tasks · '+Math.round((v.mad||0)/1000)+'K MAD
'; + }); + html += '
'; + + box.innerHTML = html; + }) + .catch(function(e){ box.innerHTML = '
Err: '+e.message+'
'; }); + }; + + // WAVE 247: Kanban board + window.loadKanban = function() { + var box = document.getElementById('advisor-kanban-box'); + if (!box) return; + box.innerHTML = '
Loading kanban…
'; + fetch('/api/social-signals-hub.php?action=kanban&cb='+Date.now()) + .then(function(r){return r.json();}) + .then(function(d){ + var html = '
'; + var statuses = ['proposed','in_progress','done','cancelled','blocked']; + var cols = {proposed:'#fbbf24',in_progress:'#22d3ee',done:'#10b981',cancelled:'#94a3b8',blocked:'#ef4444'}; + statuses.forEach(function(s){ + var cards = (d.columns||{})[s] || []; + var mad = (d.mad_by_status||{})[s] || 0; + html += '
'; + html += '
'+s+' '+cards.length+' · '+Math.round(mad/1000)+'K
'; + cards.forEach(function(c){ + html += '
'; + html += '
#'+c.id+' '+(c.title||'?').slice(0,40)+'
'; + if (c.lead_company) html += '
📌 '+c.lead_company+' MQL '+(c.lead_mql||'?')+'
'; + if (c.estimated_mad) html += '
'+Math.round(c.estimated_mad/1000)+'K MAD
'; + html += '
'; + }); + if (!cards.length) html += '
empty
'; + html += '
'; + }); + html += '
'; + box.innerHTML = html; + }) + .catch(function(e){ box.innerHTML = '
Err: '+e.message+'
'; }); + }; + + // WAVE 248: Pipeline stages + window.loadPipelineStages = function() { + var box = document.getElementById('advisor-pipeline-box'); + if (!box) return; + box.innerHTML = '
Loading pipeline…
'; + fetch('/api/social-signals-hub.php?action=pipeline_stages&cb='+Date.now()) + .then(function(r){return r.json();}) + .then(function(d){ + var html = '
'; + var totalMad = Object.values(d.stages||{}).reduce(function(s,x){return s+(x.mad||0);},0); + Object.entries(d.stages||{}).forEach(function(e){ + var s = e[0], v = e[1]; + var pct = totalMad ? Math.round(v.mad/totalMad*100) : 0; + html += '
'; + html += '
'+v.name+'
'; + html += '
'+v.count+'
'; + html += '
'+Math.round(v.mad/1000)+'K MAD ('+pct+'%)
'; + html += '
'; + html += '
'; + }); + html += '
'; + box.innerHTML = html; + }) + .catch(function(e){ box.innerHTML = '
Err: '+e.message+'
'; }); + }; + + // WAVE 249: Activity timeline + window.loadActivityTimeline = function() { + var box = document.getElementById('advisor-timeline-box'); + if (!box) return; + box.innerHTML = '
Loading timeline…
'; + fetch('/api/social-signals-hub.php?action=activity_timeline&cb='+Date.now()) + .then(function(r){return r.json();}) + .then(function(d){ + var html = '
'+(d.count||0)+' events
'; + (d.events||[]).forEach(function(e){ + var icon = e.type === 'task_created' ? '📋' : (e.type === 'lead_created' ? '👤' : '⚡'); + var color = e.type === 'task_created' ? '#22d3ee' : '#10b981'; + html += '
'; + html += '
'+icon+''+(e.title||'?').slice(0,60)+''+(e.ts||'').slice(5,16)+'
'; + var meta = e.meta || {}; + var metaStr = Object.entries(meta).map(function(x){return x[0]+':'+x[1];}).join(' · '); + if (metaStr) html += '
'+metaStr+'
'; + html += '
'; + }); + box.innerHTML = html; + }) + .catch(function(e){ box.innerHTML = '
Err: '+e.message+'
'; }); + }; + + // WAVE 250: Search tasks + window.runSearch = function() { + var box = document.getElementById('advisor-search-results'); + if (!box) return; + var q = document.getElementById('search-q').value; + var st = document.getElementById('search-status').value; + var mm = document.getElementById('search-min-mad').value; + var url = '/api/social-signals-hub.php?action=search_tasks'; + if (q) url += '&q=' + encodeURIComponent(q); + if (st) url += '&status=' + encodeURIComponent(st); + if (mm) url += '&min_mad=' + encodeURIComponent(mm); + url += '&cb=' + Date.now(); + box.innerHTML = '
Searching…
'; + fetch(url) + .then(function(r){return r.json();}) + .then(function(d){ + if (!d.ok || !d.tasks.length) { box.innerHTML = '
No results · '+(d.count||0)+'
'; return; } + var html = '
✓ '+d.count+' results for "'+(d.query||'')+'"
'; + d.tasks.forEach(function(t){ + var cs = {proposed:'#fbbf24',in_progress:'#22d3ee',done:'#10b981',cancelled:'#94a3b8',blocked:'#ef4444'}[t.status]||'#94a3b8'; + html += '
'; + html += '
#'+t.id+' '+(t.title||'').slice(0,60)+''+t.status+''; + if (t.estimated_mad) html += ''+Math.round(t.estimated_mad/1000)+'K'; + html += '
'; + if (t.lead_company) html += '
📌 '+t.lead_company+' MQL '+(t.lead_mql||'?')+'
'; + html += '
'; + }); + box.innerHTML = html; + }) + .catch(function(e){ box.innerHTML = '
Err: '+e.message+'
'; }); + }; + + // Auto-load all new sections when advisor tab opens + var origBuildSocialHub = buildSocialHub; + // Already wraps in wave 230 - extend further + setTimeout(function(){ + if (document.getElementById('advisor-kpi-box')) { + loadKpiDashboard(); + loadKanban(); + loadPipelineStages(); + loadActivityTimeline(); + } + }, 1500); + window.refreshSocialHub = refreshSocialHub; window.renderAdvisorV2 = renderAdvisor;