auto-sync-opus46

This commit is contained in:
opus
2026-04-20 15:22:16 +02:00
parent d51ea1ddef
commit 08eccabef6
9 changed files with 188 additions and 14 deletions

92
api/accounting-api.php Normal file
View File

@@ -0,0 +1,92 @@
<?php
// WEVAL Accounting API — OPUS 20avr wire dormant accounting module
// Doctrine #2 ZERO simulation · #14 enrichissement · #4 honnêteté
// Expose P&L + invoices skeleton (stub avec data réelle si disponible)
header('Content-Type: application/json; charset=utf-8');
header('Cache-Control: no-store');
$action = $_GET['action'] ?? 'status';
$token = $_GET['token'] ?? '';
if ($token !== 'WEVADS2026' && !in_array($action, ['status','public'])) {
http_response_code(401);
die(json_encode(['error'=>'token required']));
}
try {
$db = @new PDO('pgsql:host=10.1.0.3;port=5432;dbname=adx_system', 'admin', 'admin123');
} catch (Exception $e) {
$db = null;
}
switch ($action) {
case 'status':
// Real P&L skeleton — data if tables exist, else honest empty
$out = [
'ok' => true,
'module' => 'accounting',
'status' => 'wired_stub',
'created_by' => 'opus_20avr_wire_dormants',
'note' => 'Module accounting wired — skeleton live. Fill tables accounting.pnl / accounting.invoices when ready.',
'tables_expected' => ['accounting.invoices', 'accounting.pnl_monthly', 'accounting.expenses', 'accounting.taxes'],
'ui_url' => '/accounting.html (to create)',
];
if ($db) {
$out['db_connected'] = true;
// Check if accounting schema exists
$r = $db->query("SELECT schema_name FROM information_schema.schemata WHERE schema_name='accounting'");
$out['schema_exists'] = (bool)$r->fetchColumn();
// CRM real data as proxy for revenue
try {
$r = $db->query("SELECT COUNT(*) FROM crm.deals WHERE status='won'");
$out['deals_won_count'] = (int)$r->fetchColumn();
$r = $db->query("SELECT COALESCE(SUM(value),0) FROM crm.deals WHERE status IN ('won','open')");
$out['pipeline_total_eur'] = (float)$r->fetchColumn();
} catch (Exception $e) { $out['crm_err'] = $e->getMessage(); }
} else {
$out['db_connected'] = false;
}
$out['ts'] = date('c');
echo json_encode($out, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
break;
case 'pnl':
// P&L skeleton (return zero-data structure if no tables, doctrine #4 honest)
$pnl = [
'period' => $_GET['period'] ?? 'current_month',
'revenue' => 0,
'costs' => 0,
'margin' => 0,
'status' => 'no_data',
'note' => 'Fill accounting.pnl_monthly to populate. Doctrine #4: returning zeros, not simulations.',
];
if ($db) {
try {
$r = $db->query("SELECT * FROM accounting.pnl_monthly ORDER BY month DESC LIMIT 1");
if ($r && $row = $r->fetch(PDO::FETCH_ASSOC)) {
$pnl = array_merge($pnl, $row);
$pnl['status'] = 'live';
}
} catch (Exception $e) { /* schema not yet created */ }
}
echo json_encode($pnl, JSON_UNESCAPED_UNICODE);
break;
case 'invoices':
$invoices = [];
if ($db) {
try {
$r = $db->query("SELECT id, client, amount, date, status FROM accounting.invoices ORDER BY date DESC LIMIT 20");
while ($row = $r->fetch(PDO::FETCH_ASSOC)) $invoices[] = $row;
} catch (Exception $e) { /* schema not yet */ }
}
echo json_encode(['invoices' => $invoices, 'count' => count($invoices), 'status' => $invoices ? 'live' : 'empty_schema_pending']);
break;
case 'public':
echo json_encode(['module' => 'accounting', 'status' => 'wired_public', 'endpoints' => ['/api/accounting-api.php?action=status&token=WEVADS2026']]);
break;
default:
echo json_encode(['error' => 'unknown action', 'actions' => ['status', 'pnl', 'invoices', 'public']]);
}

View File

@@ -1,6 +1,6 @@
{
"agent": "V45_Leads_Sync",
"ts": "2026-04-20T15:10:02+02:00",
"ts": "2026-04-20T15:20:02+02:00",
"paperclip_total": 48,
"active_customer": 4,
"warm_prospect": 5,

View File

@@ -1,7 +1,7 @@
{
"generated_at": "2026-04-20T15:15:01.511873",
"generated_at": "2026-04-20T15:20:01.934005",
"stats": {
"total": 27,
"total": 30,
"pending": 20,
"kaouther_surfaced": 18,
"chrome_surfaced": 2,

View File

@@ -0,0 +1,15 @@
{
"id": "task_20260420_132023_8417ee",
"type": "powershell",
"cmd": "Test-NetConnection -ComputerName 127.0.0.1 -Port 9222 -InformationLevel Quiet -WarningAction SilentlyContinue",
"label": "mcp_exec",
"priority": 200,
"status": "dispatched",
"created": "2026-04-20T13:20:23+00:00",
"started": null,
"completed": null,
"result": null,
"error": null,
"source": "api",
"dispatched_at": "2026-04-20T13:20:28+00:00"
}

View File

@@ -0,0 +1,15 @@
{
"id": "task_20260420_132046_ae2aac",
"type": "powershell",
"cmd": "Test-NetConnection -ComputerName 127.0.0.1 -Port 9222 -InformationLevel Quiet -WarningAction SilentlyContinue",
"label": "mcp_exec",
"priority": 200,
"status": "dispatched",
"created": "2026-04-20T13:20:46+00:00",
"started": null,
"completed": null,
"result": null,
"error": null,
"source": "api",
"dispatched_at": "2026-04-20T13:20:54+00:00"
}

View File

@@ -1,27 +1,27 @@
{
"ok": true,
"agent": "V42_MQL_Scoring_Agent_REAL",
"ts": "2026-04-20T13:10:01+00:00",
"ts": "2026-04-20T13:20:01+00:00",
"status": "DEPLOYED_AUTO",
"deployed": true,
"algorithm": "weighted_behavioral_signals",
"signals_tracked": {
"wtp_engagement": 18,
"wtp_engagement": 100,
"chat_engagement": 0,
"roi_tool": 0,
"email_opened": 0
},
"avg_score": 4.5,
"avg_score": 25,
"mql_threshold": 50,
"sql_threshold": 75,
"leads_captured": 48,
"mql_auto_scored": 17,
"sql_auto_scored": 7,
"mql_auto_pct": 36,
"mql_auto_scored": 20,
"sql_auto_scored": 8,
"mql_auto_pct": 41,
"improvement_vs_manual": {
"before_manual_pct": 33.3,
"after_auto_pct": 36,
"delta": 2.700000000000003
"after_auto_pct": 41,
"delta": 7.700000000000003
},
"paperclip_db_ok": true,
"paperclip_tables": 1,

View File

@@ -1,7 +1,7 @@
{
"ok": true,
"version": "V83-business-kpi",
"ts": "2026-04-20T13:19:05+00:00",
"ts": "2026-04-20T13:20:15+00:00",
"summary": {
"total_categories": 7,
"total_kpis": 56,

52
api/v93_audit_3pages.js Normal file
View File

@@ -0,0 +1,52 @@
const { chromium } = require('playwright');
const fs = require('fs');
(async () => {
const browser = await chromium.launch({ headless: true });
const ctx = await browser.newContext({ viewport: { width: 1920, height: 1080 } });
const page = await ctx.newPage();
await page.addInitScript(() => { try { localStorage.setItem('weval_internal','yacine-2026');}catch(e){}});
const results = [];
for (const target of [
{ name: 'agents-archi', url: 'https://weval-consulting.com/agents-archi.html' },
{ name: 'enterprise-model', url: 'https://weval-consulting.com/enterprise-model.html' },
{ name: 'wevia-em-big4', url: 'https://weval-consulting.com/wevia-em-big4.html' }
]) {
const errs = [];
page.on('pageerror', e => errs.push(e.message));
page.on('console', m => { if (m.type()==='error') errs.push('console: '+m.text().substring(0,100));});
try {
await page.goto(target.url, { waitUntil: 'load', timeout: 30000 });
await page.waitForTimeout(6000);
const diag = await page.evaluate(() => {
const r = {
title: document.title,
url: location.href,
body_len: document.body.innerText.length,
canvas: document.querySelectorAll('canvas').length,
svg: document.querySelectorAll('svg').length
};
// Access global vars used in these pages
try { r.AG_len = typeof AG !== 'undefined' ? AG.length : null; } catch(e){r.AG_err=e.message}
try { r.DP_len = typeof DP !== 'undefined' ? DP.length : null; } catch(e){r.DP_err=e.message}
// Count empty/anonymous patterns
const bodyHTML = document.body.innerHTML;
r.pattern_anon = (bodyHTML.match(/anonymous|anonyme|\"\"|unknown/gi) || []).length;
r.pattern_out = (bodyHTML.match(/\bout\b|\bvide\b|\bempty\b/gi) || []).length;
return r;
});
await page.screenshot({ path: `/tmp/v93-${target.name}.png`, fullPage: false });
results.push({ target: target.name, url: target.url, ...diag, js_errors: errs.slice(0, 5) });
} catch(e) {
results.push({ target: target.name, err: e.message.substring(0, 200) });
}
}
await browser.close();
fs.writeFileSync('/var/www/html/api/playwright-v93-3pages-audit.json', JSON.stringify(results, null, 2));
console.log(JSON.stringify(results, null, 2));
})();

View File

@@ -99,7 +99,7 @@ $modules = [
['id' => 'stripe_payments', 'label' => 'Stripe Payments (live)', 'desc' => 'sk_live + pk_live + acct', 'apis' => ['/api/stripe.php', '/api/stripe-webhook.php']],
['id' => 'billing_db', 'label' => 'PG schema billing', 'desc' => 'Schema dédié PG S204'],
['id' => 'gap_detector', 'label' => 'Gap Detector / AI Gap', 'desc' => 'Cron weval-ai-gap + weval-gap-detector', 'apis' => ['/api/gap-detector.json']],
['id' => 'accounting', 'label' => 'Comptabilité (dormant)', 'status' => 'dormant', 'desc' => 'P3: ERP gap-fill comptable à activer'],
['id' => 'accounting', 'label' => 'Comptabilité (wired stub)', 'status' => 'wired_stub', 'desc' => 'Module comptable stub wiré — fill accounting.* tables pour activer', 'apis' => ['/api/accounting-api.php']],
['id' => 'enterprise_complete_v73', 'label' => '🏢 Enterprise Complete V73', 'desc' => '20 depts + 169 KPIs + 12 gap agents Scrum/SAFe/DevOps + 9 innovations today + 8 macro processes R2R/O2C/P2P/H2R/M2L/D2D · avatars unifiés registry', 'pages' => ['enterprise-complete.html', 'enterprise-complete-v73.html'], 'apis' => ['/api/wevia-v70-enterprise-complete.php', '/api/wevia-v71-intelligence-growth.php', '/api/agent-avatars.json']],
['id' => 'v70_enterprise', 'label' => 'Enterprise Complete (V70)', 'desc' => '20 departements 169 KPIs 61 integrations universelles', 'pages' => ['enterprise-complete.html'], 'apis' => ['/api/wevia-v70-enterprise-complete.php']]
]
@@ -231,7 +231,7 @@ $modules = [
'tagline' => 'WhatsApp · SMS · Telegram · Mattermost · chat interne',
'submodules' => [
['id' => 'whatsapp', 'label' => 'WhatsApp Business (live)', 'desc' => 'token+phone+business_id configurés', 'apis' => ['/api/whatsapp-api.php']],
['id' => 'sms_ovh', 'label' => 'OVH SMS', 'apis' => ['/api/ovh-sms-setup.php'], 'status' => 'dormant'],
['id' => 'sms_ovh', 'label' => 'OVH SMS (ready, awaiting credentials)', 'apis' => ['/api/ovh-sms-setup.php'], 'status' => 'ready_pending_credentials', 'desc' => 'API fonctionnelle, POST app_key+app_secret+consumer_key pour activer'],
['id' => 'telegram_bot', 'label' => 'Telegram Bot @wevia_cyber_bot', 'desc' => 'chat_id=7605775322'],
['id' => 'mattermost', 'label' => 'Mattermost team chat', 'apis' => ['https://mm.weval-consulting.com/']],
['id' => 'wevia_meetings', 'label' => 'WEVIA Meetings', 'pages' => ['wevia-meetings.html', 'wevia-meeting-rooms.html']]