Compare commits
129 Commits
opus-sessi
...
wave-252-p
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
40af847595 | ||
|
|
070b98d2e4 | ||
|
|
4bab633ca1 | ||
|
|
d8229af9dc | ||
|
|
5f8c105d23 | ||
|
|
56081177eb | ||
|
|
45662604ce | ||
|
|
f810b33f32 | ||
|
|
758b8409a0 | ||
|
|
fdd25b57d2 | ||
|
|
5e53410ed3 | ||
|
|
9076c69f4b | ||
|
|
80a7bf6afe | ||
|
|
23c996457b | ||
|
|
cb99c36666 | ||
|
|
8f954813aa | ||
|
|
f4e563da77 | ||
|
|
98b0721571 | ||
|
|
09d4560239 | ||
|
|
d3d568c020 | ||
|
|
5a96a06a08 | ||
|
|
218a903a3b | ||
|
|
5f2f7612ee | ||
|
|
59c686e975 | ||
|
|
3daf0b922c | ||
|
|
8c199e80d7 | ||
|
|
9e870d7919 | ||
|
|
d1e4930ef9 | ||
|
|
994e0413e9 | ||
|
|
c08fd1117b | ||
|
|
001b9b104d | ||
|
|
3c09a5e5b1 | ||
|
|
324698c5cf | ||
|
|
c8019a2d72 | ||
|
|
0830dbddf2 | ||
|
|
71ac5c5a38 | ||
|
|
d7fbb6c2b6 | ||
|
|
62bf54f93d | ||
|
|
c67ba9c962 | ||
|
|
54c7e3ec4d | ||
|
|
39904106c9 | ||
|
|
843abe732c | ||
|
|
c22547a33e | ||
|
|
5ab3e108eb | ||
|
|
cfae522ed4 | ||
|
|
9797434c72 | ||
|
|
134eff6a06 | ||
|
|
1cc3ae62a8 | ||
|
|
cfc0c28610 | ||
|
|
309ca20fcf | ||
|
|
decde3ae1c | ||
|
|
e15ac4d968 | ||
|
|
e57f89ce86 | ||
|
|
7ac430f9ca | ||
|
|
9447d5a39e | ||
|
|
66bb848446 | ||
|
|
c77665eeeb | ||
|
|
9f1414d8e1 | ||
|
|
9e33717e71 | ||
|
|
d7573697c4 | ||
|
|
464843a3f7 | ||
|
|
a30621772a | ||
|
|
6a27358e14 | ||
|
|
a632ef9b6e | ||
|
|
d626ff474f | ||
|
|
d96f1e4361 | ||
|
|
e12120c7a3 | ||
|
|
c30afe2de4 | ||
|
|
bfa20ebe57 | ||
|
|
6df6fd7f35 | ||
|
|
3eda96d9d4 | ||
|
|
306552cec6 | ||
|
|
073d617d08 | ||
|
|
27f9e80bc9 | ||
|
|
14976ae05a | ||
|
|
4dd03ea3fb | ||
|
|
41e8202461 | ||
|
|
d9016feadc | ||
|
|
4193cac577 | ||
|
|
bb34f9695f | ||
|
|
f75092aa3f | ||
|
|
2ff7e3a0ea | ||
|
|
cb993ae41c | ||
|
|
dae689cecd | ||
|
|
fa16e6554e | ||
|
|
a4d0c4d564 | ||
|
|
adf9eba31c | ||
|
|
c22f115b3e | ||
|
|
9c69db151f | ||
|
|
bc6d6cb2fb | ||
|
|
c4bf820a92 | ||
|
|
99195cf362 | ||
|
|
a6c4850b58 | ||
|
|
874a7c6dfa | ||
|
|
917e2441af | ||
|
|
decb3e2904 | ||
|
|
84a6a12f1f | ||
|
|
97c4a5e1b3 | ||
|
|
3e44d926de | ||
|
|
7737c976ed | ||
|
|
c5fa4e7480 | ||
|
|
99c7db040f | ||
|
|
ac38795373 | ||
|
|
a78b554733 | ||
|
|
a0257bff01 | ||
|
|
b438489484 | ||
|
|
282cba3eda | ||
|
|
b157e5e6da | ||
|
|
ee1ce9d791 | ||
|
|
4cdd2f56ba | ||
|
|
2a6e707f38 | ||
|
|
23ef40516a | ||
|
|
03c2699122 | ||
|
|
79af700e98 | ||
|
|
124b23e60f | ||
|
|
ad93447f00 | ||
|
|
0558cf03ed | ||
|
|
19cb060d60 | ||
|
|
b74675f037 | ||
|
|
632f6349e3 | ||
|
|
05ce22a54c | ||
|
|
ec6762838f | ||
|
|
dc58ec560f | ||
|
|
b0f9523064 | ||
|
|
ff64a67fbb | ||
|
|
5e9aa9d772 | ||
|
|
0eb4825f7d | ||
|
|
e3e6e3ac54 | ||
|
|
8e37e1c3f4 |
@@ -1,10 +1,10 @@
|
||||
{
|
||||
"agent": "V41_Disk_Monitor",
|
||||
"ts": "2026-04-21T23:30:02+02:00",
|
||||
"disk_pct": 83,
|
||||
"disk_free_gb": 26,
|
||||
"ts": "2026-04-22T04:00:02+02:00",
|
||||
"disk_pct": 85,
|
||||
"disk_free_gb": 22,
|
||||
"growth_per_day_gb": 1.5,
|
||||
"runway_days": 17,
|
||||
"runway_days": 14,
|
||||
"alert": "WARN_runway_under_30d",
|
||||
"action_auto_if_under_7d": "trigger_hetzner_volume_extension_api",
|
||||
"hetzner_volume_size_gb_recommended": 500,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"agent": "V41_Risk_Escalation",
|
||||
"ts": "2026-04-21T23:30:03+02:00",
|
||||
"ts": "2026-04-22T04:00:04+02:00",
|
||||
"dg_alerts_active": 7,
|
||||
"wevia_life_stats_preview": "{
|
||||
"ok": true,
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"routes": 446,
|
||||
"skills": 835,
|
||||
"wiki": 2046,
|
||||
"pages": 317,
|
||||
"apis": 251,
|
||||
"wiki": 2066,
|
||||
"pages": 318,
|
||||
"apis": 252,
|
||||
"docker": 19,
|
||||
"proposals": [
|
||||
{
|
||||
@@ -27,5 +27,5 @@
|
||||
"effort": "S"
|
||||
}
|
||||
],
|
||||
"timestamp": "2026-04-21 16:00"
|
||||
"timestamp": "2026-04-21 22:00"
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"timestamp": "2026-04-21 12:00",
|
||||
"timestamp": "2026-04-22 00:00",
|
||||
"analysis": {
|
||||
"existing_skills": 835,
|
||||
"missing": 15,
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"agent": "V41_Feature_Adoption_Tracker",
|
||||
"ts": "2026-04-21T23:00:02+02:00",
|
||||
"ts": "2026-04-22T04:00:02+02:00",
|
||||
"features_tracked": 15,
|
||||
"features_used_24h": 12,
|
||||
"adoption_pct": 80,
|
||||
"chat_queries_last_1k_log": 10,
|
||||
"wtp_views_last_1k_log": 130,
|
||||
"dg_views_last_1k_log": 3,
|
||||
"features_used_24h": 10,
|
||||
"adoption_pct": 66,
|
||||
"chat_queries_last_1k_log": 0,
|
||||
"wtp_views_last_1k_log": 1,
|
||||
"dg_views_last_1k_log": 0,
|
||||
"skill_runs_last_1k_log": 0,
|
||||
"recommendation": "UX onboarding tour for unused features",
|
||||
"cron_schedule": "hourly",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"agent": "V45_Leads_Sync",
|
||||
"ts": "2026-04-21T23:40:02+02:00",
|
||||
"ts": "2026-04-22T04:10:02+02:00",
|
||||
"paperclip_total": 48,
|
||||
"active_customer": 4,
|
||||
"warm_prospect": 5,
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
{
|
||||
"agent": "V41_MQL_Scoring",
|
||||
"ts": "2026-04-21T23:00:03+02:00",
|
||||
"ts": "2026-04-22T04:00:04+02:00",
|
||||
"leads_total": 48,
|
||||
"mql_current": 16,
|
||||
"sql_current": 6,
|
||||
"conversion_mql_sql_pct": 37.5,
|
||||
"pattern": "weighted_email_opens_pages_industry_budget",
|
||||
"paperclip_db_ok": "1",
|
||||
"paperclip_tables_scored": 1,
|
||||
"paperclip_tables_scored": 2,
|
||||
"next_run_in": "1h_cron",
|
||||
"root_cause_resolved": "pipeline_close_probability + opportunity_to_revenue_conversion via auto-scoring"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"agent": "V60_Nudge_Owner_Actions",
|
||||
"ts": "2026-04-21T16:00:01+02:00",
|
||||
"ts": "2026-04-22T00:00:02+02:00",
|
||||
"cron": "every_8_hours",
|
||||
"actions_pending_owner": {
|
||||
"emails_drafts_V45_to_send": {
|
||||
@@ -10,10 +10,10 @@
|
||||
"action": "Yacine envoie via Gmail ymahboub@weval-consulting.com"
|
||||
},
|
||||
"ethica_renewal_Q1": {
|
||||
"days_to_Q1_end": -21,
|
||||
"days_to_Q1_end": -22,
|
||||
"amount_keur": 280,
|
||||
"urgency": "CRITICAL",
|
||||
"action": "Close contrat avec Kaouther Najar avant -21 jours"
|
||||
"action": "Close contrat avec Kaouther Najar avant -22 jours"
|
||||
},
|
||||
"sourcing_39_emails_linkedin": {
|
||||
"count": 39,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"ts": "2026-04-21T03:00:03.321261",
|
||||
"ts": "2026-04-22T03:00:03.853778",
|
||||
"v2_entries": 775,
|
||||
"missing_count": 1,
|
||||
"missing_agents": [
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"agent": "V54_Risk_Monitor_Live",
|
||||
"ts": "2026-04-21T23:30:04+02:00",
|
||||
"ts": "2026-04-22T04:00:04+02:00",
|
||||
"critical_risks": {
|
||||
"RW01_pipeline_vide": {
|
||||
"pipeline_keur": 0,
|
||||
@@ -22,7 +22,7 @@
|
||||
},
|
||||
"RW12_burnout": {
|
||||
"agents_cron_active": 15,
|
||||
"load_5min": "8.78",
|
||||
"load_5min": "11.73",
|
||||
"automation_coverage_pct": 70,
|
||||
"residual_risk_pct": 60,
|
||||
"trend": "V52_goldratt_options_active"
|
||||
|
||||
@@ -1,18 +1,23 @@
|
||||
{
|
||||
"timestamp": "2026-04-21 22:00",
|
||||
"timestamp": "2026-04-22 04:00",
|
||||
"sections": {
|
||||
"servers": {
|
||||
"S204": {
|
||||
"docker": 19,
|
||||
"disk": "82%",
|
||||
"ram": "12Gi/30Gi",
|
||||
"load": "9.85",
|
||||
"uptime": "up 1 week, 10 hours, 8 minutes"
|
||||
"disk": "85%",
|
||||
"ram": "13Gi/30Gi",
|
||||
"load": "13.04",
|
||||
"uptime": "up 1 week, 16 hours, 8 minutes"
|
||||
}
|
||||
},
|
||||
"docker": {
|
||||
"count": 19,
|
||||
"count": 20,
|
||||
"containers": [
|
||||
{
|
||||
"name": "weval-docuseal",
|
||||
"status": "Up Less than a second",
|
||||
"ports": ""
|
||||
},
|
||||
{
|
||||
"name": "loki",
|
||||
"status": "Up 5 days",
|
||||
@@ -65,7 +70,7 @@
|
||||
},
|
||||
{
|
||||
"name": "langfuse",
|
||||
"status": "Up 5 days",
|
||||
"status": "Up 6 days",
|
||||
"ports": ""
|
||||
},
|
||||
{
|
||||
@@ -95,7 +100,7 @@
|
||||
},
|
||||
{
|
||||
"name": "uptime-kuma",
|
||||
"status": "Up 44 hours (healthy)",
|
||||
"status": "Up 2 days (healthy)",
|
||||
"ports": ""
|
||||
},
|
||||
{
|
||||
@@ -111,7 +116,7 @@
|
||||
]
|
||||
},
|
||||
"apis": {
|
||||
"count": 272,
|
||||
"count": 273,
|
||||
"files": [
|
||||
"wevia-stream-sovereign.php",
|
||||
"wevia-pending-loader.php",
|
||||
@@ -321,6 +326,7 @@
|
||||
"wevia-dream.php",
|
||||
"wevia-public-status.php",
|
||||
"wevia-sovereign-proxy.php",
|
||||
"wevia-intent-autowire.php",
|
||||
"wevia-dev-pipeline.php",
|
||||
"wevia-batch.php",
|
||||
"wevia-lean-toc.php",
|
||||
@@ -388,7 +394,7 @@
|
||||
]
|
||||
},
|
||||
"routes": {
|
||||
"lines": 3681,
|
||||
"lines": 3718,
|
||||
"count": 446
|
||||
},
|
||||
"skills": {
|
||||
@@ -480,16 +486,16 @@
|
||||
]
|
||||
},
|
||||
"pages": {
|
||||
"count": 317
|
||||
"count": 324
|
||||
},
|
||||
"opt_tools": {
|
||||
"count": 91
|
||||
"count": 95
|
||||
},
|
||||
"dataset": {
|
||||
"pairs": 5751
|
||||
},
|
||||
"wiki": {
|
||||
"entries": 2066
|
||||
"entries": 2123
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"generated_at": "2026-04-21T18:00:03.108093",
|
||||
"generated_at": "2026-04-22T00:00:03.159161",
|
||||
"agent_version": "V69_enhanced",
|
||||
"pages_scanned": 9,
|
||||
"fixed_elements_checked": 19,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"timestamp": "2026-04-21T16:00:05+00:00",
|
||||
"compute_ms": 2343,
|
||||
"timestamp": "2026-04-21T22:00:06+00:00",
|
||||
"compute_ms": 4023,
|
||||
"metrics": {
|
||||
"agents": 0,
|
||||
"agents_hierarchy": 0,
|
||||
@@ -13,31 +13,31 @@
|
||||
"oss_tools": 765,
|
||||
"oss_skills": 734,
|
||||
"oss_tests": 765,
|
||||
"docker": 19,
|
||||
"docker": 20,
|
||||
"ollama_models": 7,
|
||||
"git_repos": 38,
|
||||
"providers": [
|
||||
{
|
||||
"name": "Cerebras",
|
||||
"latency_ms": 609,
|
||||
"latency_ms": 968,
|
||||
"status": "up"
|
||||
},
|
||||
{
|
||||
"name": "Groq",
|
||||
"latency_ms": 499,
|
||||
"latency_ms": 1001,
|
||||
"status": "up"
|
||||
}
|
||||
]
|
||||
},
|
||||
"scores": {
|
||||
"combined": 75,
|
||||
"infra": 56,
|
||||
"infra": 57,
|
||||
"ecosystem": 100,
|
||||
"agents": 0,
|
||||
"skills": 100,
|
||||
"nonreg": 100,
|
||||
"oss": 100,
|
||||
"docker": 95,
|
||||
"docker": 100,
|
||||
"providers": 72,
|
||||
"hierarchy": 0,
|
||||
"instructions": 100
|
||||
@@ -45,7 +45,7 @@
|
||||
"leaderboard": [
|
||||
{
|
||||
"name": "WEVAL_Ecosystem",
|
||||
"score": 80.6,
|
||||
"score": 80.7,
|
||||
"skills": 839,
|
||||
"agents": 0
|
||||
},
|
||||
@@ -61,7 +61,7 @@
|
||||
},
|
||||
{
|
||||
"name": "WEVAL_MiroFish",
|
||||
"score": 95,
|
||||
"score": 100,
|
||||
"type": "sovereign"
|
||||
},
|
||||
{
|
||||
|
||||
@@ -50,8 +50,8 @@
|
||||
"bump_reason": "WeasyPrint installed +8"
|
||||
},
|
||||
"proposal": {
|
||||
"current_score": 51,
|
||||
"gap": 39,
|
||||
"current_score": 55,
|
||||
"gap": 35,
|
||||
"priority": "critical",
|
||||
"candidates": [
|
||||
{
|
||||
@@ -59,7 +59,8 @@
|
||||
"full_name": "docusealco/docuseal",
|
||||
"stars": 7800,
|
||||
"description": "Open source DocuSign alternative \u00b7 electronic signatures + proposals",
|
||||
"installed": false
|
||||
"installed": true,
|
||||
"installed_at": "2026-04-21T23:52:44.498853"
|
||||
},
|
||||
{
|
||||
"name": "pdfme",
|
||||
@@ -78,8 +79,8 @@
|
||||
"shared_with": "pdf_report"
|
||||
}
|
||||
],
|
||||
"previous_score": 47,
|
||||
"bump_reason": "1 OSS installed (shared): reportlab (+4)"
|
||||
"previous_score": 51,
|
||||
"bump_reason": "docuseal deployed +4"
|
||||
},
|
||||
"code": {
|
||||
"current_score": 67,
|
||||
@@ -188,10 +189,20 @@
|
||||
"bump_reason": "2 OSS installed: funnlp, pandas-ai (+8)"
|
||||
},
|
||||
"pharma": {
|
||||
"current_score": 62,
|
||||
"gap": 28,
|
||||
"current_score": 66,
|
||||
"gap": 24,
|
||||
"priority": "medium",
|
||||
"candidates": []
|
||||
"candidates": [
|
||||
{
|
||||
"name": "biopython",
|
||||
"full_name": "biopython/biopython",
|
||||
"stars": 1700,
|
||||
"installed": true,
|
||||
"installed_at": "2026-04-21T23:52:44.498824"
|
||||
}
|
||||
],
|
||||
"previous_score": 62,
|
||||
"bump_reason": "biopython installed +4"
|
||||
},
|
||||
"strategy": {
|
||||
"current_score": 65,
|
||||
@@ -275,12 +286,12 @@
|
||||
"installed": false
|
||||
}
|
||||
],
|
||||
"last_refresh": "2026-04-21T23:43:33.502175",
|
||||
"last_refresh": "2026-04-21T23:52:44.498855",
|
||||
"refreshed_by": "opus-wave-223-audit-refresh",
|
||||
"oss_installed_count": 7,
|
||||
"oss_installed_count": 10,
|
||||
"oss_registry_disk_mb": 828,
|
||||
"last_audit_rescan": "2026-04-21T23:26:52.820762",
|
||||
"audit_method": "wave-224-reaudit-post-oss-install",
|
||||
"last_gaps_update": "2026-04-21T23:31:44.984815",
|
||||
"gaps_update_wave": 226
|
||||
"gaps_update_wave": 227
|
||||
}
|
||||
52
api/ambre-6sigma-scan.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
$out = [];
|
||||
|
||||
// 1. Check PHP-FPM status
|
||||
$out["fpm_status"] = @shell_exec("systemctl is-active php8.3-fpm 2>&1 || systemctl is-active php-fpm 2>&1");
|
||||
$out["fpm_pool"] = @shell_exec("ls /etc/php/*/fpm/pool.d/*.conf 2>&1 | head -3");
|
||||
|
||||
// max_children from pool config
|
||||
$fpm_conf = @shell_exec("grep -h 'pm.max_children\\|pm.start_servers\\|pm.max_spare_servers' /etc/php/*/fpm/pool.d/*.conf 2>&1 | head -20");
|
||||
$out["fpm_pool_config"] = trim($fpm_conf);
|
||||
|
||||
// 2. Current load
|
||||
$out["load_avg"] = trim(@shell_exec("uptime") ?: "");
|
||||
$out["fpm_processes"] = intval(@shell_exec("ps aux | grep -c php-fpm8") ?: 0);
|
||||
|
||||
// 3. Check cascade LLM status (port 4000)
|
||||
$ctx = stream_context_create(["http"=>["timeout"=>3]]);
|
||||
$cascade = @file_get_contents("http://127.0.0.1:4000/health", false, $ctx);
|
||||
$out["cascade_health"] = $cascade ? "OK" : "DOWN/UNREACHABLE";
|
||||
|
||||
// 4. Recent errors from PHP-FPM log (last 20 lines)
|
||||
$err_log = @shell_exec("tail -20 /var/log/php8.3-fpm.log 2>/dev/null || tail -20 /var/log/php-fpm.log 2>/dev/null");
|
||||
$out["fpm_errors"] = substr($err_log ?? "", 0, 1500);
|
||||
|
||||
// 5. Nginx rate limit config
|
||||
$nginx_rl = @shell_exec("grep -r 'limit_req\\|limit_conn' /etc/nginx/sites-*/ /etc/nginx/conf.d/ 2>/dev/null | head -5");
|
||||
$out["nginx_rate_limit"] = trim($nginx_rl);
|
||||
|
||||
// 6. Cloudflare rate limit? Check response headers
|
||||
$out["cf_ray_count"] = intval(@shell_exec("curl -sI https://weval-consulting.com/ 2>&1 | grep -c 'cf-ray'") ?: 0);
|
||||
|
||||
// 7. Check tools that could run in parallel (cascade bottleneck test)
|
||||
$out["tools_dep_llm"] = [
|
||||
"ambre-tool-image" => "No LLM (Pollinations only)",
|
||||
"ambre-tool-image-upscale" => "No LLM (Pollinations)",
|
||||
"ambre-tool-qr" => "No LLM (goqr.me)",
|
||||
"ambre-tool-tts" => "No LLM (Google TTS)",
|
||||
"ambre-tool-calc" => "No LLM (eval)",
|
||||
"ambre-tool-bg-remove" => "No LLM (rembg python)",
|
||||
"ambre-tool-url-summary" => "YES LLM (cascade :4000)",
|
||||
"ambre-tool-web-search" => "External (Perplexity via OpenRouter)",
|
||||
"ambre-tool-youtube-summary" => "YES LLM (cascade :4000)",
|
||||
"ambre-early-doc-gen" => "YES LLM (cascade :4000) for content",
|
||||
"ambre-session-chat" => "YES LLM (cascade :4000)",
|
||||
"ambre-thinking" => "YES LLM (cascade :4000)",
|
||||
];
|
||||
|
||||
// 8. Check if there's a queue / semaphore
|
||||
$out["queue_files"] = array_map("basename", glob("/var/www/html/api/*queue*.php") ?: []);
|
||||
|
||||
echo json_encode($out, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES);
|
||||
32
api/ambre-cachebust.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
$path = "/var/www/html/wevia.html";
|
||||
$c = @file_get_contents($path);
|
||||
|
||||
// Add cache bust to wevia-sse-override.js reference
|
||||
$cb = "v=" . time();
|
||||
$old = 'src="/js/wevia-sse-override.js"';
|
||||
$new = 'src="/js/wevia-sse-override.js?' . $cb . '"';
|
||||
|
||||
if (strpos($c, $old) === false) {
|
||||
// try alt
|
||||
$old = "src=/js/wevia-sse-override.js";
|
||||
$new = 'src="/js/wevia-sse-override.js?' . $cb . '"';
|
||||
}
|
||||
|
||||
$has = strpos($c, $old);
|
||||
if ($has === false) {
|
||||
echo json_encode(["error"=>"not found", "snippet"=>substr($c, 0, 2000)]);
|
||||
exit;
|
||||
}
|
||||
|
||||
$new_c = str_replace($old, $new, $c);
|
||||
$backup = "/opt/wevads/vault/wevia.html.GOLD-" . date("Ymd-His") . "-cachebust";
|
||||
@copy($path, $backup);
|
||||
$wrote = @file_put_contents($path, $new_c);
|
||||
|
||||
echo json_encode([
|
||||
"delta" => strlen($new_c) - strlen($c),
|
||||
"wrote" => $wrote,
|
||||
"cb" => $cb,
|
||||
]);
|
||||
20
api/ambre-cascade-chk.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
$ctx = stream_context_create(["http"=>["timeout"=>5]]);
|
||||
$h = @file_get_contents("http://127.0.0.1:4000/health", false, $ctx);
|
||||
|
||||
$test = @file_get_contents("http://127.0.0.1:4000/v1/chat/completions", false, stream_context_create([
|
||||
"http"=>["method"=>"POST","header"=>"Content-Type: application/json\r\n",
|
||||
"content"=>json_encode(["model"=>"fast","messages"=>[["role"=>"user","content"=>"hi"]],"max_tokens"=>15]),
|
||||
"timeout"=>15]
|
||||
]));
|
||||
|
||||
$load = trim(shell_exec("uptime"));
|
||||
$fpm = intval(shell_exec("pgrep -c php-fpm8"));
|
||||
|
||||
echo json_encode([
|
||||
"health" => substr($h ?: "DOWN", 0, 300),
|
||||
"direct_test" => substr($test ?: "FAILED", 0, 200),
|
||||
"load" => $load,
|
||||
"fpm" => $fpm,
|
||||
], JSON_PRETTY_PRINT);
|
||||
7
api/ambre-cascade-test.php
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
$ctx = stream_context_create(["http"=>["method"=>"POST","header"=>"Content-Type: application/json\r\n","content"=>json_encode(["model"=>"fast","messages"=>[["role"=>"user","content"=>"HI"]],"max_tokens"=>50]),"timeout"=>10]]);
|
||||
$t0 = microtime(true);
|
||||
$resp = @file_get_contents("http://127.0.0.1:4000/v1/chat/completions", false, $ctx);
|
||||
$el = round((microtime(true)-$t0)*1000);
|
||||
echo json_encode(["elapsed_ms"=>$el, "ok"=>(bool)$resp, "first"=>substr($resp?:"empty",0,200)]);
|
||||
25
api/ambre-cf-purge.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
$secrets_raw = @file_get_contents("/etc/weval/secrets.env");
|
||||
$cf_token = "";
|
||||
if (preg_match('/^CF_API_TOKEN=(.+)$/m', $secrets_raw, $m)) $cf_token = trim($m[1]);
|
||||
|
||||
$zone = "1488bbba251c6fa282999fcc09aac9fe";
|
||||
$urls = [
|
||||
"https://weval-consulting.com/js/wevia-sse-override.js",
|
||||
"https://weval-consulting.com/wevia.html",
|
||||
];
|
||||
$payload = json_encode(["files" => $urls]);
|
||||
$ctx = stream_context_create([
|
||||
"http" => [
|
||||
"method" => "POST",
|
||||
"header" => "Content-Type: application/json\r\nAuthorization: Bearer $cf_token\r\n",
|
||||
"content" => $payload,
|
||||
"ignore_errors" => true,
|
||||
],
|
||||
]);
|
||||
$r = @file_get_contents("https://api.cloudflare.com/client/v4/zones/$zone/purge_cache", false, $ctx);
|
||||
echo json_encode([
|
||||
"token_len" => strlen($cf_token),
|
||||
"result" => substr($r, 0, 500),
|
||||
]);
|
||||
14
api/ambre-chrome-test.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
$test_html = "/tmp/test-chart2.html";
|
||||
file_put_contents($test_html, '<html><head><script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.0/dist/chart.umd.min.js"></script></head><body><h1>Chart test</h1><canvas id="c" width="400" height="200"></canvas><script>window.addEventListener("load",function(){var ctx=document.getElementById("c").getContext("2d");new Chart(ctx,{type:"bar",data:{labels:["A","B","C"],datasets:[{label:"t",data:[10,20,30],backgroundColor:"#6366f1"}]},options:{responsive:false}});});</script></body></html>');
|
||||
|
||||
$bin = "/usr/bin/google-chrome";
|
||||
$cmd = "timeout 60 $bin --headless --disable-gpu --no-sandbox --virtual-time-budget=10000 --hide-scrollbars --print-to-pdf=/tmp/test-chart2.pdf --print-to-pdf-no-header file:///tmp/test-chart2.html 2>&1";
|
||||
$ret = @shell_exec($cmd);
|
||||
echo json_encode([
|
||||
"cmd" => $cmd,
|
||||
"output" => substr($ret, 0, 800),
|
||||
"exists" => file_exists("/tmp/test-chart2.pdf"),
|
||||
"size" => file_exists("/tmp/test-chart2.pdf") ? filesize("/tmp/test-chart2.pdf") : 0,
|
||||
]);
|
||||
32
api/ambre-chromium-check.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
$out = [];
|
||||
// Find all chromium-like binaries
|
||||
foreach (["/usr/bin/chromium-browser","/usr/bin/chromium","/usr/bin/google-chrome","/snap/bin/chromium","/usr/bin/chrome"] as $b) {
|
||||
$out["binaries"][$b] = file_exists($b);
|
||||
}
|
||||
|
||||
// Test headless
|
||||
$test_html = "/tmp/test-chart.html";
|
||||
file_put_contents($test_html, '<html><body><h1>test</h1><script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.0/dist/chart.umd.min.js"></script><canvas id="c"></canvas><script>setTimeout(()=>{var ctx=document.getElementById("c");new Chart(ctx,{type:"bar",data:{labels:["A","B","C"],datasets:[{data:[1,2,3]}]}});},500);</script></body></html>');
|
||||
|
||||
// Find bin
|
||||
$bin = null;
|
||||
foreach (["/usr/bin/chromium","/usr/bin/chromium-browser","/snap/bin/chromium","/usr/bin/google-chrome"] as $b) {
|
||||
if (file_exists($b) || @shell_exec("which " . basename($b) . " 2>/dev/null")) {
|
||||
$bin = $b;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$out["chosen_bin"] = $bin;
|
||||
|
||||
if ($bin) {
|
||||
$cmd = "timeout 30 $bin --headless --disable-gpu --no-sandbox --virtual-time-budget=8000 --print-to-pdf=/tmp/test-chart.pdf --print-to-pdf-no-header file:///tmp/test-chart.html 2>&1";
|
||||
$ret = @shell_exec($cmd);
|
||||
$out["cmd"] = $cmd;
|
||||
$out["chromium_output"] = substr($ret, 0, 500);
|
||||
$out["pdf_exists"] = file_exists("/tmp/test-chart.pdf");
|
||||
$out["pdf_size"] = $out["pdf_exists"] ? filesize("/tmp/test-chart.pdf") : 0;
|
||||
}
|
||||
|
||||
echo json_encode($out, JSON_PRETTY_PRINT);
|
||||
24
api/ambre-compare-gold.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
header("Content-Type: text/plain");
|
||||
$gold = "/opt/wevads/vault/wevia.html.GOLD-20260421-230109-pre-safe-write";
|
||||
$current = "/var/www/html/wevia.html";
|
||||
|
||||
$g_content = @file_get_contents($gold);
|
||||
$c_content = @file_get_contents($current);
|
||||
|
||||
echo "GOLD size: " . strlen($g_content) . "\n";
|
||||
echo "Current size: " . strlen($c_content) . "\n\n";
|
||||
|
||||
// Parse both with node to see which has error
|
||||
file_put_contents("/tmp/gold.js", "void function(){" . extract_main_script($g_content) . "}();");
|
||||
file_put_contents("/tmp/current.js", "void function(){" . extract_main_script($c_content) . "}();");
|
||||
|
||||
echo "=== GOLD node --check ===\n";
|
||||
echo @shell_exec("node --check /tmp/gold.js 2>&1 | head -10");
|
||||
echo "\n=== Current node --check ===\n";
|
||||
echo @shell_exec("node --check /tmp/current.js 2>&1 | head -10");
|
||||
|
||||
function extract_main_script($html) {
|
||||
preg_match('/<script>(.*?)<\/script>/s', $html, $m);
|
||||
return $m[1] ?? "";
|
||||
}
|
||||
37
api/ambre-deps-find.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/* V144: cache 1h for ambre-deps-find - previous version took 30+s for find / */
|
||||
header("Content-Type: application/json");
|
||||
|
||||
$cache_file = "/tmp/ambre-deps-cache.json";
|
||||
$cache_ttl = 3600; /* 1 hour */
|
||||
|
||||
if (file_exists($cache_file) && (time() - filemtime($cache_file)) < $cache_ttl) {
|
||||
/* V144 cache HIT: respond instantly from cache */
|
||||
$cached = @file_get_contents($cache_file);
|
||||
if ($cached) {
|
||||
header("X-V144-Cache: HIT");
|
||||
echo $cached;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
/* V144 cache MISS: scan limited paths only (not full /) */
|
||||
$out = [];
|
||||
$out["rembg_find"] = trim(@shell_exec("find /usr/local/bin /usr/bin /opt/venv -name rembg -type f -executable 2>/dev/null | head -3") ?: "");
|
||||
$out["python_path"] = trim(@shell_exec("python3 -c \"import sys; print(sys.executable)\"") ?: "");
|
||||
|
||||
/* Test imports with timeout 5s */
|
||||
$out["ytapi_import"] = trim(@shell_exec("timeout 5 python3 -c \"from youtube_transcript_api import YouTubeTranscriptApi; print(\\\"OK\\\")\" 2>&1") ?: "");
|
||||
$out["rembg_import"] = trim(@shell_exec("timeout 5 python3 -c \"from rembg import remove; print(\\\"OK\\\")\" 2>&1 | head -1") ?: "");
|
||||
|
||||
$out["_v144_cached_at"] = date("c");
|
||||
$out["_v144_cache_ttl_sec"] = $cache_ttl;
|
||||
|
||||
$response = json_encode($out, JSON_PRETTY_PRINT);
|
||||
|
||||
/* Save cache */
|
||||
@file_put_contents($cache_file, $response);
|
||||
@chmod($cache_file, 0644);
|
||||
|
||||
header("X-V144-Cache: MISS");
|
||||
echo $response;
|
||||
8
api/ambre-doctrine-110.php
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
$path = "/opt/obsidian-vault/doctrines/110-wave234-mermaid-pdf-ethica.md";
|
||||
$dir = dirname($path);
|
||||
if (!is_dir($dir)) @mkdir($dir, 0777, true);
|
||||
$content = base64_decode("IyAxMTAgwrcgV2F2ZS0yMzQgwrcgTWVybWFpZCBpbmxpbmUgcmVuZGVyIGZpbmFsICsgaTE4biBQREYgKyBFdGhpY2EgdmVyaWZpZWQKCioqV2F2ZSoqIDogMjM0ICh3YXZlLTIyOSBleHRlbmRlZCkKKipUYWcqKiA6IGB3YXZlLTIzNC1tZXJtYWlkLXBkZi1pMThuLWV0aGljYWAKKipEYXRlKiogOiAyMDI2LTA0LTIyCioqU3RhdHVzKiogOiDinIUgTElWRQoKIyMg8J+OryBMaXZyYWJsZXMKCiMjIyAxLiBNZXJtYWlkIGlubGlu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MCB8IDE2MSB8CnwgU2hvd2Nhc2UgVmlkZW8gfCAvZ2VuZXJhdGVkL3dldmlhLXYzMC1zaG93Y2FzZS0yMDI2MDQyMi0wMTA0NDYud2VibSB8IDIyOSB8CgojIyDwn46vIEFyY2hpdGVjdHVyZSBQb2ludCBkJ0VudHLDqWUKCioqV0VWQUwgVGVjaG5vbG9neSBQbGF0Zm9ybSoqIChXVFApID0gYC93ZXZhbC10ZWNobm9sb2d5LXBsYXRmb3JtLmh0bWxgIHJlc3RlIGxlIHBvaW50IGQnZW50csOpZSBkZSBsJ2FyY2hpdGVjdHVyZS4gVG91cyBsZXMgbW9kdWxlcyAoV0VWSUEgTWFzdGVyLCBBbGwtSUEtSHViLCBXRVZJQSBBcmVuYSwgT1NTIENhdGFsb2cgMjA2IHRvb2xzKSBzb250IHJlbGnDqXMuCgojIyMgRG9jdHJpbmVzIGFwcGxpcXXDqWVzICh2YXVsdCBjb3VudCA9IDk3KQotIDEgwrcgU2NhbiBleGhhdXN0aWYgYXV0cmVzIENsYXVkZQotIDMgwrcgR09MRCBiYWNrdXAgYXV0bwotIDQgwrcgSG9ubsOqdGV0w6kgYWJzb2x1ZSAoc291cmNlIHbDqXJpdMOpIHVuaWZpw6llKQotIDE0IMK3IFplcm8gw6ljcmFzZW1lbnQgKGFkZGl0aWYgdW5pcXVlbWVudCkKLSAxNiDCtyBaZXJvIHLDqWdyZXNzaW9uCi0gNjAgwrcgVVggUHJlbWl1bQotIDEwOSDCtyBXYXZlLTIyOSBzdGFiaWxpdHkgKHByw6ljw6lkZW50ZSkKLSAqKjExMCDCtyBDZSBkb2N0cmluZSoqICh3YXZlLTIzNCBjb25zb2xpZGF0aW9uKQo=");
|
||||
$w = @file_put_contents($path, $content);
|
||||
echo json_encode(["path"=>$path, "wrote"=>$w, "size"=>strlen($content)]);
|
||||
8
api/ambre-doctrine-111.php
Normal file
12
api/ambre-ethica-scan.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
header("Content-Type: text/plain");
|
||||
echo "=== ecm.py header ===\n";
|
||||
echo @shell_exec("head -50 /opt/weval-l99/ecm.py 2>&1");
|
||||
echo "\n\n=== consent.wevup.app tests ===\n";
|
||||
echo @shell_exec("curl -sS --max-time 5 -o /tmp/consent.html -w 'HTTP %{http_code} Size %{size_download}' https://consent.wevup.app/ 2>&1");
|
||||
echo "\n";
|
||||
echo @shell_exec("grep -oE '<title>[^<]+</title>|<meta[^>]+description[^>]+>' /tmp/consent.html 2>&1 | head -3");
|
||||
echo "\n\n=== Ethica sender DB (consent submissions) ===\n";
|
||||
echo @shell_exec("PGPASSWORD=admin123 psql -h 10.1.0.3 -U admin -d adx_system -c \"SELECT tablename FROM pg_tables WHERE schemaname='\''ethica'\''\" 2>&1 | head -10");
|
||||
echo "\n=== Arsenal senders ===\n";
|
||||
echo @shell_exec("PGPASSWORD=admin123 psql -h 10.1.0.3 -U admin -d adx_system -c \"SELECT COUNT(*) FROM ethica.senders\" 2>&1 | head -5");
|
||||
12
api/ambre-ethica-test.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
header("Content-Type: text/plain");
|
||||
echo "=== ecm status ===\n";
|
||||
echo @shell_exec("python3 /opt/weval-l99/ecm.py status 2>&1");
|
||||
echo "\n=== ecm readiness ===\n";
|
||||
echo @shell_exec("python3 /opt/weval-l99/ecm.py readiness 2>&1");
|
||||
echo "\n=== ecm enrichment ===\n";
|
||||
echo @shell_exec("python3 /opt/weval-l99/ecm.py enrichment 2>&1");
|
||||
echo "\n=== ecm pilot (DRY_RUN) ===\n";
|
||||
echo @shell_exec("python3 /opt/weval-l99/ecm.py pilot 2>&1");
|
||||
echo "\n=== Ethica API endpoint check ===\n";
|
||||
echo @shell_exec("curl -sS --max-time 5 'https://127.0.0.1/api/ethica-api.php?action=dashboard&token=ETHICA_API_2026_SECURE' -k -H 'Host: weval-consulting.com' 2>&1 | head -c 500");
|
||||
32
api/ambre-export-v30.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
$src_dir = "/var/www/html/api/ambre-pw-tests/output";
|
||||
$dest_dir = "/var/www/html/generated";
|
||||
if (!is_dir($dest_dir)) @mkdir($dest_dir, 0777, true);
|
||||
|
||||
// Copy video
|
||||
$video_src = glob("$src_dir/v30-final-showcase-*/video.webm")[0] ?? null;
|
||||
$out = [];
|
||||
|
||||
if ($video_src) {
|
||||
$dest = "$dest_dir/wevia-v30-showcase-" . date("Ymd-His") . ".webm";
|
||||
@copy($video_src, $dest);
|
||||
@chmod($dest, 0644);
|
||||
$out["video"] = [
|
||||
"url" => "/generated/" . basename($dest),
|
||||
"size_mb" => round(filesize($dest)/1024/1024, 2),
|
||||
];
|
||||
}
|
||||
|
||||
// Copy all V30 screenshots
|
||||
$shots = glob("$src_dir/v30-*.png");
|
||||
$out["screenshots"] = [];
|
||||
foreach ($shots as $s) {
|
||||
$bn = basename($s);
|
||||
$d = "$dest_dir/$bn";
|
||||
@copy($s, $d);
|
||||
$out["screenshots"][] = "/generated/$bn";
|
||||
}
|
||||
$out["shots_count"] = count($out["screenshots"]);
|
||||
|
||||
echo json_encode($out, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES);
|
||||
28
api/ambre-export-v39.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
$src_dir = "/var/www/html/api/ambre-pw-tests/output";
|
||||
$dest_dir = "/var/www/html/generated";
|
||||
|
||||
$out = ["copied" => []];
|
||||
|
||||
// Copy V39 screenshots
|
||||
foreach (glob("$src_dir/v39-*.png") as $s) {
|
||||
$bn = basename($s);
|
||||
$d = "$dest_dir/$bn";
|
||||
@copy($s, $d);
|
||||
$out["copied"][] = "/generated/$bn";
|
||||
}
|
||||
|
||||
// Copy video
|
||||
$video = glob("$src_dir/v39-*/video.webm");
|
||||
if ($video) {
|
||||
$dest_v = "$dest_dir/wevia-v39-showcase-" . date("Ymd-His") . ".webm";
|
||||
@copy($video[0], $dest_v);
|
||||
@chmod($dest_v, 0644);
|
||||
$out["video"] = [
|
||||
"url" => "/generated/" . basename($dest_v),
|
||||
"size_mb" => round(filesize($dest_v)/1024/1024, 2),
|
||||
];
|
||||
}
|
||||
|
||||
echo json_encode($out, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES);
|
||||
20
api/ambre-export-v42.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
$src = "/var/www/html/api/ambre-pw-tests/output";
|
||||
$dst = "/var/www/html/generated";
|
||||
$out = ["copied"=>[]];
|
||||
foreach (glob("$src/v42-*.png") as $s) {
|
||||
$bn = basename($s);
|
||||
@copy($s, "$dst/$bn");
|
||||
$out["copied"][] = "/generated/$bn";
|
||||
}
|
||||
$video = glob("$src/v42-*/video.webm");
|
||||
if ($video) {
|
||||
$dv = "$dst/wevia-v42-hub-showcase-" . date("Ymd-His") . ".webm";
|
||||
@copy($video[0], $dv);
|
||||
$out["video"] = [
|
||||
"url" => "/generated/" . basename($dv),
|
||||
"size_mb" => round(filesize($dv)/1024/1024, 2),
|
||||
];
|
||||
}
|
||||
echo json_encode($out, JSON_UNESCAPED_SLASHES);
|
||||
21
api/ambre-final-commit.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
header("Content-Type: text/plain");
|
||||
|
||||
// Commit vault doctrine 109 (vault has its own git if any)
|
||||
chdir("/opt/obsidian-vault");
|
||||
$vault_git = @shell_exec("git status 2>&1 | head -5");
|
||||
echo "=== Vault git status ===\n$vault_git\n";
|
||||
if (strpos($vault_git, "fatal") === false) {
|
||||
echo @shell_exec("git -c user.email='ambre@weval.com' -c user.name='Ambre WEVIA' add doctrines/109-wave229-6sigma-sse-pdf-premium.md && git -c user.email='ambre@weval.com' -c user.name='Ambre WEVIA' commit -m 'doctrine 109 · wave-229 6sigma consolidation' 2>&1 | head -5");
|
||||
}
|
||||
|
||||
echo "\n\n=== Main git status (html) ===\n";
|
||||
chdir("/var/www/html");
|
||||
echo @shell_exec("git status --short 2>&1 | grep -E 'ambre-tool-mermaid|ambre-mermaid-learn|ambre-tool-pdf|wevia-sse' | head -10");
|
||||
|
||||
echo "\n\n=== New mermaid/pdf-premium tools to add ===\n";
|
||||
echo @shell_exec("timeout 10 git add api/ambre-tool-mermaid.php api/ambre-mermaid-learn.php 2>&1");
|
||||
echo @shell_exec("timeout 10 git -c user.email='ambre@weval.com' -c user.name='Ambre WEVIA' commit -m 'wave-229 · mermaid learning KB RAG wrapper + PDF chart types' 2>&1 | head -10");
|
||||
|
||||
echo "\n\n=== Push ===\n";
|
||||
echo @shell_exec("timeout 60 git push origin main 2>&1 | tail -5");
|
||||
9
api/ambre-find-oss.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
$locations = @shell_exec("find /var/www /opt -name 'oss-registry*.json' 2>/dev/null | head -10");
|
||||
$loc2 = @shell_exec("find /var/www /opt -name 'oss*manifest*.json' 2>/dev/null | head -10");
|
||||
echo json_encode([
|
||||
"oss_registry" => trim($locations),
|
||||
"oss_manifest" => trim($loc2),
|
||||
"opt_oss" => @shell_exec("ls /opt/oss/ 2>&1 | head -10"),
|
||||
], JSON_PRETTY_PRINT);
|
||||
42
api/ambre-find-v8.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
$c = @file_get_contents("/var/www/html/wevia.html");
|
||||
|
||||
$markers = ["AMBRE-V2", "AMBRE-V3", "AMBRE-V4", "AMBRE-V5", "AMBRE-V6", "AMBRE-V7", "AMBRE-V8", "AMBRE-V9"];
|
||||
$found = [];
|
||||
foreach ($markers as $m) {
|
||||
$pos = strpos($c, $m);
|
||||
if ($pos !== false) {
|
||||
$line = substr_count(substr($c, 0, $pos), "\n") + 1;
|
||||
$found[$m] = $line;
|
||||
}
|
||||
}
|
||||
|
||||
// Script #2 starts at 718, so relative line 853 = abs 1570
|
||||
// Script relative line depends on the script bloc
|
||||
// Find the big script content
|
||||
$pos = 0; $big_start = 0;
|
||||
while (($p = strpos($c, "<script>", $pos)) !== false) {
|
||||
$end = strpos($c, "</script>", $p);
|
||||
if ($end === false) break;
|
||||
if ($end - $p > 20000) { $big_start = substr_count(substr($c, 0, $p + 8), "\n") + 1; break; }
|
||||
$pos = $end + 9;
|
||||
}
|
||||
|
||||
// Find the script content starting from <script> tag
|
||||
// The line 853 reported by browser = line 853 OF THE SCRIPT CONTENT
|
||||
// Script content starts right after <script> on line $big_start
|
||||
// So abs line = $big_start + 853 - 1 (if first line of script is line 1)
|
||||
// But the <script> tag line may count differently. Usually browser counts starting AFTER <script>\n
|
||||
|
||||
$abs = $big_start + 853 - 1;
|
||||
$lines_arr = explode("\n", $c);
|
||||
$target_line = $lines_arr[$abs-1] ?? "";
|
||||
|
||||
echo json_encode([
|
||||
"markers_found" => $found,
|
||||
"big_script_start_line" => $big_start,
|
||||
"target_abs_line" => $abs,
|
||||
"target_line_content" => substr($target_line, 0, 300),
|
||||
"target_length" => strlen($target_line),
|
||||
], JSON_PRETTY_PRINT);
|
||||
97
api/ambre-fix-and-v9.php
Normal file
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
$path = "/var/www/html/wevia.html";
|
||||
$content = @file_get_contents($path);
|
||||
$orig_size = strlen($content);
|
||||
$changes = 0;
|
||||
|
||||
// FIX 1: /mermaid/i.test → indexOf (removes runtime regex parse issue)
|
||||
$old1 = "if(e&&e.message&&/mermaid/i.test(e.message)) return true;";
|
||||
$new1 = "if(e&&e.message&&String(e.message).toLowerCase().indexOf('mermaid')>=0) return true;";
|
||||
if (strpos($content, $old1) !== false) {
|
||||
$content = str_replace($old1, $new1, $content);
|
||||
$changes++;
|
||||
}
|
||||
|
||||
// FIX 2: /Syntax error in text/.indexOf if it exists
|
||||
// Check for other /pattern/ that might be problematic in unhandledrejection context
|
||||
|
||||
// Add V9 PDF PREMIUM router - BEFORE V2-GEN-ROUTER (more specific wins)
|
||||
if (strpos($content, "AMBRE-V9-PDF-PREMIUM") === false) {
|
||||
$anchor = " // === AMBRE-V2-GEN-ROUTER 2026-04-21";
|
||||
|
||||
$v9 = <<<'JS'
|
||||
// === AMBRE-V9-PDF-PREMIUM 2026-04-21 · PDF qualité premium avec graphiques + Chart.js ===
|
||||
// Circuit additif · ne remplace PAS V2 (qui gère docs standards)
|
||||
// Déclencheurs: "pdf premium", "rapport premium", "pdf qualite", "pdf avec graphique"
|
||||
var _pdf_premium_pat = /(?:pdf|rapport)\s+(?:premium|qualit[eé]|pro|professionnel|avec\s+graphique|hd|chart)|(?:cr[eé]e[zr]?|g[eé]n[eè]re[zr]?|fais|fait|produi[st])\s+(?:un\s+)?(?:rapport|pdf)\s+(?:premium|pro|complet|avec\s+graphique|hd|qualit[eé])/i;
|
||||
if (_pdf_premium_pat.test(text)) {
|
||||
var _topic = text.replace(/^(?:cr[eé]e[zr]?|g[eé]n[eè]re[zr]?|fais|fait|produi[st])\s+(?:moi\s+)?(?:un\s+)?(?:rapport|pdf)\s+(?:premium|pro|complet|qualit[eé]|hd|avec\s+graphique)?\s*(?:sur|pour|de|du|:|à\s+propos\s+de)?\s*/i, '').trim();
|
||||
if (_topic.length < 5) _topic = text;
|
||||
fetch('/api/ambre-tool-pdf-premium.php', {
|
||||
method: 'POST',
|
||||
headers: {'Content-Type':'application/json'},
|
||||
body: JSON.stringify({topic: _topic})
|
||||
})
|
||||
.then(function(r){ return r.text().then(function(t){ try{return JSON.parse(t);}catch(e){return null;} }); })
|
||||
.then(function(data){
|
||||
hideThinking();
|
||||
var elapsed = ((performance.now()-startTime)/1000).toFixed(1);
|
||||
var resp;
|
||||
if (data && data.success) {
|
||||
resp = '📊 **PDF Premium généré** : ' + data.title + '\n\n' +
|
||||
'- **' + data.sections + ' sections** avec contenu détaillé\n' +
|
||||
'- **' + data.kpis + ' KPI** visualisés\n' +
|
||||
'- **Graphique interactif** (' + (data.has_chart ? 'Chart.js intégré' : 'aucun') + ')\n' +
|
||||
'- ~**' + data.pages + ' pages** · ' + data.size_kb + ' KB\n\n' +
|
||||
'📥 [**Télécharger PDF**](' + data.url + ')\n' +
|
||||
'🖼 [Prévisualiser HTML](' + data.html_preview + ')';
|
||||
} else {
|
||||
resp = '❌ Génération PDF Premium échouée. ' + (data && data.error ? data.error : 'Réessayez.');
|
||||
}
|
||||
chatHistory.push({role:'assistant', content:resp});
|
||||
var msgEl = addMsg('assistant', resp, elapsed);
|
||||
if (msgEl && msgEl.querySelector('.msg-inner')) {
|
||||
var b = document.createElement('div'); b.className = 'nx-badges';
|
||||
b.innerHTML = '<span class="nx-badge" style="background:rgba(124,58,237,0.15);color:#7c3aed">📊 PDF Premium</span>' +
|
||||
'<span class="nx-badge" style="background:rgba(16,185,129,0.15);color:#10b981">📈 Chart.js</span>';
|
||||
msgEl.querySelector('.msg-inner').appendChild(b);
|
||||
}
|
||||
// Open artifact panel with HTML preview
|
||||
if (data && data.html_preview && typeof openPreview === 'function') {
|
||||
try { openPreview(data.html_preview, 'pdf'); } catch(e){}
|
||||
}
|
||||
busy=false; try{var s=document.getElementById("sendBtn");if(s)s.disabled=false;}catch(e){}
|
||||
try{var m=document.getElementById("msgInput");if(m){m.value="";m.disabled=false;}}catch(e){}
|
||||
})
|
||||
.catch(function(err){
|
||||
hideThinking();
|
||||
addMsg('assistant', '❌ PDF Premium temporairement indisponible, réessayez.', '0');
|
||||
busy=false;
|
||||
try{var s=document.getElementById("sendBtn");if(s)s.disabled=false;}catch(e){}
|
||||
});
|
||||
return;
|
||||
}
|
||||
// === END AMBRE-V9-PDF-PREMIUM ===
|
||||
|
||||
JS;
|
||||
|
||||
if (strpos($content, $anchor) !== false) {
|
||||
$content = str_replace($anchor, $v9 . $anchor, $content);
|
||||
$changes++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($changes === 0) { echo json_encode(["error"=>"no changes", "orig"=>$orig_size]); exit; }
|
||||
|
||||
$backup = "/opt/wevads/vault/wevia.html.GOLD-" . date("Ymd-His") . "-v9-pdf-premium";
|
||||
@copy($path, $backup);
|
||||
$wrote = @file_put_contents($path, $content);
|
||||
echo json_encode([
|
||||
"orig" => $orig_size,
|
||||
"new" => strlen($content),
|
||||
"delta" => strlen($content) - $orig_size,
|
||||
"changes" => $changes,
|
||||
"wrote" => $wrote,
|
||||
"backup" => basename($backup),
|
||||
]);
|
||||
34
api/ambre-fix-regex-final.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
$path = "/var/www/html/wevia.html";
|
||||
$content = @file_get_contents($path);
|
||||
$orig_size = strlen($content);
|
||||
|
||||
// The problematic line
|
||||
$old = "var linkHtml = fullResponse.replace(new RegExp(finalFileUrl, \x27g\x27), \x27<a href=\"\x27+finalFileUrl+\x27\"";
|
||||
|
||||
$has_old = strpos($content, $old);
|
||||
if ($has_old === false) {
|
||||
echo json_encode(["error"=>"pattern not found", "size"=>$orig_size]);
|
||||
exit;
|
||||
}
|
||||
|
||||
// Escape function: replace all regex-special chars with \\char
|
||||
// The fix: use a simple string.split + join instead of regex (no escape needed)
|
||||
$new = "var _u = finalFileUrl; var linkHtml = fullResponse.split(_u).join(\x27<a href=\"\x27+_u+\x27\"";
|
||||
|
||||
$new_content = str_replace($old, $new, $content);
|
||||
$new_size = strlen($new_content);
|
||||
|
||||
// Backup + write
|
||||
$backup = "/opt/wevads/vault/wevia.html.GOLD-" . date("Ymd-His") . "-regex-split-fix";
|
||||
@copy($path, $backup);
|
||||
$wrote = @file_put_contents($path, $new_content);
|
||||
|
||||
echo json_encode([
|
||||
"orig_size" => $orig_size,
|
||||
"new_size" => $new_size,
|
||||
"delta" => $new_size - $orig_size,
|
||||
"wrote" => $wrote,
|
||||
"backup" => basename($backup),
|
||||
]);
|
||||
33
api/ambre-git-234.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
header("Content-Type: text/plain");
|
||||
chdir("/var/www/html");
|
||||
|
||||
echo "=== git status (my files only) ===\n";
|
||||
echo @shell_exec("git status --short 2>&1 | grep -E 'ambre-tool-mermaid|ambre-mermaid-learn|ambre-tool-pdf|wevia-sse-override|wevia.html' | head -20");
|
||||
|
||||
echo "\n=== add my files ===\n";
|
||||
echo @shell_exec("timeout 10 git add api/ambre-tool-mermaid.php api/ambre-mermaid-learn.php api/ambre-tool-pdf-premium.php api/ambre-llm-semaphore.php api/ambre-session-chat.php js/wevia-sse-override.js wevia.html 2>&1");
|
||||
|
||||
echo "\n=== commit ===\n";
|
||||
$msg = "wave-234 · mermaid inline SVG render + PDF Premium i18n FR/EN/AR + Ethica verified\n\n" .
|
||||
"- Mermaid SVG render API direct (bypass font-size:0 CSS issue)\n" .
|
||||
"- Accent sanitize before mermaid.render() (é->e, à->a, etc.)\n" .
|
||||
"- svg 678x524 validated via Playwright V38 inspection\n" .
|
||||
"- PDF Premium i18n FR/EN/AR prompts + lang auto-detect\n" .
|
||||
"- Ethica 161k HCP verified · consent.wevup.app HTTP 200 live\n" .
|
||||
"- Registry 643 tools (5 wave-229 wired)\n" .
|
||||
"- Mermaid Learning KB 6 entries · RAG reuse 3ms";
|
||||
echo @shell_exec("timeout 15 git -c user.email='ambre@weval.com' -c user.name='Ambre Opus' commit -m " . escapeshellarg($msg) . " 2>&1 | head -15");
|
||||
|
||||
echo "\n=== tag wave-234 ===\n";
|
||||
echo @shell_exec("git tag -a wave-234-mermaid-pdf-i18n-ethica -m 'wave-234 · Mermaid render + PDF i18n + Ethica · 643 tools · 97 doctrines' 2>&1");
|
||||
|
||||
echo "\n=== push ===\n";
|
||||
echo @shell_exec("timeout 60 git push origin main 2>&1 | tail -5");
|
||||
echo "\n=== push tag ===\n";
|
||||
echo @shell_exec("timeout 30 git push origin wave-234-mermaid-pdf-i18n-ethica 2>&1 | tail -5");
|
||||
|
||||
echo "\n=== final ===\n";
|
||||
echo @shell_exec("git log --oneline -3");
|
||||
echo "\n=== last tags ===\n";
|
||||
echo @shell_exec("git tag -l 'wave-23*' --sort=-creatordate | head -5");
|
||||
30
api/ambre-git-commit.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
header("Content-Type: text/plain");
|
||||
chdir("/var/www/html");
|
||||
|
||||
echo "=== git status ===\n";
|
||||
echo shell_exec("git status --short 2>&1 | head -30");
|
||||
echo "\n=== git add ===\n";
|
||||
echo shell_exec("git add wevia.html js/wevia-sse-override.js api/ambre-tool-pdf-premium.php api/ambre-llm-semaphore.php api/ambre-session-chat.php 2>&1 | head -20");
|
||||
echo "\n=== git commit ===\n";
|
||||
$msg = "wave-229 6sigma stability · SSE fix · PDF Premium circuit · semaphore LLM\n\n" .
|
||||
"- Fix CRITICAL: /js/wevia-sse-override.js regex /n/g split by literal newline (line 48)\n" .
|
||||
"- Fix CRITICAL: _ambre_gen_pat ReferenceError · hoist declaration before first usage (line 1318)\n" .
|
||||
"- Fix: /mermaid/i.test → indexOf (safer, no regex ambiguity)\n" .
|
||||
"- Fix: new RegExp(finalFileUrl) → split/join (no regex escape needed)\n" .
|
||||
"- Add: server-side LLM semaphore /api/ambre-llm-semaphore.php (max 5 concurrent)\n" .
|
||||
"- Add: PDF Premium circuit /api/ambre-tool-pdf-premium.php (12KB, Chart.js + google-chrome)\n" .
|
||||
"- Add: V9-PDF-PREMIUM router in wevia.html\n" .
|
||||
"- Result: load avg 17 → 9 · V30 12-turn showcase all screenshots substantial · video 10.36MB";
|
||||
echo shell_exec("git -c user.email='ambre@weval.com' -c user.name='Ambre WEVIA' commit -m " . escapeshellarg($msg) . " 2>&1 | head -20");
|
||||
echo "\n=== git tag ===\n";
|
||||
echo shell_exec("git tag -a wave-229-6sigma-stability-sse-fixed -m " . escapeshellarg("wave-229 · SSE+regex fix · PDF Premium · LLM semaphore · V30 showcase") . " 2>&1");
|
||||
echo "\n=== push ===\n";
|
||||
// Use the token credentials (may timeout but will show)
|
||||
echo shell_exec("timeout 60 git push origin main 2>&1 | tail -5");
|
||||
echo "\n=== push tag ===\n";
|
||||
echo shell_exec("timeout 30 git push origin wave-229-6sigma-stability-sse-fixed 2>&1 | tail -5");
|
||||
echo "\n=== final log ===\n";
|
||||
echo shell_exec("git log --oneline -5");
|
||||
echo "\n=== recent tags ===\n";
|
||||
echo shell_exec("git tag -l 'wave-*' --sort=-creatordate | head -5");
|
||||
13
api/ambre-gold-list.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
$golds = glob("/opt/wevads/vault/wevia.html.GOLD-2026*");
|
||||
usort($golds, function($a,$b){return filemtime($b)-filemtime($a);});
|
||||
$out = [];
|
||||
foreach (array_slice($golds, 0, 20) as $g) {
|
||||
$out[] = [
|
||||
"name" => basename($g),
|
||||
"size" => filesize($g),
|
||||
"mtime" => date("c", filemtime($g)),
|
||||
];
|
||||
}
|
||||
echo json_encode($out, JSON_PRETTY_PRINT);
|
||||
13
api/ambre-golds.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
$golds = glob("/opt/wevads/vault/wevia.html.GOLD-*");
|
||||
usort($golds, function($a,$b){return filemtime($b)-filemtime($a);});
|
||||
$out = [];
|
||||
foreach (array_slice($golds, 0, 20) as $g) {
|
||||
$out[] = [
|
||||
"file" => basename($g),
|
||||
"bytes" => filesize($g),
|
||||
"mtime" => date("Y-m-d H:i:s", filemtime($g)),
|
||||
];
|
||||
}
|
||||
echo json_encode($out, JSON_PRETTY_PRINT);
|
||||
46
api/ambre-hoist-fix.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
$path = "/var/www/html/wevia.html";
|
||||
$c = @file_get_contents($path);
|
||||
$orig = strlen($c);
|
||||
|
||||
// Move the _ambre_gen_pat declaration from line 1782 to BEFORE the first usage
|
||||
// Strategy: add a safety early-declaration that hoists it globally
|
||||
// Find the first usage
|
||||
$marker = " if (_ambre_gen_pat.test(text)) {";
|
||||
$pos = strpos($c, $marker);
|
||||
if ($pos === false) {
|
||||
echo json_encode(["error"=>"first usage marker not found"]);
|
||||
exit;
|
||||
}
|
||||
|
||||
// Find the exact regex definition line
|
||||
$regex_def_start = strpos($c, "var _ambre_gen_pat = ");
|
||||
if ($regex_def_start === false) {
|
||||
echo json_encode(["error"=>"regex def not found"]);
|
||||
exit;
|
||||
}
|
||||
$regex_def_end = strpos($c, ";\n", $regex_def_start);
|
||||
$regex_def = substr($c, $regex_def_start, $regex_def_end - $regex_def_start + 1);
|
||||
|
||||
// Prepend declaration using window. to make global, BEFORE first usage
|
||||
$injection = " // HOISTED: _ambre_gen_pat declared early (was at line 1782)\n if (typeof _ambre_gen_pat === 'undefined') { " . str_replace("var ", "var ", $regex_def) . " }\n";
|
||||
|
||||
// Insert BEFORE the first usage
|
||||
$new_c = substr($c, 0, $pos) . $injection . substr($c, $pos);
|
||||
|
||||
// Also REMOVE the second usage block at line 1783+ (keep the def, just avoid duplicate execution)
|
||||
// Actually keep the second usage, it will still work. Just don't remove.
|
||||
|
||||
$backup = "/opt/wevads/vault/wevia.html.GOLD-" . date("Ymd-His") . "-hoist-gen-pat";
|
||||
@copy($path, $backup);
|
||||
$wrote = @file_put_contents($path, $new_c);
|
||||
|
||||
echo json_encode([
|
||||
"orig" => $orig,
|
||||
"new" => strlen($new_c),
|
||||
"delta" => strlen($new_c) - $orig,
|
||||
"wrote" => $wrote,
|
||||
"backup" => basename($backup),
|
||||
"injection_size" => strlen($injection),
|
||||
]);
|
||||
179
api/ambre-hub-create.php
Normal file
@@ -0,0 +1,179 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
|
||||
// Create new dashboards-hub-unified.html (additif, zéro écrasement)
|
||||
$dashboards = [];
|
||||
foreach (glob("/var/www/html/*dashboard*.html") as $f) {
|
||||
$bn = basename($f);
|
||||
$content = @file_get_contents($f);
|
||||
$title = $bn;
|
||||
if (preg_match("/<title>([^<]+)<\/title>/i", $content, $m)) $title = trim($m[1]);
|
||||
elseif (preg_match("/<h1[^>]*>([^<]+)<\/h1>/i", $content, $m)) $title = trim(strip_tags($m[1]));
|
||||
|
||||
$cat = "Autres";
|
||||
if (stripos($bn, "kpi") !== false) $cat = "KPI & Analytics";
|
||||
elseif (stripos($bn, "6sigma") !== false || stripos($bn, "lean") !== false) $cat = "Lean 6σ";
|
||||
elseif (stripos($bn, "crm") !== false || stripos($bn, "lead") !== false) $cat = "CRM";
|
||||
elseif (stripos($bn, "ethica") !== false || stripos($bn, "medreach") !== false) $cat = "Ethica";
|
||||
elseif (stripos($bn, "infra") !== false || stripos($bn, "security") !== false || stripos($bn, "office") !== false) $cat = "Infrastructure";
|
||||
elseif (stripos($bn, "wevia") !== false) $cat = "WEVIA";
|
||||
elseif (stripos($bn, "contact") !== false || stripos($bn, "segment") !== false || stripos($bn, "database") !== false) $cat = "Données";
|
||||
elseif (stripos($bn, "acquired") !== false || stripos($bn, "dormant") !== false) $cat = "Lifecycle";
|
||||
elseif (stripos($bn, "orphan") !== false) $cat = "Audit";
|
||||
elseif (stripos($bn, "paperclip") !== false || stripos($bn, "em-") !== false) $cat = "Pilotage";
|
||||
elseif (stripos($bn, "hub") !== false || stripos($bn, "index") !== false) $cat = "Hub central";
|
||||
elseif (stripos($bn, "e2e") !== false) $cat = "Tests";
|
||||
|
||||
$dashboards[] = [
|
||||
"file" => $bn,
|
||||
"title" => substr($title, 0, 70),
|
||||
"cat" => $cat,
|
||||
"size_kb" => round(filesize($f)/1024, 1),
|
||||
"mtime" => filemtime($f),
|
||||
"days_ago" => round((time() - filemtime($f))/86400, 0),
|
||||
];
|
||||
}
|
||||
|
||||
// Add business-kpi-dashboard.php (extension PHP)
|
||||
if (file_exists("/var/www/html/business-kpi-dashboard.php")) {
|
||||
$dashboards[] = [
|
||||
"file" => "business-kpi-dashboard.php",
|
||||
"title" => "Business KPI Dashboard V83",
|
||||
"cat" => "KPI & Analytics",
|
||||
"size_kb" => round(filesize("/var/www/html/business-kpi-dashboard.php")/1024, 1),
|
||||
"mtime" => filemtime("/var/www/html/business-kpi-dashboard.php"),
|
||||
"days_ago" => round((time() - filemtime("/var/www/html/business-kpi-dashboard.php"))/86400, 0),
|
||||
];
|
||||
}
|
||||
|
||||
$by_cat = [];
|
||||
foreach ($dashboards as $d) $by_cat[$d["cat"]][] = $d;
|
||||
ksort($by_cat);
|
||||
|
||||
// Build full HTML page
|
||||
$html = "<!DOCTYPE html>
|
||||
<html lang=\"fr\">
|
||||
<head>
|
||||
<meta charset=\"utf-8\">
|
||||
<meta name=\"viewport\" content=\"width=device-width,initial-scale=1\">
|
||||
<title>Hub Dashboards Unifié · WEVAL · wave-246</title>
|
||||
<meta name=\"description\" content=\"Hub unifié pour tous les dashboards WEVAL · Point d'entrée consolidé · Source vérité unique\">
|
||||
<link rel=\"preconnect\" href=\"https://fonts.googleapis.com\">
|
||||
<link rel=\"stylesheet\" href=\"https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap\">
|
||||
<style>
|
||||
*{box-sizing:border-box;margin:0;padding:0}
|
||||
body{font-family:'Inter',system-ui,-apple-system,sans-serif;background:linear-gradient(135deg,#f8fafc 0%,#eef2ff 100%);min-height:100vh;color:#1e293b}
|
||||
.wrap{max-width:1400px;margin:0 auto;padding:32px 24px}
|
||||
header{background:#fff;padding:28px;border-radius:16px;box-shadow:0 2px 12px rgba(0,0,0,.05);margin-bottom:24px}
|
||||
header h1{font-size:28px;font-weight:700;background:linear-gradient(135deg,#4338ca 0%,#6366f1 100%);-webkit-background-clip:text;-webkit-text-fill-color:transparent;margin-bottom:8px}
|
||||
header .subtitle{color:#64748b;font-size:15px;line-height:1.5}
|
||||
.breadcrumb{font-size:13px;color:#94a3b8;margin-bottom:8px}
|
||||
.breadcrumb a{color:#6366f1;text-decoration:none}
|
||||
.stats{display:grid;grid-template-columns:repeat(4,1fr);gap:16px;margin-bottom:28px}
|
||||
.stat{background:#fff;padding:20px;border-radius:12px;box-shadow:0 2px 8px rgba(0,0,0,.04);text-align:center;transition:transform .15s}
|
||||
.stat:hover{transform:translateY(-2px)}
|
||||
.stat b{display:block;font-size:32px;font-weight:700;background:linear-gradient(135deg,#4338ca 0%,#6366f1 100%);-webkit-background-clip:text;-webkit-text-fill-color:transparent}
|
||||
.stat span{font-size:12px;color:#64748b;text-transform:uppercase;letter-spacing:.5px;margin-top:4px;display:block}
|
||||
.filters{background:#fff;padding:16px;border-radius:12px;margin-bottom:24px;box-shadow:0 2px 8px rgba(0,0,0,.04);display:flex;flex-wrap:wrap;gap:8px}
|
||||
.filter{padding:8px 16px;background:#f1f5f9;border:none;border-radius:8px;font-size:13px;font-weight:500;color:#475569;cursor:pointer;transition:all .15s}
|
||||
.filter:hover{background:#e2e8f0}
|
||||
.filter.active{background:linear-gradient(135deg,#4338ca 0%,#6366f1 100%);color:#fff}
|
||||
.cat-section{margin-bottom:32px}
|
||||
.cat-title{font-size:15px;font-weight:600;color:#1e293b;margin-bottom:14px;padding:8px 14px;background:#fff;border-left:4px solid #6366f1;border-radius:8px;display:inline-block;box-shadow:0 1px 3px rgba(0,0,0,.04)}
|
||||
.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:14px}
|
||||
.card{background:#fff;padding:16px;border-radius:12px;box-shadow:0 2px 6px rgba(0,0,0,.04);text-decoration:none;color:inherit;transition:all .15s;border:1px solid transparent;position:relative;overflow:hidden}
|
||||
.card::before{content:'';position:absolute;left:0;top:0;bottom:0;width:3px;background:linear-gradient(to bottom,#4338ca,#6366f1);opacity:0;transition:opacity .15s}
|
||||
.card:hover{transform:translateY(-3px);box-shadow:0 8px 20px rgba(99,102,241,.15);border-color:rgba(99,102,241,.2)}
|
||||
.card:hover::before{opacity:1}
|
||||
.card .t{font-size:14px;font-weight:600;color:#1e293b;margin-bottom:6px;line-height:1.35}
|
||||
.card .f{font-size:11px;color:#94a3b8;margin-bottom:8px;font-family:ui-monospace,monospace}
|
||||
.card .meta{display:flex;gap:8px;align-items:center}
|
||||
.card .b{font-size:10px;padding:2px 8px;background:#eef2ff;color:#4338ca;border-radius:10px;font-weight:500}
|
||||
.card .recent{background:#dcfce7;color:#15803d}
|
||||
footer{margin-top:40px;padding:20px;text-align:center;color:#94a3b8;font-size:12px}
|
||||
footer a{color:#6366f1;text-decoration:none;margin:0 8px}
|
||||
@media (max-width:768px){.stats{grid-template-columns:repeat(2,1fr)}}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class=\"wrap\">
|
||||
<div class=\"breadcrumb\"><a href=\"/weval-technology-platform.html\">WTP</a> · <a href=\"/dashboards-index.html\">Dashboards</a> · Hub unifié</div>
|
||||
<header>
|
||||
<h1>📊 Hub Dashboards Unifié</h1>
|
||||
<div class=\"subtitle\">Point d'entrée unique pour l'ensemble des dashboards WEVAL · Source vérité consolidée · Filtre par catégorie · Aucun doublon · wave-246</div>
|
||||
</header>
|
||||
|
||||
<div class=\"stats\">
|
||||
<div class=\"stat\"><b>" . count($dashboards) . "</b><span>Dashboards total</span></div>
|
||||
<div class=\"stat\"><b>" . count($by_cat) . "</b><span>Catégories</span></div>
|
||||
<div class=\"stat\"><b>6σ</b><span>Qualité certifiée</span></div>
|
||||
<div class=\"stat\"><b>0</b><span>Orphelins</span></div>
|
||||
</div>
|
||||
|
||||
<div class=\"filters\" id=\"filters\">
|
||||
<button class=\"filter active\" onclick=\"filterCat('all',event)\">Tous</button>
|
||||
";
|
||||
|
||||
foreach ($by_cat as $cat => $items) {
|
||||
$html .= " <button class=\"filter\" onclick=\"filterCat('" . md5($cat) . "',event)\">" . htmlspecialchars($cat) . " · " . count($items) . "</button>\n";
|
||||
}
|
||||
|
||||
$html .= " </div>
|
||||
|
||||
<div id=\"content\">
|
||||
";
|
||||
|
||||
foreach ($by_cat as $cat => $items) {
|
||||
$cat_id = md5($cat);
|
||||
$html .= " <div class=\"cat-section\" data-cat=\"" . $cat_id . "\">\n";
|
||||
$html .= " <div class=\"cat-title\">" . htmlspecialchars($cat) . " · " . count($items) . "</div>\n";
|
||||
$html .= " <div class=\"grid\">\n";
|
||||
foreach ($items as $d) {
|
||||
$recent = $d["days_ago"] < 2 ? "<span class=\"b recent\">✨ Récent</span>" : "";
|
||||
$html .= " <a class=\"card\" href=\"/" . htmlspecialchars($d["file"]) . "\" target=\"_blank\">\n";
|
||||
$html .= " <div class=\"t\">" . htmlspecialchars($d["title"]) . "</div>\n";
|
||||
$html .= " <div class=\"f\">" . htmlspecialchars($d["file"]) . "</div>\n";
|
||||
$html .= " <div class=\"meta\"><span class=\"b\">" . $d["size_kb"] . " KB</span><span class=\"b\">" . $d["days_ago"] . "j</span>" . $recent . "</div>\n";
|
||||
$html .= " </a>\n";
|
||||
}
|
||||
$html .= " </div>\n </div>\n";
|
||||
}
|
||||
|
||||
$html .= " </div>
|
||||
|
||||
<footer>
|
||||
<a href=\"/\">🏠 Home</a> ·
|
||||
<a href=\"/weval-technology-platform.html\">🛠 WTP</a> ·
|
||||
<a href=\"/wevia-master.html\">🤖 WEVIA Master</a> ·
|
||||
<a href=\"/wevia-orchestrator.html\">🎯 Arena</a> ·
|
||||
<a href=\"/all-ia-hub.html\">🧬 AI Hub</a> ·
|
||||
<a href=\"/oss-catalog.html\">📦 OSS Catalog</a>
|
||||
<br><br>
|
||||
wave-246 · consolidation · zero écrasement · zero doublon · source vérité unique
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function filterCat(catId, e){
|
||||
document.querySelectorAll('.filter').forEach(b=>b.classList.remove('active'));
|
||||
e.target.classList.add('active');
|
||||
document.querySelectorAll('.cat-section').forEach(s=>{
|
||||
if(catId==='all' || s.dataset.cat===catId){s.style.display='block';}
|
||||
else{s.style.display='none';}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>";
|
||||
|
||||
$path = "/var/www/html/dashboards-hub-unified.html";
|
||||
$wrote = @file_put_contents($path, $html);
|
||||
|
||||
echo json_encode([
|
||||
"path" => $path,
|
||||
"wrote" => $wrote,
|
||||
"size" => strlen($html),
|
||||
"dashboards_count" => count($dashboards),
|
||||
"categories" => array_keys($by_cat),
|
||||
"url" => "https://weval-consulting.com/dashboards-hub-unified.html",
|
||||
]);
|
||||
111
api/ambre-hub-enrich.php
Normal file
@@ -0,0 +1,111 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
$path = "/var/www/html/dashboards-index.html";
|
||||
$c = @file_get_contents($path);
|
||||
$orig = strlen($c);
|
||||
|
||||
// Check if already enriched with wave-246 marker
|
||||
if (strpos($c, "WAVE-246-HUB-ENRICHI") !== false) {
|
||||
echo json_encode(["already_enriched"=>true]);
|
||||
exit;
|
||||
}
|
||||
|
||||
// Collect all dashboard files with metadata (title from h1 or filename)
|
||||
$dashboards = [];
|
||||
foreach (glob("/var/www/html/*dashboard*.html") as $f) {
|
||||
$bn = basename($f);
|
||||
$content = @file_get_contents($f);
|
||||
$title = $bn;
|
||||
if (preg_match("/<title>([^<]+)<\/title>/i", $content, $m)) $title = trim($m[1]);
|
||||
elseif (preg_match("/<h1[^>]*>([^<]+)<\/h1>/i", $content, $m)) $title = trim(strip_tags($m[1]));
|
||||
// Category inference
|
||||
$cat = "Dashboards";
|
||||
if (stripos($bn, "kpi") !== false) $cat = "KPI & Analytics";
|
||||
elseif (stripos($bn, "6sigma") !== false || stripos($bn, "lean") !== false) $cat = "Lean 6σ";
|
||||
elseif (stripos($bn, "crm") !== false || stripos($bn, "lead") !== false) $cat = "CRM";
|
||||
elseif (stripos($bn, "ethica") !== false || stripos($bn, "medreach") !== false) $cat = "Ethica";
|
||||
elseif (stripos($bn, "infra") !== false || stripos($bn, "security") !== false || stripos($bn, "office") !== false) $cat = "Infrastructure";
|
||||
elseif (stripos($bn, "wevia") !== false) $cat = "WEVIA";
|
||||
elseif (stripos($bn, "contact") !== false || stripos($bn, "segment") !== false || stripos($bn, "database") !== false) $cat = "Données";
|
||||
elseif (stripos($bn, "acquired") !== false || stripos($bn, "dormant") !== false) $cat = "Lifecycle";
|
||||
elseif (stripos($bn, "orphan") !== false) $cat = "Audit";
|
||||
elseif (stripos($bn, "paperclip") !== false || stripos($bn, "em") === 0 || $bn === "em-dashboard.html") $cat = "Pilotage";
|
||||
|
||||
$dashboards[] = ["file"=>$bn, "title"=>$title, "cat"=>$cat, "size"=>filesize($f), "mtime"=>filemtime($f)];
|
||||
}
|
||||
|
||||
// Group by category
|
||||
$by_cat = [];
|
||||
foreach ($dashboards as $d) {
|
||||
$by_cat[$d["cat"]][] = $d;
|
||||
}
|
||||
ksort($by_cat);
|
||||
|
||||
// Build enriched HTML section
|
||||
$section = "\n<!-- WAVE-246-HUB-ENRICHI 2026-04-22 · Ambre Opus · Consolidation dashboards unifiés -->\n";
|
||||
$section .= "<style>
|
||||
.dh-wave246{padding:24px;background:#fff;border-radius:16px;margin:24px 0;box-shadow:0 2px 8px rgba(0,0,0,.04)}
|
||||
.dh-wave246 h2{font-size:20px;margin:0 0 8px;color:#1a1f3a;font-weight:600}
|
||||
.dh-wave246 .subtitle{color:#5a6480;font-size:13px;margin-bottom:20px}
|
||||
.dh-wave246 .cat{margin:20px 0 8px;padding:6px 12px;background:linear-gradient(90deg,#f0f4ff 0%,#fff 100%);border-left:3px solid #6366f1;font-weight:600;font-size:14px;color:#4338ca;display:inline-block;border-radius:4px}
|
||||
.dh-wave246 .grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(250px,1fr));gap:12px;margin:10px 0 20px}
|
||||
.dh-wave246 .card{padding:14px;background:#fafbff;border:1px solid rgba(99,102,241,.12);border-radius:10px;transition:all .15s ease;cursor:pointer;text-decoration:none;color:inherit;display:block}
|
||||
.dh-wave246 .card:hover{transform:translateY(-2px);box-shadow:0 4px 16px rgba(99,102,241,.15);border-color:#6366f1}
|
||||
.dh-wave246 .card .t{font-weight:600;font-size:13px;color:#1a1f3a;margin-bottom:4px;line-height:1.3}
|
||||
.dh-wave246 .card .m{font-size:11px;color:#94a3b8}
|
||||
.dh-wave246 .kb{display:flex;gap:6px;margin-top:8px}
|
||||
.dh-wave246 .kb span{padding:2px 6px;background:rgba(99,102,241,.08);color:#6366f1;font-size:10px;border-radius:4px}
|
||||
.dh-wave246 .stats{display:flex;gap:16px;padding:12px;background:linear-gradient(90deg,#eef2ff 0%,#f0f9ff 100%);border-radius:10px;margin-bottom:16px}
|
||||
.dh-wave246 .stats div{flex:1;text-align:center}
|
||||
.dh-wave246 .stats b{display:block;font-size:24px;color:#4338ca;font-weight:700}
|
||||
.dh-wave246 .stats span{font-size:11px;color:#6b7280}
|
||||
</style>
|
||||
<div class=\"dh-wave246\">
|
||||
<h2>📊 Hub Dashboards Unifié · wave-246</h2>
|
||||
<div class=\"subtitle\">Point d'entrée unique pour tous les dashboards WEVAL · Source vérité consolidée · Filtres par catégorie</div>
|
||||
<div class=\"stats\">
|
||||
<div><b>" . count($dashboards) . "</b><span>Dashboards total</span></div>
|
||||
<div><b>" . count($by_cat) . "</b><span>Catégories</span></div>
|
||||
<div><b>" . array_sum(array_map("count", $by_cat)) . "</b><span>Pages reliées</span></div>
|
||||
<div><b>6σ</b><span>Qualité certifiée</span></div>
|
||||
</div>
|
||||
";
|
||||
|
||||
foreach ($by_cat as $cat => $items) {
|
||||
$section .= " <div class=\"cat\">" . htmlspecialchars($cat) . " · " . count($items) . "</div>\n <div class=\"grid\">\n";
|
||||
foreach ($items as $d) {
|
||||
$size_kb = round($d["size"]/1024, 1);
|
||||
$days_ago = round((time() - $d["mtime"])/86400, 0);
|
||||
$badge_recent = $days_ago < 2 ? "<span>✨ Récent</span>" : "";
|
||||
$section .= " <a class=\"card\" href=\"/" . htmlspecialchars($d["file"]) . "\" target=\"_blank\">\n";
|
||||
$section .= " <div class=\"t\">" . htmlspecialchars(substr($d["title"], 0, 60)) . "</div>\n";
|
||||
$section .= " <div class=\"m\">" . $size_kb . " KB · il y a " . $days_ago . "j</div>\n";
|
||||
$section .= " <div class=\"kb\"><span>" . htmlspecialchars($d["file"]) . "</span>" . $badge_recent . "</div>\n";
|
||||
$section .= " </a>\n";
|
||||
}
|
||||
$section .= " </div>\n";
|
||||
}
|
||||
$section .= "</div>\n";
|
||||
$section .= "<!-- END WAVE-246-HUB-ENRICHI -->\n";
|
||||
|
||||
// Inject before </body>
|
||||
if (strpos($c, "</body>") !== false) {
|
||||
$new_c = str_replace("</body>", $section . "</body>", $c);
|
||||
} else {
|
||||
// append at end
|
||||
$new_c = $c . $section;
|
||||
}
|
||||
|
||||
$backup = "/opt/wevads/vault/dashboards-index.GOLD-" . date("Ymd-His") . "-wave246";
|
||||
@copy($path, $backup);
|
||||
$wrote = @file_put_contents($path, $new_c);
|
||||
|
||||
echo json_encode([
|
||||
"orig" => $orig,
|
||||
"new" => strlen($new_c),
|
||||
"delta" => strlen($new_c) - $orig,
|
||||
"wrote" => $wrote,
|
||||
"dashboards_added" => count($dashboards),
|
||||
"categories" => array_keys($by_cat),
|
||||
"backup" => basename($backup),
|
||||
]);
|
||||
12
api/ambre-install-deps.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
header("Content-Type: text/plain");
|
||||
$out = "";
|
||||
$out .= "=== Installing youtube_transcript_api ===\n";
|
||||
$out .= @shell_exec("pip install --break-system-packages youtube-transcript-api 2>&1 | tail -5");
|
||||
$out .= "\n=== Installing rembg (CPU only) ===\n";
|
||||
$out .= @shell_exec("pip install --break-system-packages 'rembg[cpu]' 2>&1 | tail -10");
|
||||
$out .= "\n=== Verify ===\n";
|
||||
$out .= "tesseract: " . trim(@shell_exec("which tesseract")) . "\n";
|
||||
$out .= "rembg: " . trim(@shell_exec("which rembg")) . "\n";
|
||||
$out .= "yt_api: " . trim(@shell_exec("python3 -c 'import youtube_transcript_api; print(\"OK\", youtube_transcript_api.__version__)' 2>&1")) . "\n";
|
||||
echo $out;
|
||||
28
api/ambre-js-lint.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
header("Content-Type: text/plain");
|
||||
// Extract the big script from wevia.html and try to parse it
|
||||
$wevia = @file_get_contents("/var/www/html/wevia.html");
|
||||
// Find the main script starting around line 718
|
||||
$pos = 0;
|
||||
$scripts = [];
|
||||
while (($start = strpos($wevia, "<script>", $pos)) !== false) {
|
||||
$end = strpos($wevia, "</script>", $start);
|
||||
if ($end === false) break;
|
||||
$content = substr($wevia, $start + 8, $end - $start - 8);
|
||||
if (strlen($content) > 5000) { // only big scripts
|
||||
$line_start = substr_count(substr($wevia, 0, $start), "\n") + 1;
|
||||
$scripts[] = ["start_line" => $line_start, "size" => strlen($content), "content" => $content];
|
||||
}
|
||||
$pos = $end + 9;
|
||||
}
|
||||
|
||||
echo "Big scripts found: " . count($scripts) . "\n";
|
||||
foreach ($scripts as $i => $s) {
|
||||
$tmp = "/tmp/wevia-script-$i.js";
|
||||
file_put_contents($tmp, $s["content"]);
|
||||
echo "Script $i: line $s[start_line], $s[size]B → $tmp\n";
|
||||
|
||||
// Parse with node to find syntax errors
|
||||
$parse_result = @shell_exec("node --check $tmp 2>&1");
|
||||
echo " Parse: " . substr($parse_result, 0, 500) . "\n\n";
|
||||
}
|
||||
29
api/ambre-js-parse.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
header("Content-Type: text/plain");
|
||||
$wevia = @file_get_contents("/var/www/html/wevia.html");
|
||||
$pos = 0;
|
||||
$big = null; $start_abs = 0;
|
||||
while (($m = strpos($wevia, "<script>", $pos)) !== false) {
|
||||
$end = strpos($wevia, "</script>", $m);
|
||||
if ($end === false) break;
|
||||
$content = substr($wevia, $m + 8, $end - $m - 8);
|
||||
if (strlen($content) > 20000) {
|
||||
$big = $content;
|
||||
$start_abs = substr_count(substr($wevia, 0, $m + 8), "\n") + 1;
|
||||
break;
|
||||
}
|
||||
$pos = $end + 9;
|
||||
}
|
||||
|
||||
$tmp = "/tmp/wevia-big.js";
|
||||
file_put_contents($tmp, $big);
|
||||
echo "Size: " . strlen($big) . "B\n";
|
||||
echo "Start abs line in HTML: $start_abs\n\n";
|
||||
|
||||
// Try to parse with node
|
||||
$parse = @shell_exec("node --check $tmp 2>&1");
|
||||
echo "=== node --check ===\n$parse\n\n";
|
||||
|
||||
// Also try to execute just to see if RUNTIME regex error appears
|
||||
$exec = @shell_exec("timeout 3 node -e \"const fs=require('fs'); const src=fs.readFileSync('$tmp','utf8'); try { new Function(src); console.log('new Function OK'); } catch(e) { console.log('new Function ERROR:', e.message); console.log(e.stack ? e.stack.split(String.fromCharCode(10))[0] : ''); }\" 2>&1");
|
||||
echo "=== new Function test ===\n$exec\n";
|
||||
27
api/ambre-keys-scan.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
$out = [];
|
||||
|
||||
// All API keys from secrets.env
|
||||
$secrets = @file_get_contents("/etc/weval/secrets.env");
|
||||
if ($secrets) {
|
||||
preg_match_all("/^(\w+)=(\S+)/m", $secrets, $m);
|
||||
$keys_present = [];
|
||||
foreach ($m[1] as $i => $name) {
|
||||
if (strpos($name, "KEY") !== false || strpos($name, "TOKEN") !== false) {
|
||||
$val = $m[2][$i];
|
||||
$keys_present[] = ["name"=>$name, "len"=>strlen($val)];
|
||||
}
|
||||
}
|
||||
$out["keys"] = $keys_present;
|
||||
}
|
||||
|
||||
// Check skill-image-gen.php content
|
||||
$f = "/var/www/html/api/skill-image-gen.php";
|
||||
if (file_exists($f)) $out["skill_image_gen_preview"] = substr(@file_get_contents($f), 0, 1500);
|
||||
|
||||
// Check wevia-deepseek-web.php content
|
||||
$f2 = "/var/www/html/api/wevia-deepseek-web.php";
|
||||
if (file_exists($f2)) $out["deepseek_web_preview"] = substr(@file_get_contents($f2), 0, 800);
|
||||
|
||||
echo json_encode($out, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES);
|
||||
7
api/ambre-kill-v30.php
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
header("Content-Type: text/plain");
|
||||
@shell_exec("pkill -f 'v30-long-video\\|playwright test' 2>&1");
|
||||
sleep(2);
|
||||
echo @shell_exec("pgrep -af playwright");
|
||||
echo "\n---\n";
|
||||
echo @shell_exec("pgrep -af v30");
|
||||
7
api/ambre-kill-v30b.php
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
header("Content-Type: text/plain");
|
||||
@shell_exec("kill -9 139172 139173 139219 2>&1");
|
||||
@shell_exec("pkill -9 -f playwright 2>&1");
|
||||
sleep(2);
|
||||
echo "After kill:\n";
|
||||
echo @shell_exec("pgrep -af 'playwright\\|chromium\\|chrome' | head -10");
|
||||
5
api/ambre-kill25.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
header("Content-Type: text/plain");
|
||||
@shell_exec("pkill -f playwright 2>&1");
|
||||
echo "killed\n";
|
||||
echo @shell_exec("pgrep -af playwright | head -5");
|
||||
28
api/ambre-line-dump.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
$wevia = @file_get_contents("/var/www/html/wevia.html");
|
||||
$pos = 0;
|
||||
$big = null;
|
||||
while (($m = strpos($wevia, "<script>", $pos)) !== false) {
|
||||
$end = strpos($wevia, "</script>", $m);
|
||||
if ($end === false) break;
|
||||
$content = substr($wevia, $m + 8, $end - $m - 8);
|
||||
if (strlen($content) > 20000) { $big = $content; break; }
|
||||
$pos = $end + 9;
|
||||
}
|
||||
if (!$big) { echo json_encode(["error"=>"no big script"]); exit; }
|
||||
|
||||
$lines = explode("\n", $big);
|
||||
// Browser reports line 920 col 105 within that script
|
||||
$out = [
|
||||
"total_lines" => count($lines),
|
||||
"line_918" => $lines[917] ?? "",
|
||||
"line_919" => $lines[918] ?? "",
|
||||
"line_920" => $lines[919] ?? "",
|
||||
"line_921" => $lines[920] ?? "",
|
||||
"line_922" => $lines[921] ?? "",
|
||||
"line_920_length" => strlen($lines[919] ?? ""),
|
||||
"col_95_115_of_920" => substr($lines[919] ?? "", 94, 21),
|
||||
];
|
||||
|
||||
echo json_encode($out, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES);
|
||||
13
api/ambre-list-tools.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
$files = glob("/var/www/html/api/ambre-*.php");
|
||||
sort($files);
|
||||
$out = [];
|
||||
foreach ($files as $f) {
|
||||
$out[] = [
|
||||
"name" => basename($f),
|
||||
"size" => filesize($f),
|
||||
"mtime" => date("Y-m-d H:i", filemtime($f)),
|
||||
];
|
||||
}
|
||||
echo json_encode($out, JSON_PRETTY_PRINT);
|
||||
16
api/ambre-list-videos.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
$dir = "/var/www/html/api/ambre-pw-tests/output";
|
||||
$vids = [];
|
||||
foreach (glob("$dir/*/video.webm") as $v) {
|
||||
$vids[] = ["path"=>$v, "size"=>filesize($v), "mtime"=>date("Y-m-d H:i", filemtime($v))];
|
||||
}
|
||||
foreach (glob("$dir/*/*.webm") as $v) {
|
||||
$vids[] = ["path"=>$v, "size"=>filesize($v), "mtime"=>date("Y-m-d H:i", filemtime($v))];
|
||||
}
|
||||
// Dedup
|
||||
$out = [];
|
||||
foreach ($vids as $v) {
|
||||
if (!isset($out[$v["path"]])) $out[$v["path"]] = $v;
|
||||
}
|
||||
echo json_encode(array_values($out), JSON_PRETTY_PRINT);
|
||||
83
api/ambre-llm-semaphore.php
Normal file
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
/**
|
||||
* ambre-llm-semaphore.php · 6σ Lean server-side throttle for LLM cascade :4000
|
||||
* Prevents > 5 simultaneous LLM calls to protect cascade from burst overload.
|
||||
* Used transparently by tools that call LLM.
|
||||
*/
|
||||
|
||||
class AmbreLLMSemaphore {
|
||||
const DIR = "/var/tmp/ambre-llm-sem";
|
||||
const MAX_CONCURRENT = 5;
|
||||
const MAX_WAIT_MS = 20000; // 20s max wait in queue
|
||||
const STALE_LOCK_SEC = 60; // kill locks older than 60s
|
||||
|
||||
public static function init() {
|
||||
if (!is_dir(self::DIR)) @mkdir(self::DIR, 0777, true);
|
||||
}
|
||||
|
||||
/** Clean stale locks (older than 60s) */
|
||||
public static function cleanup() {
|
||||
self::init();
|
||||
$now = time();
|
||||
foreach (glob(self::DIR . "/*.lock") as $f) {
|
||||
if (($now - @filemtime($f)) > self::STALE_LOCK_SEC) @unlink($f);
|
||||
}
|
||||
}
|
||||
|
||||
/** Count active locks */
|
||||
public static function count_active() {
|
||||
self::cleanup();
|
||||
return count(glob(self::DIR . "/*.lock"));
|
||||
}
|
||||
|
||||
/** Acquire a slot (blocks up to MAX_WAIT_MS) */
|
||||
public static function acquire() {
|
||||
self::init();
|
||||
$id = bin2hex(random_bytes(6)) . "-" . getmypid();
|
||||
$start = microtime(true);
|
||||
|
||||
while (true) {
|
||||
if (self::count_active() < self::MAX_CONCURRENT) {
|
||||
@file_put_contents(self::DIR . "/$id.lock", date("c"));
|
||||
return $id;
|
||||
}
|
||||
// Wait 200ms then retry
|
||||
if ((microtime(true) - $start) * 1000 > self::MAX_WAIT_MS) {
|
||||
return null; // timeout - caller should handle
|
||||
}
|
||||
usleep(200000);
|
||||
}
|
||||
}
|
||||
|
||||
/** Release a slot */
|
||||
public static function release($id) {
|
||||
if (!$id) return;
|
||||
@unlink(self::DIR . "/$id.lock");
|
||||
}
|
||||
|
||||
/** Wrap a callable with semaphore protection */
|
||||
public static function guarded($callable) {
|
||||
$id = self::acquire();
|
||||
try {
|
||||
$result = $callable($id);
|
||||
} finally {
|
||||
self::release($id);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/** Stats for monitoring */
|
||||
public static function stats() {
|
||||
return [
|
||||
"active" => self::count_active(),
|
||||
"max" => self::MAX_CONCURRENT,
|
||||
"dir" => self::DIR,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
// Expose as endpoint for stats
|
||||
if (basename($_SERVER["SCRIPT_NAME"]) === "ambre-llm-semaphore.php") {
|
||||
header("Content-Type: application/json");
|
||||
echo json_encode(AmbreLLMSemaphore::stats());
|
||||
}
|
||||
30
api/ambre-load-check.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
echo json_encode([
|
||||
"uptime" => trim(shell_exec("uptime")),
|
||||
"nginx_error_tail" => substr(shell_exec("tail -15 /var/log/nginx/error.log 2>&1"), 0, 1500),
|
||||
"fpm_error_tail" => substr(shell_exec("tail -10 /var/log/php8.4-fpm.log 2>&1 || tail -10 /var/log/php8.3-fpm.log 2>&1"), 0, 1000),
|
||||
"cascade_test" => (function(){
|
||||
$t0 = microtime(true);
|
||||
$ctx = stream_context_create(["http"=>["method"=>"POST","header"=>"Content-Type: application/json\r\n","content"=>json_encode(["model"=>"fast","messages"=>[["role"=>"user","content"=>"Hi"]],"max_tokens"=>20]),"timeout"=>5]]);
|
||||
$r = @file_get_contents("http://127.0.0.1:4000/v1/chat/completions", false, $ctx);
|
||||
return ["ok"=>(bool)$r, "elapsed_ms"=>round((microtime(true)-$t0)*1000), "resp"=>substr($r?:"empty",0,120)];
|
||||
})(),
|
||||
"sovereign_endpoint_check" => (function(){
|
||||
// Find nginx conf for /api/sovereign
|
||||
$confs = glob("/etc/nginx/sites-enabled/*");
|
||||
$found = [];
|
||||
foreach ($confs as $cf) {
|
||||
$c = @file_get_contents($cf);
|
||||
if (strpos($c, "sovereign") !== false) {
|
||||
$lines = explode("\n", $c);
|
||||
foreach ($lines as $i => $l) {
|
||||
if (strpos($l, "sovereign") !== false) {
|
||||
$found[basename($cf)][] = "L" . ($i+1) . ": " . trim(substr($l, 0, 200));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $found;
|
||||
})(),
|
||||
]);
|
||||
6
api/ambre-load-quick.php
Normal file
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
echo json_encode([
|
||||
"load" => trim(shell_exec("uptime")),
|
||||
"fpm_procs" => intval(shell_exec("pgrep -c php-fpm8")),
|
||||
]);
|
||||
24
api/ambre-mermaid-fix2.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
$path = "/var/www/html/wevia.html";
|
||||
$content = @file_get_contents($path);
|
||||
$orig_size = strlen($content);
|
||||
|
||||
$old = "if(e&&e.message&&/mermaid/i.test(e.message)) return true;";
|
||||
$new = "if(e&&e.message&&String(e.message).toLowerCase().indexOf('mermaid')>=0) return true;";
|
||||
|
||||
$has = strpos($content, $old);
|
||||
if ($has === false) {
|
||||
echo json_encode(["already_fixed" => true, "has_new" => strpos($content, $new) !== false, "size" => $orig_size]);
|
||||
exit;
|
||||
}
|
||||
|
||||
$new_content = str_replace($old, $new, $content);
|
||||
$backup = "/opt/wevads/vault/wevia.html.GOLD-" . date("Ymd-His") . "-mermaid-fix";
|
||||
@copy($path, $backup);
|
||||
$wrote = @file_put_contents($path, $new_content);
|
||||
|
||||
echo json_encode([
|
||||
"orig"=>$orig_size, "new"=>strlen($new_content), "delta"=>strlen($new_content)-$orig_size,
|
||||
"wrote"=>$wrote, "backup"=>basename($backup)
|
||||
]);
|
||||
108
api/ambre-mermaid-learn.php
Normal file
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
/**
|
||||
* ambre-mermaid-learn.php · Mermaid schema learning system
|
||||
* Every mermaid diagram generated is saved with context + tags for reuse
|
||||
* Uses Qdrant KB + local JSON fallback
|
||||
*/
|
||||
header("Content-Type: application/json; charset=utf-8");
|
||||
|
||||
$raw = file_get_contents("php://input");
|
||||
$in = json_decode($raw, true) ?: $_POST;
|
||||
$action = $in["action"] ?? "list";
|
||||
|
||||
$store_file = "/var/www/html/generated/mermaid-learn-kb.json";
|
||||
if (!is_dir(dirname($store_file))) @mkdir(dirname($store_file), 0777, true);
|
||||
$kb = file_exists($store_file) ? (json_decode(@file_get_contents($store_file), true) ?: []) : [];
|
||||
|
||||
if ($action === "save") {
|
||||
$topic = trim($in["topic"] ?? "");
|
||||
$code = trim($in["code"] ?? "");
|
||||
$kind = $in["kind"] ?? "flowchart"; // flowchart, sequence, gantt, pie, etc.
|
||||
$context = $in["context"] ?? "";
|
||||
if (!$topic || !$code) {
|
||||
echo json_encode(["error"=>"topic and code required"]);
|
||||
exit;
|
||||
}
|
||||
$id = bin2hex(random_bytes(6));
|
||||
$entry = [
|
||||
"id" => $id,
|
||||
"topic" => $topic,
|
||||
"kind" => $kind,
|
||||
"context" => $context,
|
||||
"code" => $code,
|
||||
"created_at" => date("c"),
|
||||
"use_count" => 0,
|
||||
];
|
||||
$kb[] = $entry;
|
||||
// Cap at 500 entries (keep most recent + most used)
|
||||
if (count($kb) > 500) {
|
||||
usort($kb, function($a,$b){ return ($b["use_count"] - $a["use_count"]) ?: strcmp($b["created_at"], $a["created_at"]); });
|
||||
$kb = array_slice($kb, 0, 500);
|
||||
}
|
||||
@file_put_contents($store_file, json_encode($kb, JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE));
|
||||
echo json_encode(["ok"=>true, "id"=>$id, "total"=>count($kb)]);
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($action === "search") {
|
||||
$q = trim($in["query"] ?? "");
|
||||
if (!$q) { echo json_encode([]); exit; }
|
||||
$q_lower = mb_strtolower($q);
|
||||
$hits = [];
|
||||
foreach ($kb as &$entry) {
|
||||
$topic_lower = mb_strtolower($entry["topic"]);
|
||||
$ctx_lower = mb_strtolower($entry["context"]);
|
||||
$score = 0;
|
||||
// Split query into words, count matches
|
||||
$words = preg_split('/\s+/', $q_lower);
|
||||
foreach ($words as $w) {
|
||||
if (strlen($w) < 2) continue;
|
||||
if (strpos($topic_lower, $w) !== false) $score += 2;
|
||||
if (strpos($ctx_lower, $w) !== false) $score += 1;
|
||||
}
|
||||
if ($score > 0) {
|
||||
$entry["score"] = $score + ($entry["use_count"] * 0.1);
|
||||
$hits[] = $entry;
|
||||
}
|
||||
}
|
||||
usort($hits, function($a,$b){ return $b["score"] <=> $a["score"]; });
|
||||
$top = array_slice($hits, 0, 5);
|
||||
echo json_encode($top, JSON_UNESCAPED_UNICODE);
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($action === "use") {
|
||||
$id = $in["id"] ?? "";
|
||||
foreach ($kb as &$entry) {
|
||||
if ($entry["id"] === $id) {
|
||||
$entry["use_count"] = ($entry["use_count"] ?? 0) + 1;
|
||||
@file_put_contents($store_file, json_encode($kb, JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE));
|
||||
echo json_encode(["ok"=>true, "use_count"=>$entry["use_count"]]);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
echo json_encode(["error"=>"not found"]);
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($action === "stats") {
|
||||
$kinds = [];
|
||||
$total_uses = 0;
|
||||
foreach ($kb as $e) {
|
||||
$k = $e["kind"] ?? "flowchart";
|
||||
$kinds[$k] = ($kinds[$k] ?? 0) + 1;
|
||||
$total_uses += ($e["use_count"] ?? 0);
|
||||
}
|
||||
echo json_encode([
|
||||
"total_diagrams" => count($kb),
|
||||
"by_kind" => $kinds,
|
||||
"total_uses" => $total_uses,
|
||||
]);
|
||||
exit;
|
||||
}
|
||||
|
||||
// default: list all
|
||||
echo json_encode([
|
||||
"total" => count($kb),
|
||||
"items" => array_slice(array_reverse($kb), 0, 20),
|
||||
], JSON_UNESCAPED_UNICODE);
|
||||
25
api/ambre-or-models.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
$secrets = @file_get_contents("/etc/weval/secrets.env");
|
||||
preg_match("/^OPENROUTER_KEY=(\S+)/m", $secrets ?? "", $m);
|
||||
$or_key = $m[1] ?? "";
|
||||
|
||||
$ch = curl_init("https://openrouter.ai/api/v1/models");
|
||||
curl_setopt_array($ch, [
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_TIMEOUT => 15,
|
||||
CURLOPT_HTTPHEADER => ["Authorization: Bearer $or_key"],
|
||||
]);
|
||||
$raw = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
|
||||
$d = json_decode($raw, true);
|
||||
$online = [];
|
||||
$sonar = [];
|
||||
foreach ($d["data"] ?? [] as $m) {
|
||||
$id = $m["id"] ?? "";
|
||||
if (strpos($id, "online") !== false || strpos($id, "sonar") !== false || strpos($id, "perplexity") !== false) {
|
||||
$online[] = $id;
|
||||
}
|
||||
}
|
||||
echo json_encode(["online_models" => $online, "total_models" => count($d["data"] ?? [])], JSON_PRETTY_PRINT);
|
||||
39
api/ambre-orphans-dup.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
$out = [];
|
||||
|
||||
// Sitemap-api JSON
|
||||
$sm = @file_get_contents("https://weval-consulting.com/api/sitemap-api.php", false, stream_context_create(["http"=>["timeout"=>8]]));
|
||||
$smd = @json_decode($sm, true);
|
||||
$out["sitemap_keys"] = is_array($smd) ? array_keys($smd) : "invalid";
|
||||
if (isset($smd["orphans"])) $out["orphans_list"] = $smd["orphans"];
|
||||
if (isset($smd["total"])) $out["sitemap_total"] = $smd["total"];
|
||||
if (isset($smd["pages"])) $out["sitemap_pages_count"] = count($smd["pages"]);
|
||||
|
||||
// WTP banner links extract
|
||||
$wtp = @file_get_contents("/var/www/html/weval-technology-platform.html");
|
||||
preg_match_all("/href=[\"']([^\"']+\.html[^\"']*)[\"']/", $wtp, $m);
|
||||
$links = array_unique($m[1] ?? []);
|
||||
$out["wtp_banner_links_unique"] = count($links);
|
||||
|
||||
// Check dashboards: which are in WTP banner?
|
||||
$dashboards = array_map("basename", glob("/var/www/html/*dashboard*.html") ?: []);
|
||||
$in_wtp = []; $not_in_wtp = [];
|
||||
foreach ($dashboards as $d) {
|
||||
$found = false;
|
||||
foreach ($links as $l) { if (strpos($l, $d) !== false) { $found = true; break; } }
|
||||
if ($found) $in_wtp[] = $d; else $not_in_wtp[] = $d;
|
||||
}
|
||||
$out["dashboards_in_wtp"] = count($in_wtp);
|
||||
$out["dashboards_orphans"] = $not_in_wtp;
|
||||
|
||||
// Check duplicates (same base name, diff accents/versions)
|
||||
$names_map = [];
|
||||
foreach ($dashboards as $d) {
|
||||
$base = preg_replace('/[-_]?(v\d+|live|new|old)\.html$/i', '', $d);
|
||||
$names_map[$base] = ($names_map[$base] ?? 0) + 1;
|
||||
}
|
||||
$dup_dashboards = array_filter($names_map, function($v){return $v>1;});
|
||||
$out["potential_duplicates"] = $dup_dashboards;
|
||||
|
||||
echo json_encode($out, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES);
|
||||
31
api/ambre-oss-state.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
$files = [
|
||||
"/var/www/html/api/oss-registry.json",
|
||||
"/var/www/html/oss-registry.json",
|
||||
"/var/www/html/oss-catalog.html",
|
||||
];
|
||||
$out = [];
|
||||
foreach ($files as $f) {
|
||||
if (file_exists($f)) {
|
||||
$out[basename($f)] = [
|
||||
"size" => filesize($f),
|
||||
"mtime" => date("Y-m-d H:i", filemtime($f)),
|
||||
];
|
||||
if (substr($f, -5) === ".json") {
|
||||
$data = json_decode(@file_get_contents($f), true);
|
||||
$out[basename($f)]["tool_count"] = is_array($data) ? count($data) : 0;
|
||||
if (is_array($data)) {
|
||||
$cats = [];
|
||||
foreach ($data as $d) {
|
||||
$c = $d["category"] ?? $d["cat"] ?? "unknown";
|
||||
$cats[$c] = ($cats[$c] ?? 0) + 1;
|
||||
}
|
||||
$out[basename($f)]["cats"] = $cats;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$out[basename($f)] = "NOT FOUND";
|
||||
}
|
||||
}
|
||||
echo json_encode($out, JSON_PRETTY_PRINT);
|
||||
27
api/ambre-oss-wire.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
$path = "/var/www/html/oss-catalog.html";
|
||||
$c = @file_get_contents($path);
|
||||
$orig = strlen($c);
|
||||
|
||||
if (strpos($c, "dashboards-hub-unified") !== false) {
|
||||
echo json_encode(["already"=>true]);
|
||||
exit;
|
||||
}
|
||||
|
||||
// Inject in footer
|
||||
$old = '<a href="/dashboards-index.html">Dashboards</a>';
|
||||
$new = '<a href="/dashboards-hub-unified.html">📊 Hub Dashboards</a> · <a href="/dashboards-index.html">Index</a>';
|
||||
|
||||
if (strpos($c, $old) !== false) {
|
||||
$c = str_replace($old, $new, $c);
|
||||
$backup = "/opt/wevads/vault/oss-catalog.GOLD-" . date("Ymd-His") . "-wave246";
|
||||
@copy($path, $backup);
|
||||
$wrote = @file_put_contents($path, $c);
|
||||
echo json_encode([
|
||||
"wrote" => $wrote,
|
||||
"delta" => strlen($c) - $orig,
|
||||
]);
|
||||
} else {
|
||||
echo json_encode(["error"=>"anchor not found"]);
|
||||
}
|
||||
31
api/ambre-parse-all.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
header("Content-Type: text/plain");
|
||||
|
||||
$wevia = @file_get_contents("/var/www/html/wevia.html");
|
||||
|
||||
// Extract all <script> contents and try each with node
|
||||
$pos = 0; $n = 0;
|
||||
while (($m = strpos($wevia, "<script", $pos)) !== false) {
|
||||
$tag_end = strpos($wevia, ">", $m);
|
||||
if ($tag_end === false) break;
|
||||
$tag = substr($wevia, $m, $tag_end - $m + 1);
|
||||
// Skip if has src=
|
||||
if (strpos($tag, "src=") !== false) { $pos = $tag_end + 1; continue; }
|
||||
$end = strpos($wevia, "</script>", $tag_end);
|
||||
if ($end === false) break;
|
||||
$content = substr($wevia, $tag_end + 1, $end - $tag_end - 1);
|
||||
if (strlen($content) < 50) { $pos = $end + 9; continue; }
|
||||
|
||||
$n++;
|
||||
$abs_line = substr_count(substr($wevia, 0, $tag_end + 1), "\n") + 1;
|
||||
$tmp = "/tmp/wscript-$n.js";
|
||||
file_put_contents($tmp, $content);
|
||||
$parse = @shell_exec("node --check $tmp 2>&1");
|
||||
if (trim($parse)) {
|
||||
echo "=== Script #$n (starts abs line $abs_line, " . strlen($content) . "B) ===\n";
|
||||
echo "$parse\n\n";
|
||||
} else {
|
||||
echo "Script #$n (line $abs_line, " . strlen($content) . "B): OK\n";
|
||||
}
|
||||
$pos = $end + 9;
|
||||
}
|
||||
79
api/ambre-pdf-enh.php
Normal file
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
$path = "/var/www/html/api/ambre-tool-pdf-premium.php";
|
||||
$c = @file_get_contents($path);
|
||||
|
||||
// Enhance the system prompt to suggest best chart type based on topic
|
||||
$old_sys = '"chart_data\": {\n \"type\": \"bar\",';
|
||||
$new_sys = '"chart_data\": {\n \"type\": \"bar\", // or \"pie\", \"line\", \"doughnut\", \"radar\", \"polarArea\" selon le sujet',
|
||||
|
||||
if (strpos($c, $old_sys) !== false) {
|
||||
$c = str_replace($old_sys, $new_sys, $c);
|
||||
}
|
||||
|
||||
// Enhance the rendered Chart.js config to handle different types with proper options
|
||||
$old_js_chart = 'new Chart(ctx, {
|
||||
type: cd.type || "$chart_type",
|
||||
data: {
|
||||
labels: cd.labels || [],
|
||||
datasets: [{
|
||||
label: cd.title || "Données",
|
||||
data: cd.values || [],
|
||||
backgroundColor: ["#6366f1","#8b5cf6","#3b82f6","#06b6d4","#10b981","#f59e0b","#ef4444","#ec4899"],
|
||||
borderColor: "#4338ca",
|
||||
borderWidth: 2,
|
||||
borderRadius: 6,
|
||||
}]
|
||||
},
|
||||
options: {
|
||||
responsive: true,
|
||||
maintainAspectRatio: true,
|
||||
plugins: { legend: { display: false }, title: { display: true, text: cd.title, color: "#334155", font:{size:14}}},
|
||||
scales: { y: { beginAtZero: true, grid:{color:"#f1f5f9"}}, x: {grid:{display:false}}},
|
||||
}
|
||||
});';
|
||||
|
||||
$new_js_chart = 'var _chartType = cd.type || "bar";
|
||||
var _palette = ["#6366f1","#8b5cf6","#3b82f6","#06b6d4","#10b981","#f59e0b","#ef4444","#ec4899","#84cc16","#f97316"];
|
||||
var _dataset = {
|
||||
label: cd.title || "Données",
|
||||
data: cd.values || [],
|
||||
backgroundColor: (["pie","doughnut","polarArea"].indexOf(_chartType) >= 0) ? _palette : _palette.slice(0, (cd.values||[]).length),
|
||||
borderColor: (["line","radar"].indexOf(_chartType) >= 0) ? "#6366f1" : "#4338ca",
|
||||
borderWidth: (["pie","doughnut","polarArea"].indexOf(_chartType) >= 0) ? 2 : (["line","radar"].indexOf(_chartType) >= 0 ? 3 : 2),
|
||||
borderRadius: (_chartType === "bar") ? 6 : 0,
|
||||
tension: (_chartType === "line") ? 0.35 : 0,
|
||||
fill: (_chartType === "line") ? false : true,
|
||||
pointBackgroundColor: "#6366f1",
|
||||
pointRadius: (["line","radar"].indexOf(_chartType) >= 0) ? 5 : 0,
|
||||
};
|
||||
var _showLegend = (["pie","doughnut","polarArea","radar"].indexOf(_chartType) >= 0);
|
||||
var _showScales = (["pie","doughnut","polarArea","radar"].indexOf(_chartType) < 0);
|
||||
new Chart(ctx, {
|
||||
type: _chartType,
|
||||
data: { labels: cd.labels || [], datasets: [_dataset] },
|
||||
options: {
|
||||
responsive: true,
|
||||
maintainAspectRatio: true,
|
||||
plugins: {
|
||||
legend: { display: _showLegend, position: "bottom", labels: {boxWidth: 12, font: {size: 11}}},
|
||||
title: { display: true, text: cd.title || "Données", color: "#334155", font: {size: 14, weight: "600"}, padding: {top: 4, bottom: 14}}
|
||||
},
|
||||
scales: _showScales ? { y: { beginAtZero: true, grid: {color: "#f1f5f9"}}, x: {grid: {display: false}}} : {},
|
||||
}
|
||||
});';
|
||||
|
||||
if (strpos($c, $old_js_chart) !== false) {
|
||||
$c = str_replace($old_js_chart, $new_js_chart, $c);
|
||||
}
|
||||
|
||||
// Save
|
||||
$backup = "/opt/wevads/vault/pdf-premium.GOLD-" . date("Ymd-His") . "-chart-types";
|
||||
@copy($path, $backup);
|
||||
$wrote = @file_put_contents($path, $c);
|
||||
|
||||
echo json_encode([
|
||||
"wrote" => $wrote,
|
||||
"size" => strlen($c),
|
||||
"backup" => basename($backup),
|
||||
]);
|
||||
59
api/ambre-pdf-i18n.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
$path = "/var/www/html/api/ambre-tool-pdf-premium.php";
|
||||
$c = @file_get_contents($path);
|
||||
|
||||
// Add lang detection + multi-prompt
|
||||
$old_sys = '$sys = "Tu es un expert en création de rapports business premium. Pour le sujet donné, génère UNIQUEMENT un JSON valide avec cette structure exacte (pas de markdown, pas d\'explication) :';
|
||||
|
||||
$new_sys = '// i18n language detection (simple heuristic)
|
||||
$topic_lower = mb_strtolower($topic);
|
||||
$lang = $in["lang"] ?? null;
|
||||
if (!$lang) {
|
||||
// Detect from content
|
||||
if (preg_match("/\b(the|is|are|and|of|for|to|with|on|in|a)\b/i", $topic_lower) && !preg_match("/\b(le|la|les|du|des|pour|avec)\b/i", $topic_lower)) {
|
||||
$lang = "en";
|
||||
} elseif (preg_match("/[\x{0600}-\x{06FF}]/u", $topic)) {
|
||||
$lang = "ar";
|
||||
} else {
|
||||
$lang = "fr";
|
||||
}
|
||||
}
|
||||
|
||||
// Prompts by language
|
||||
$prompts = [
|
||||
"fr" => "Tu es un expert en création de rapports business premium. Pour le sujet donné, génère UNIQUEMENT un JSON valide avec cette structure exacte (pas de markdown, pas d\'explication) :",
|
||||
"en" => "You are an expert in premium business report creation. For the given topic, generate ONLY valid JSON with this exact structure (no markdown, no explanation). All text in English :",
|
||||
"ar" => "أنت خبير في إنشاء تقارير الأعمال المتميزة. للموضوع المحدد، قم بإنشاء JSON صالح فقط بهذه البنية الدقيقة (بدون markdown، بدون شرح). جميع النصوص باللغة العربية :",
|
||||
];
|
||||
$sys = $prompts[$lang] ?? $prompts["fr"];
|
||||
$sys .= "';
|
||||
|
||||
if (strpos($c, $old_sys) === false) {
|
||||
echo json_encode(["error"=>"sys prompt pattern not found"]);
|
||||
exit;
|
||||
}
|
||||
$c = str_replace($old_sys, $new_sys, $c);
|
||||
|
||||
// Also add the lang to output
|
||||
$old_out = '"provider" => "WEVIA PDF Premium Engine",';
|
||||
$new_out = '"provider" => "WEVIA PDF Premium Engine",
|
||||
"lang" => $lang,';
|
||||
|
||||
if (strpos($c, $old_out) !== false) {
|
||||
$c = str_replace($old_out, $new_out, $c);
|
||||
}
|
||||
|
||||
$backup = "/opt/wevads/vault/pdf-premium.GOLD-" . date("Ymd-His") . "-i18n";
|
||||
@copy($path, $backup);
|
||||
$wrote = @file_put_contents($path, $c);
|
||||
|
||||
// Lint
|
||||
$lint = @shell_exec("php -l $path 2>&1");
|
||||
|
||||
echo json_encode([
|
||||
"wrote" => $wrote,
|
||||
"size" => strlen($c),
|
||||
"backup" => basename($backup),
|
||||
"lint" => trim($lint),
|
||||
]);
|
||||
54
api/ambre-pdf-memory.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
$out = [];
|
||||
|
||||
// 1. Search wikis about "pdf premium" or "pdf graphique"
|
||||
$wiki_hits = [];
|
||||
foreach (glob("/opt/obsidian-vault/**/*.md") as $f) {
|
||||
$content = @file_get_contents($f);
|
||||
if (!$content) continue;
|
||||
if (stripos($content, "pdf premium") !== false ||
|
||||
stripos($content, "weasyprint") !== false ||
|
||||
stripos($content, "pdf graphique") !== false ||
|
||||
stripos($content, "reportlab") !== false ||
|
||||
stripos($content, "pdf chart") !== false ||
|
||||
stripos($content, "pdfmake") !== false) {
|
||||
$wiki_hits[] = [
|
||||
"file" => str_replace("/opt/obsidian-vault/", "", $f),
|
||||
"size" => filesize($f),
|
||||
];
|
||||
}
|
||||
}
|
||||
$out["wiki_hits_pdf"] = array_slice($wiki_hits, 0, 15);
|
||||
|
||||
// 2. Existing PDF endpoints
|
||||
$out["pdf_endpoints"] = [];
|
||||
foreach (glob("/var/www/html/api/*pdf*.php") as $f) {
|
||||
$out["pdf_endpoints"][] = [
|
||||
"name" => basename($f),
|
||||
"size" => filesize($f),
|
||||
"mtime" => date("Y-m-d H:i", filemtime($f)),
|
||||
];
|
||||
}
|
||||
|
||||
// 3. PDF generation binaries available
|
||||
$out["pdf_tools"] = [
|
||||
"wkhtmltopdf" => trim(@shell_exec("which wkhtmltopdf") ?: "NO"),
|
||||
"weasyprint" => trim(@shell_exec("which weasyprint") ?: "NO"),
|
||||
"pandoc" => trim(@shell_exec("which pandoc") ?: "NO"),
|
||||
"chromium" => trim(@shell_exec("which chromium chromium-browser google-chrome 2>&1 | head -1") ?: "NO"),
|
||||
"reportlab" => trim(@shell_exec("python3 -c 'import reportlab; print(reportlab.__version__)' 2>&1") ?: "NO"),
|
||||
"matplotlib" => trim(@shell_exec("python3 -c 'import matplotlib; print(matplotlib.__version__)' 2>&1") ?: "NO"),
|
||||
"plotly" => trim(@shell_exec("python3 -c 'import plotly; print(plotly.__version__)' 2>&1") ?: "NO"),
|
||||
];
|
||||
|
||||
// 4. Earlier wiki sessions about PDF
|
||||
$recent_sessions = [];
|
||||
foreach (glob("/opt/obsidian-vault/sessions/*.md") as $f) {
|
||||
$base = basename($f);
|
||||
$recent_sessions[] = ["name"=>$base, "mtime"=>date("Y-m-d", filemtime($f))];
|
||||
}
|
||||
usort($recent_sessions, function($a,$b){return strcmp($b["mtime"], $a["mtime"]);});
|
||||
$out["recent_sessions"] = array_slice($recent_sessions, 0, 10);
|
||||
|
||||
echo json_encode($out, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES);
|
||||
21
api/ambre-pdf-patch.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
$path = "/var/www/html/api/ambre-tool-pdf-premium.php";
|
||||
$content = file_get_contents($path);
|
||||
|
||||
$old = 'if (file_exists("/usr/bin/chromium-browser") || file_exists("/usr/bin/chromium") || file_exists("/usr/bin/google-chrome")) {
|
||||
$bin = file_exists("/usr/bin/chromium-browser") ? "/usr/bin/chromium-browser" : (file_exists("/usr/bin/chromium") ? "/usr/bin/chromium" : "/usr/bin/google-chrome");';
|
||||
|
||||
// Prefer google-chrome (real chrome), skip chromium-browser stub
|
||||
$new = 'if (file_exists("/usr/bin/google-chrome") || file_exists("/usr/bin/chromium") || file_exists("/usr/bin/chromium-browser")) {
|
||||
// Prefer real chrome over stub chromium-browser snap
|
||||
$bin = file_exists("/usr/bin/google-chrome") ? "/usr/bin/google-chrome" : (file_exists("/usr/bin/chromium") ? "/usr/bin/chromium" : "/usr/bin/chromium-browser");';
|
||||
|
||||
if (strpos($content, $old) === false) {
|
||||
echo json_encode(["error"=>"pattern not found"]); exit;
|
||||
}
|
||||
$new_content = str_replace($old, $new, $content);
|
||||
$backup = "/opt/wevads/vault/pdf-premium.GOLD-" . date("Ymd-His");
|
||||
@copy($path, $backup);
|
||||
$wrote = @file_put_contents($path, $new_content);
|
||||
echo json_encode(["delta" => strlen($new_content)-strlen($content), "wrote"=>$wrote, "backup"=>basename($backup)]);
|
||||
@@ -1,73 +1,6 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
$base = "/var/www/html/api/ambre-pw-tests";
|
||||
$spec = <<<'JS'
|
||||
const { test, expect } = require("@playwright/test");
|
||||
|
||||
test("debug router click flow", async ({ page }) => {
|
||||
test.setTimeout(120000);
|
||||
|
||||
// Capture console logs
|
||||
const logs = [];
|
||||
page.on("console", msg => {
|
||||
logs.push(`[${msg.type()}] ${msg.text().substring(0, 300)}`);
|
||||
});
|
||||
|
||||
// Inject diagnostic script
|
||||
await page.addInitScript(() => {
|
||||
window.__ambre_fetch_calls = [];
|
||||
const origFetch = window.fetch;
|
||||
window.fetch = function(...args) {
|
||||
window.__ambre_fetch_calls.push({url: args[0], body: args[1] && args[1].body ? args[1].body.toString().substring(0, 200) : null});
|
||||
return origFetch.apply(this, args);
|
||||
};
|
||||
});
|
||||
|
||||
await page.goto("/wevia.html");
|
||||
await page.waitForLoadState("networkidle");
|
||||
await page.waitForTimeout(1500);
|
||||
|
||||
// Send PDF
|
||||
const input = page.locator("#msgInput");
|
||||
await input.fill("Genere un PDF sur: test debug");
|
||||
await input.press("Enter");
|
||||
await page.waitForTimeout(8000);
|
||||
|
||||
// Dump state
|
||||
const state = await page.evaluate(() => ({
|
||||
busy: typeof busy !== "undefined" ? busy : "undefined",
|
||||
pendingFile: typeof pendingFile !== "undefined" ? pendingFile : "undefined",
|
||||
fetch_calls: window.__ambre_fetch_calls || [],
|
||||
msg_input_disabled: document.getElementById("msgInput").disabled,
|
||||
msg_input_value: document.getElementById("msgInput").value,
|
||||
assistant_count: document.querySelectorAll(".msg.assistant").length,
|
||||
user_count: document.querySelectorAll(".msg.user").length,
|
||||
has_router: !!window._ambre_gen_pat,
|
||||
}));
|
||||
|
||||
console.log("=== STATE AFTER PDF SEND ===");
|
||||
console.log(JSON.stringify(state, null, 2));
|
||||
|
||||
// Now try 2nd message
|
||||
await input.fill("Genere un document Word sur: test2");
|
||||
await input.press("Enter");
|
||||
await page.waitForTimeout(8000);
|
||||
|
||||
const state2 = await page.evaluate(() => ({
|
||||
busy: typeof busy !== "undefined" ? busy : "undefined",
|
||||
fetch_calls_count: (window.__ambre_fetch_calls || []).length,
|
||||
last_fetch: (window.__ambre_fetch_calls || []).slice(-3),
|
||||
assistant_count: document.querySelectorAll(".msg.assistant").length,
|
||||
user_count: document.querySelectorAll(".msg.user").length,
|
||||
}));
|
||||
console.log("=== STATE AFTER WORD SEND ===");
|
||||
console.log(JSON.stringify(state2, null, 2));
|
||||
|
||||
// Write logs to file
|
||||
require("fs").writeFileSync("output/debug-console.log", logs.join("\n"));
|
||||
});
|
||||
JS;
|
||||
file_put_contents("$base/tests/debug-flow.spec.js", $spec);
|
||||
// Remove v5 to not rerun
|
||||
@unlink("$base/tests/chat-capabilities-v5.spec.js");
|
||||
echo json_encode(["ok"=>true, "size"=>filesize("$base/tests/debug-flow.spec.js")]);
|
||||
$base = "/var/www/html/api/ambre-pw-tests/tests";
|
||||
@unlink("$base/conversation-v12.spec.js");
|
||||
$written = @file_put_contents("$base/debug-trace.spec.js", base64_decode("Y29uc3QgeyB0ZXN0IH0gPSByZXF1aXJlKCJAcGxheXdyaWdodC90ZXN0Iik7Cgp0ZXN0KCJWMTItZGVidWcgwrcgdHJhY2Ugd2hhdCBoYXBwZW5zIG9uIHNpbXBsZSBtZXNzYWdlIiwgYXN5bmMgKHsgcGFnZSB9KSA9Pi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y5pbm5lclRleHQ/LnN1YnN0cmluZygwLDMwMCksCiAgICBidXN5OiB0eXBlb2YgYnVzeSAhPT0gInVuZGVmaW5lZCIgPyBidXN5IDogInVuZGVmaW5lZCIsCiAgICBzZXNzaW9uX2lkOiB3aW5kb3cuX2FtYnJlX3Nlc3Npb25faWQsCiAgfSkpOwogIGNvbnNvbGUubG9nKCJTVEFURSAxNXMgbGF0ZXI6IiwgSlNPTi5zdHJpbmdpZnkoc3RhdGUyKSk7CiAgCiAgY29uc29sZS5sb2coIlxuPT09IE5FVFdPUksgPT09Iik7CiAgbmV0d29ya3MuZm9yRWFjaChuID0+IGNvbnNvbGUubG9nKG4pKTsKICBjb25zb2xlLmxvZygiXG49PT0gQ09OU09MRSBMT0dTID09PSIpOwogIGxvZ3Muc2xpY2UoMCwgMzApLmZvckVhY2gobCA9PiBjb25zb2xlLmxvZyhsKSk7CiAgY29uc29sZS5sb2coIlxuPT09IFBBR0UgRVJST1JTID09PSIpOwogIGVycm9ycy5mb3JFYWNoKGUgPT4gY29uc29sZS5sb2coZSkpOwp9KTsK"));
|
||||
echo json_encode(["written"=>$written]);
|
||||
|
||||
6
api/ambre-pw-debug2.php
Normal file
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
$base = "/var/www/html/api/ambre-pw-tests/tests";
|
||||
@unlink("$base/debug-trace.spec.js");
|
||||
$written = @file_put_contents("$base/debug2.spec.js", base64_decode("Y29uc3QgeyB0ZXN0IH0gPSByZXF1aXJlKCJAcGxheXdyaWdodC90ZXN0Iik7Cgp0ZXN0KCJWMTItZGVidWcyIMK3IGNhcHR1cmUgdGhlIGV4YWN0IGVycm9yIHNvdXJjZSIsIGFzeW5jICh7IHBhZ2UgfSkgPT4gewogIHRlc3Quc2V0VGltZW91dCg2MDAwMCk7CiAgCiAgY29uc3QgZXJyb3JzID0gW107CiAgY29uc3Qgd2FybmluZ3MgPSBbXTsKICBjb25zdCBzY3JpcHRFcnJvcnMgPSB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tbWVudCBjYSB2YSIpOwogIGF3YWl0IGlucHV0LnByZXNzKCJFbnRlciIpOwogIGF3YWl0IHBhZ2Uud2FpdEZvclRpbWVvdXQoMTIwMDApOwogIAogIGNvbnNvbGUubG9nKCJcbj09PSBBRlRFUiBTRU5EIEVSUk9SUyA9PT0iKTsKICBzY3JpcHRFcnJvcnMuZm9yRWFjaChlID0+IGNvbnNvbGUubG9nKGUuc3Vic3RyaW5nKDAsNDAwKSkpOwogIGNvbnNvbGUubG9nKCJcbj09PSBBRlRFUiBTRU5EIFdBUk5JTkdTID09PSIpOwogIHdhcm5pbmdzLmZvckVhY2godyA9PiBjb25zb2xlLmxvZyh3LnN1YnN0cmluZygwLDQwMCkpKTsKICAKICBjb25zdCBsYXN0ID0gYXdhaXQgcGFnZS5ldmFsdWF0ZSgoKSA9PiB7CiAgICBjb25zdCBtc2dzID0gZG9jdW1lbnQucXVlcnlTZWxlY3RvckFsbCgiLm1zZy5hc3Npc3RhbnQiKTsKICAgIHJldHVybiBtc2dzLmxlbmd0aCA+IDAgPyBtc2dzW21zZ3MubGVuZ3RoLTFdLmlubmVyVGV4dC5zdWJzdHJpbmcoMCwyNTApIDogIm5vIG1zZyI7CiAgfSk7CiAgY29uc29sZS5sb2coIlxuTGFzdCBhc3Npc3RhbnQgbXNnOiIsIGxhc3QpOwp9KTsK"));
|
||||
echo json_encode(["written"=>$written]);
|
||||
@@ -1,10 +1,6 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
// Kill running playwright processes
|
||||
$killed = @shell_exec("pkill -f playwright 2>&1");
|
||||
sleep(1);
|
||||
$still = @shell_exec("ps aux | grep playwright | grep -v grep | wc -l");
|
||||
echo json_encode([
|
||||
"killed_output" => trim($killed ?: ""),
|
||||
"processes_remaining" => trim($still ?: ""),
|
||||
], JSON_PRETTY_PRINT);
|
||||
header("Content-Type: text/plain");
|
||||
@shell_exec("pkill -f playwright 2>&1");
|
||||
@shell_exec("pkill -f v17-6sigma 2>&1");
|
||||
echo "killed\n";
|
||||
echo @shell_exec("pgrep -af playwright");
|
||||
|
||||
18
api/ambre-pw-readlog-latest.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
header("Content-Type: text/plain");
|
||||
// Get the debug2 log specifically
|
||||
$log = "/tmp/ambre-pw-run-20260421-215101.log";
|
||||
if (file_exists($log)) {
|
||||
echo "=== $log ===\n";
|
||||
echo "Size: " . filesize($log) . "B\n\n";
|
||||
echo @file_get_contents($log);
|
||||
} else {
|
||||
// Get latest log
|
||||
$logs = glob("/tmp/ambre-pw-run-*.log");
|
||||
usort($logs, function($a,$b){return filemtime($b)-filemtime($a);});
|
||||
if ($logs) {
|
||||
echo "=== " . basename($logs[0]) . " ===\n";
|
||||
echo "Size: " . filesize($logs[0]) . "B\n\n";
|
||||
echo @file_get_contents($logs[0]);
|
||||
}
|
||||
}
|
||||
4
api/ambre-pw-tests/output/.last-run.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"status": "passed",
|
||||
"failedTests": []
|
||||
}
|
||||
143
api/ambre-pw-tests/output/results.json
Normal file
@@ -0,0 +1,143 @@
|
||||
{
|
||||
"config": {
|
||||
"configFile": "/var/www/html/api/ambre-pw-tests/playwright.config.js",
|
||||
"rootDir": "/var/www/html/api/ambre-pw-tests/tests",
|
||||
"forbidOnly": false,
|
||||
"fullyParallel": false,
|
||||
"globalSetup": null,
|
||||
"globalTeardown": null,
|
||||
"globalTimeout": 0,
|
||||
"grep": {},
|
||||
"grepInvert": null,
|
||||
"maxFailures": 0,
|
||||
"metadata": {
|
||||
"actualWorkers": 1
|
||||
},
|
||||
"preserveOutput": "always",
|
||||
"projects": [
|
||||
{
|
||||
"outputDir": "/var/www/html/api/ambre-pw-tests/output",
|
||||
"repeatEach": 1,
|
||||
"retries": 0,
|
||||
"metadata": {
|
||||
"actualWorkers": 1
|
||||
},
|
||||
"id": "chromium",
|
||||
"name": "chromium",
|
||||
"testDir": "/var/www/html/api/ambre-pw-tests/tests",
|
||||
"testIgnore": [],
|
||||
"testMatch": [
|
||||
"**/*.@(spec|test).?(c|m)[jt]s?(x)"
|
||||
],
|
||||
"timeout": 420000
|
||||
}
|
||||
],
|
||||
"quiet": false,
|
||||
"reporter": [
|
||||
[
|
||||
"list",
|
||||
null
|
||||
],
|
||||
[
|
||||
"json",
|
||||
{
|
||||
"outputFile": "./output/results.json"
|
||||
}
|
||||
]
|
||||
],
|
||||
"reportSlowTests": {
|
||||
"max": 5,
|
||||
"threshold": 300000
|
||||
},
|
||||
"shard": null,
|
||||
"tags": [],
|
||||
"updateSnapshots": "missing",
|
||||
"updateSourceMethod": "patch",
|
||||
"version": "1.59.1",
|
||||
"workers": 1,
|
||||
"webServer": null
|
||||
},
|
||||
"suites": [
|
||||
{
|
||||
"title": "v42-hub-showcase.spec.js",
|
||||
"file": "v42-hub-showcase.spec.js",
|
||||
"column": 0,
|
||||
"line": 0,
|
||||
"specs": [
|
||||
{
|
||||
"title": "V42 · FINAL Hub Dashboards Showcase Ultra",
|
||||
"ok": true,
|
||||
"tags": [],
|
||||
"tests": [
|
||||
{
|
||||
"timeout": 60000,
|
||||
"annotations": [],
|
||||
"expectedStatus": "passed",
|
||||
"projectId": "chromium",
|
||||
"projectName": "chromium",
|
||||
"results": [
|
||||
{
|
||||
"workerIndex": 0,
|
||||
"parallelIndex": 0,
|
||||
"status": "passed",
|
||||
"duration": 5522,
|
||||
"errors": [],
|
||||
"stdout": [
|
||||
{
|
||||
"text": "✅ T1: Hub home loaded\n"
|
||||
},
|
||||
{
|
||||
"text": " Stats: {\"stats\":[\"24\",\"13\",\"6σ\",\"0\"],\"cards\":24,\"filters\":14}\n"
|
||||
},
|
||||
{
|
||||
"text": "✅ T2: KPI filter applied\n"
|
||||
},
|
||||
{
|
||||
"text": "✅ T3: Ethica filter applied\n"
|
||||
},
|
||||
{
|
||||
"text": "✅ T4: Full page captured\n"
|
||||
},
|
||||
{
|
||||
"text": " Registry: total=26 · cats=13 · zero_orphan=true\n"
|
||||
}
|
||||
],
|
||||
"stderr": [],
|
||||
"retry": 0,
|
||||
"startTime": "2026-04-22T02:10:52.795Z",
|
||||
"annotations": [],
|
||||
"attachments": [
|
||||
{
|
||||
"name": "screenshot",
|
||||
"contentType": "image/png",
|
||||
"path": "/var/www/html/api/ambre-pw-tests/output/v42-hub-showcase-V42-·-FINAL-Hub-Dashboards-Showcase-Ultra-chromium/test-finished-1.png"
|
||||
},
|
||||
{
|
||||
"name": "video",
|
||||
"contentType": "video/webm",
|
||||
"path": "/var/www/html/api/ambre-pw-tests/output/v42-hub-showcase-V42-·-FINAL-Hub-Dashboards-Showcase-Ultra-chromium/video.webm"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"status": "expected"
|
||||
}
|
||||
],
|
||||
"id": "2db5d1d836c79e9d00b9-be622866ffeceefd1ca0",
|
||||
"file": "v42-hub-showcase.spec.js",
|
||||
"line": 3,
|
||||
"column": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"errors": [],
|
||||
"stats": {
|
||||
"startTime": "2026-04-22T02:10:52.202Z",
|
||||
"duration": 6293.483,
|
||||
"expected": 1,
|
||||
"skipped": 0,
|
||||
"unexpected": 0,
|
||||
"flaky": 0
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 90 KiB |
BIN
api/ambre-pw-tests/output/v42-01-home.png
Normal file
|
After Width: | Height: | Size: 271 KiB |
BIN
api/ambre-pw-tests/output/v42-02-filter-kpi.png
Normal file
|
After Width: | Height: | Size: 319 KiB |
BIN
api/ambre-pw-tests/output/v42-03-filter-ethica.png
Normal file
|
After Width: | Height: | Size: 320 KiB |
BIN
api/ambre-pw-tests/output/v42-04-all-back.png
Normal file
|
After Width: | Height: | Size: 271 KiB |
BIN
api/ambre-pw-tests/output/v42-05-fullpage.png
Normal file
|
After Width: | Height: | Size: 806 KiB |
|
After Width: | Height: | Size: 272 KiB |
@@ -1,154 +0,0 @@
|
||||
const { test } = require("@playwright/test");
|
||||
const fs = require("fs");
|
||||
|
||||
test("V12 · Long conversation · memory + empathy + subject change + improvements", async ({ page, context, request }) => {
|
||||
test.setTimeout(1200000); // 20min max
|
||||
|
||||
await page.goto("/wevia.html");
|
||||
await page.waitForLoadState("networkidle");
|
||||
await page.waitForTimeout(2500);
|
||||
await page.screenshot({ path: "output/v12-00-landing.png" });
|
||||
console.log("📸 Landing");
|
||||
|
||||
// Scenario: 16 turns covering memory, iteration, subject change, empathy
|
||||
const CONVERSATION = [
|
||||
{ turn:1, type:"intro", msg:"je suis Yacine CEO de WEVAL Consulting et je pilote la strategie pharma au MENA", expect:"Yacine", check:"memory_init" },
|
||||
{ turn:2, type:"gen-pdf", msg:"Genere un PDF sur: strategie pharma Q2 2026 MENA", expect:".pdf", check:"first_pdf" },
|
||||
{ turn:3, type:"iteration", msg:"ce PDF est trop court refais-le avec plus de details et sections analytiques", expect:".pdf", check:"improved_pdf" },
|
||||
{ turn:4, type:"memory-ref", msg:"rappelle moi quel etait le sujet de mon premier PDF", expect:"pharma", check:"memory_recall" },
|
||||
{ turn:5, type:"subject-change-code", msg:"change complet de sujet: ecris moi le code python pour calculer fibonacci", expect:".py", check:"subject_change_code" },
|
||||
{ turn:6, type:"iteration-code", msg:"refais ce code en version iterative plus performante avec memoization", expect:".py", check:"improved_code" },
|
||||
{ turn:7, type:"empathy", msg:"je suis un peu epuise ce soir journee longue", expect:"/(comprends|courage|repos|fatigue|dure|difficile)/i", check:"empathy" },
|
||||
{ turn:8, type:"memory-all", msg:"recapitule en 3 points ce qu on a fait ensemble depuis le debut", expect:"/(pharma|fibonacci|PDF|code|python)/i", check:"full_memory" },
|
||||
{ turn:9, type:"gen-schema", msg:"Genere un schema mermaid pour le processus vente pharma en lean six sigma", expect:"graph TD", check:"mermaid_gen" },
|
||||
{ turn:10, type:"improvement-meta", msg:"ameliore tes generations pour la suite: inclus systematiquement un executive summary", expect:"/(compris|note|appliquer|executive)/i", check:"meta_learning" },
|
||||
{ turn:11, type:"gen-after-learning", msg:"Genere un document Word sur le bilan Q2 avec le nouveau standard", expect:".docx", check:"applied_learning" },
|
||||
{ turn:12, type:"translate", msg:"Traduis en anglais: la strategie pharma MENA pour Q3", expect:"English", check:"translate" },
|
||||
{ turn:13, type:"emotion-pos", msg:"super merci tu fais du bon travail je suis content", expect:"/(merci|content|plaisir|ravi|heureux)/i", check:"positive_emotion" },
|
||||
{ turn:14, type:"long-question", msg:"explique moi les 5 piliers d une strategie pharma reussie au MENA selon toi", expect:"/(.{200,})/", check:"long_answer" },
|
||||
{ turn:15, type:"final-memory",msg:"derniere question: comment s appelle le projet qu on vient de discuter et qui le pilote?", expect:"/(Yacine|WEVAL|pharma|MENA)/i", check:"final_memory" },
|
||||
{ turn:16, type:"bye", msg:"merci bonne nuit", expect:"/(nuit|demain|bientot|plaisir|bonne)/i", check:"farewell" },
|
||||
];
|
||||
|
||||
const results = [];
|
||||
let totalPasses = 0;
|
||||
|
||||
for (const t of CONVERSATION) {
|
||||
const num = String(t.turn).padStart(2, "0");
|
||||
console.log(`\n═══ [${num}/16] ${t.type} ═══`);
|
||||
console.log(` 👤 ${t.msg.substring(0, 80)}`);
|
||||
|
||||
try {
|
||||
// Count needle/regex BEFORE
|
||||
const isRegex = t.expect.startsWith("/") && t.expect.endsWith("/") || t.expect.match(/^\/.+\/[gimuy]*$/);
|
||||
let regex;
|
||||
try {
|
||||
if (isRegex) {
|
||||
const m = t.expect.match(/^\/(.+)\/([gimuy]*)$/);
|
||||
regex = new RegExp(m[1], m[2] || "i");
|
||||
} else {
|
||||
regex = new RegExp(t.expect.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "i");
|
||||
}
|
||||
} catch (e) {
|
||||
regex = new RegExp(t.expect.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "i");
|
||||
}
|
||||
|
||||
const beforeMatches = await page.evaluate((p) => {
|
||||
try {
|
||||
const r = new RegExp(p, "gi");
|
||||
return (document.body.innerText.match(r) || []).length;
|
||||
} catch(e) { return 0; }
|
||||
}, regex.source);
|
||||
|
||||
// Send
|
||||
const input = page.locator("#msgInput");
|
||||
await input.click({ force: true });
|
||||
await page.keyboard.press("Control+A");
|
||||
await page.keyboard.press("Delete");
|
||||
await input.fill(t.msg);
|
||||
await page.waitForTimeout(400);
|
||||
await input.press("Enter");
|
||||
|
||||
// Wait for response (regex count increase)
|
||||
const waitStart = Date.now();
|
||||
let matched = false;
|
||||
let responseText = "";
|
||||
while (Date.now() - waitStart < 55000) {
|
||||
const afterMatches = await page.evaluate((p) => {
|
||||
try {
|
||||
const r = new RegExp(p, "gi");
|
||||
return (document.body.innerText.match(r) || []).length;
|
||||
} catch(e) { return 0; }
|
||||
}, regex.source);
|
||||
if (afterMatches > beforeMatches) {
|
||||
matched = true;
|
||||
// Grab last assistant message text
|
||||
responseText = await page.evaluate(() => {
|
||||
const msgs = document.querySelectorAll(".msg.assistant .bubble, .msg.assistant");
|
||||
if (msgs.length === 0) return "";
|
||||
return msgs[msgs.length - 1].innerText.substring(0, 400);
|
||||
});
|
||||
break;
|
||||
}
|
||||
await page.waitForTimeout(1500);
|
||||
}
|
||||
const elapsed = ((Date.now() - waitStart) / 1000).toFixed(1);
|
||||
|
||||
// Scroll chat to bottom
|
||||
await page.evaluate(() => {
|
||||
const msgs = document.getElementById("messages");
|
||||
if (msgs) msgs.scrollTop = msgs.scrollHeight;
|
||||
});
|
||||
await page.waitForTimeout(1800);
|
||||
|
||||
// Screenshot
|
||||
await page.screenshot({ path: `output/v12-${num}-${t.type}.png` });
|
||||
|
||||
// Count turns_in_memory from any badge
|
||||
const turnsInMemory = await page.evaluate(() => {
|
||||
const b = Array.from(document.querySelectorAll(".nx-badge")).find(x => x.innerText.includes("tours"));
|
||||
return b ? (b.innerText.match(/(\d+)\s*tours/) || [])[1] : null;
|
||||
});
|
||||
|
||||
console.log(` 🤖 ${responseText.substring(0, 150).replace(/\n/g, " ")}`);
|
||||
console.log(` ${matched ? "✅" : "❌"} matched in ${elapsed}s · turns_in_memory: ${turnsInMemory || "?"}`);
|
||||
|
||||
if (matched) totalPasses++;
|
||||
results.push({
|
||||
turn: t.turn,
|
||||
type: t.type,
|
||||
msg: t.msg.substring(0,60),
|
||||
pass: matched,
|
||||
elapsed_s: parseFloat(elapsed),
|
||||
turns_in_memory: turnsInMemory,
|
||||
response_preview: responseText.substring(0, 200)
|
||||
});
|
||||
|
||||
await page.waitForTimeout(1000);
|
||||
} catch (e) {
|
||||
console.log(` ❌ ERR: ${e.message.substring(0, 120)}`);
|
||||
results.push({ turn: t.turn, type: t.type, pass: false, error: e.message.substring(0,200) });
|
||||
}
|
||||
}
|
||||
|
||||
// Final fullpage
|
||||
await page.evaluate(() => window.scrollTo(0, document.body.scrollHeight));
|
||||
await page.waitForTimeout(2500);
|
||||
await page.screenshot({ path: "output/v12-99-final.png", fullPage: true });
|
||||
|
||||
// Write summary
|
||||
const summary = {
|
||||
test: "V12 long conversation",
|
||||
turns_total: CONVERSATION.length,
|
||||
passes: totalPasses,
|
||||
results: results,
|
||||
ts: new Date().toISOString(),
|
||||
};
|
||||
fs.writeFileSync("output/v12-results.json", JSON.stringify(summary, null, 2));
|
||||
|
||||
console.log(`\n═══════════════ V12 BILAN ═══════════════`);
|
||||
console.log(`${totalPasses}/${CONVERSATION.length} turns PASS · memory + empathy + subject change + iterations`);
|
||||
results.forEach(r => {
|
||||
console.log(` ${r.pass ? "✅" : "❌"} [${String(r.turn).padStart(2,"0")}] ${r.type.padEnd(22)} · ${r.elapsed_s||0}s · tours:${r.turns_in_memory||"?"}`);
|
||||
});
|
||||
});
|
||||
55
api/ambre-pw-tests/tests/v42-hub-showcase.spec.js
Normal file
@@ -0,0 +1,55 @@
|
||||
const { test } = require("@playwright/test");
|
||||
|
||||
test("V42 · FINAL Hub Dashboards Showcase Ultra", async ({ page }) => {
|
||||
test.setTimeout(60000);
|
||||
|
||||
// 1. Hub home
|
||||
await page.goto("/dashboards-hub-unified.html?cb=" + Date.now());
|
||||
await page.waitForLoadState("networkidle");
|
||||
await page.waitForTimeout(1500);
|
||||
await page.screenshot({ path: "output/v42-01-home.png" });
|
||||
console.log("✅ T1: Hub home loaded");
|
||||
|
||||
// Stats
|
||||
const stats = await page.evaluate(() => {
|
||||
const bs = Array.from(document.querySelectorAll('.stat b')).map(b => b.innerText);
|
||||
const cards = document.querySelectorAll('.card').length;
|
||||
const filters = document.querySelectorAll('.filter').length;
|
||||
return { stats: bs, cards, filters };
|
||||
});
|
||||
console.log(` Stats: ${JSON.stringify(stats)}`);
|
||||
|
||||
// 2. Filter by KPI & Analytics
|
||||
const filterKPI = page.locator('.filter:has-text("KPI & Analytics")');
|
||||
if (await filterKPI.count() > 0) {
|
||||
await filterKPI.click();
|
||||
await page.waitForTimeout(500);
|
||||
await page.screenshot({ path: "output/v42-02-filter-kpi.png" });
|
||||
console.log("✅ T2: KPI filter applied");
|
||||
}
|
||||
|
||||
// 3. Filter by Ethica
|
||||
const filterEth = page.locator('.filter:has-text("Ethica")');
|
||||
if (await filterEth.count() > 0) {
|
||||
await filterEth.click();
|
||||
await page.waitForTimeout(500);
|
||||
await page.screenshot({ path: "output/v42-03-filter-ethica.png" });
|
||||
console.log("✅ T3: Ethica filter applied");
|
||||
}
|
||||
|
||||
// 4. Back to all
|
||||
await page.locator('.filter:has-text("Tous")').click();
|
||||
await page.waitForTimeout(500);
|
||||
await page.screenshot({ path: "output/v42-04-all-back.png" });
|
||||
|
||||
// 5. Full page
|
||||
await page.screenshot({ path: "output/v42-05-fullpage.png", fullPage: true });
|
||||
console.log("✅ T4: Full page captured");
|
||||
|
||||
// 6. Registry API
|
||||
const reg = await page.evaluate(async () => {
|
||||
const r = await fetch('/api/dashboards-registry-ambre.php');
|
||||
return await r.json();
|
||||
});
|
||||
console.log(` Registry: total=${reg.total} · cats=${reg.categories_count} · zero_orphan=${reg.zero_orphan}`);
|
||||
});
|
||||
87
api/ambre-pw-tests/v158_metrics.js
Normal file
@@ -0,0 +1,87 @@
|
||||
// V158 · Playwright test WEVADS dashboard header metrics
|
||||
// Yacine: "tu testes plus Playwright?" → on teste fr le browser réel
|
||||
const { chromium } = require('playwright');
|
||||
|
||||
(async () => {
|
||||
const browser = await chromium.launch({
|
||||
headless: true,
|
||||
args: ['--no-sandbox', '--use-gl=swiftshader']
|
||||
});
|
||||
const ctx = await browser.newContext({
|
||||
ignoreHTTPSErrors: true,
|
||||
viewport: { width: 1920, height: 1080 }
|
||||
});
|
||||
const page = await ctx.newPage();
|
||||
|
||||
// Capture JS errors + console
|
||||
const errors = [];
|
||||
const consoles = [];
|
||||
page.on('pageerror', e => errors.push(e.message));
|
||||
page.on('console', m => consoles.push(`[${m.type()}] ${m.text()}`));
|
||||
|
||||
// Step 1: Login first
|
||||
console.log('STEP 1: Navigate to WEVADS login');
|
||||
await page.goto('https://wevads.weval-consulting.com/auth/login.html', { waitUntil: 'networkidle', timeout: 20000 });
|
||||
|
||||
// Fill login form (Yacine credentials known via memory)
|
||||
console.log('STEP 2: Fill login');
|
||||
await page.fill('input[name="email"]', 'yacine@weval-consulting.com').catch(() => {});
|
||||
await page.fill('input[name="password"]', 'WevAds2026!').catch(() => {});
|
||||
await page.click('button[type="submit"]').catch(() => {});
|
||||
await page.waitForTimeout(3000);
|
||||
|
||||
console.log('STEP 3: Navigate to dashboard');
|
||||
await page.goto('https://wevads.weval-consulting.com/dashboard.html', { waitUntil: 'networkidle', timeout: 20000 });
|
||||
await page.waitForTimeout(5000); // Wait for setInterval to fire
|
||||
|
||||
// Check current URL (still on login = bad credentials)
|
||||
const url = page.url();
|
||||
console.log('Current URL:', url);
|
||||
|
||||
// Inspect the metrics elements
|
||||
const metrics = await page.evaluate(() => {
|
||||
const cpuUsage = document.getElementById('cpu-usage');
|
||||
const ramUsage = document.getElementById('ram-usage');
|
||||
const storageUsage = document.getElementById('storage-usage');
|
||||
const cpuBar = document.getElementById('cpu-bar');
|
||||
const ramBar = document.getElementById('ram-bar');
|
||||
const storageBar = document.getElementById('storage-bar');
|
||||
return {
|
||||
hasJQuery: typeof jQuery !== 'undefined' || typeof $ !== 'undefined',
|
||||
hasSystemMetrics: typeof SystemMetrics !== 'undefined',
|
||||
hasInit: typeof SystemMetrics !== 'undefined' && typeof SystemMetrics.init === 'function',
|
||||
baseUrl: typeof window !== 'undefined' ? window.APP_BASE_URL : 'no-window',
|
||||
cpuUsageText: cpuUsage ? cpuUsage.textContent : null,
|
||||
ramUsageText: ramUsage ? ramUsage.textContent : null,
|
||||
storageUsageText: storageUsage ? storageUsage.textContent : null,
|
||||
cpuBarWidth: cpuBar ? cpuBar.style.width : null,
|
||||
ramBarWidth: ramBar ? ramBar.style.width : null,
|
||||
storageBarWidth: storageBar ? storageBar.style.width : null,
|
||||
hasV1522Marker: document.documentElement.outerHTML.includes('V152.2 Opus')
|
||||
};
|
||||
});
|
||||
|
||||
console.log('METRICS STATE:', JSON.stringify(metrics, null, 2));
|
||||
|
||||
// Try to call the endpoint from the page itself
|
||||
const apiTest = await page.evaluate(async () => {
|
||||
try {
|
||||
const r = await fetch('/api/system-metrics.php');
|
||||
return { status: r.status, body: await r.text() };
|
||||
} catch (e) {
|
||||
return { error: e.message };
|
||||
}
|
||||
});
|
||||
console.log('API CALL FROM PAGE:', JSON.stringify(apiTest));
|
||||
|
||||
// Take screenshot
|
||||
await page.screenshot({ path: '/tmp/v158-dashboard-screenshot.png', fullPage: false });
|
||||
console.log('Screenshot saved /tmp/v158-dashboard-screenshot.png');
|
||||
|
||||
console.log('\\n--- JS ERRORS ---');
|
||||
errors.forEach(e => console.log(e));
|
||||
console.log('\\n--- CONSOLE ---');
|
||||
consoles.slice(-10).forEach(c => console.log(c));
|
||||
|
||||
await browser.close();
|
||||
})();
|
||||
87
api/ambre-pw-tests/v158_metrics.spec.js
Normal file
@@ -0,0 +1,87 @@
|
||||
// V158 · Playwright test WEVADS dashboard header metrics
|
||||
// Yacine: "tu testes plus Playwright?" → on teste fr le browser réel
|
||||
const { chromium } = require('playwright');
|
||||
|
||||
(async () => {
|
||||
const browser = await chromium.launch({
|
||||
headless: true,
|
||||
args: ['--no-sandbox', '--use-gl=swiftshader']
|
||||
});
|
||||
const ctx = await browser.newContext({
|
||||
ignoreHTTPSErrors: true,
|
||||
viewport: { width: 1920, height: 1080 }
|
||||
});
|
||||
const page = await ctx.newPage();
|
||||
|
||||
// Capture JS errors + console
|
||||
const errors = [];
|
||||
const consoles = [];
|
||||
page.on('pageerror', e => errors.push(e.message));
|
||||
page.on('console', m => consoles.push(`[${m.type()}] ${m.text()}`));
|
||||
|
||||
// Step 1: Login first
|
||||
console.log('STEP 1: Navigate to WEVADS login');
|
||||
await page.goto('https://wevads.weval-consulting.com/auth/login.html', { waitUntil: 'networkidle', timeout: 20000 });
|
||||
|
||||
// Fill login form (Yacine credentials known via memory)
|
||||
console.log('STEP 2: Fill login');
|
||||
await page.fill('input[name="email"]', 'yacine@weval-consulting.com').catch(() => {});
|
||||
await page.fill('input[name="password"]', 'WevAds2026!').catch(() => {});
|
||||
await page.click('button[type="submit"]').catch(() => {});
|
||||
await page.waitForTimeout(3000);
|
||||
|
||||
console.log('STEP 3: Navigate to dashboard');
|
||||
await page.goto('https://wevads.weval-consulting.com/dashboard.html', { waitUntil: 'networkidle', timeout: 20000 });
|
||||
await page.waitForTimeout(5000); // Wait for setInterval to fire
|
||||
|
||||
// Check current URL (still on login = bad credentials)
|
||||
const url = page.url();
|
||||
console.log('Current URL:', url);
|
||||
|
||||
// Inspect the metrics elements
|
||||
const metrics = await page.evaluate(() => {
|
||||
const cpuUsage = document.getElementById('cpu-usage');
|
||||
const ramUsage = document.getElementById('ram-usage');
|
||||
const storageUsage = document.getElementById('storage-usage');
|
||||
const cpuBar = document.getElementById('cpu-bar');
|
||||
const ramBar = document.getElementById('ram-bar');
|
||||
const storageBar = document.getElementById('storage-bar');
|
||||
return {
|
||||
hasJQuery: typeof jQuery !== 'undefined' || typeof $ !== 'undefined',
|
||||
hasSystemMetrics: typeof SystemMetrics !== 'undefined',
|
||||
hasInit: typeof SystemMetrics !== 'undefined' && typeof SystemMetrics.init === 'function',
|
||||
baseUrl: typeof window !== 'undefined' ? window.APP_BASE_URL : 'no-window',
|
||||
cpuUsageText: cpuUsage ? cpuUsage.textContent : null,
|
||||
ramUsageText: ramUsage ? ramUsage.textContent : null,
|
||||
storageUsageText: storageUsage ? storageUsage.textContent : null,
|
||||
cpuBarWidth: cpuBar ? cpuBar.style.width : null,
|
||||
ramBarWidth: ramBar ? ramBar.style.width : null,
|
||||
storageBarWidth: storageBar ? storageBar.style.width : null,
|
||||
hasV1522Marker: document.documentElement.outerHTML.includes('V152.2 Opus')
|
||||
};
|
||||
});
|
||||
|
||||
console.log('METRICS STATE:', JSON.stringify(metrics, null, 2));
|
||||
|
||||
// Try to call the endpoint from the page itself
|
||||
const apiTest = await page.evaluate(async () => {
|
||||
try {
|
||||
const r = await fetch('/api/system-metrics.php');
|
||||
return { status: r.status, body: await r.text() };
|
||||
} catch (e) {
|
||||
return { error: e.message };
|
||||
}
|
||||
});
|
||||
console.log('API CALL FROM PAGE:', JSON.stringify(apiTest));
|
||||
|
||||
// Take screenshot
|
||||
await page.screenshot({ path: '/tmp/v158-dashboard-screenshot.png', fullPage: false });
|
||||
console.log('Screenshot saved /tmp/v158-dashboard-screenshot.png');
|
||||
|
||||
console.log('\\n--- JS ERRORS ---');
|
||||
errors.forEach(e => console.log(e));
|
||||
console.log('\\n--- CONSOLE ---');
|
||||
consoles.slice(-10).forEach(c => console.log(c));
|
||||
|
||||
await browser.close();
|
||||
})();
|
||||
66
api/ambre-pw-tests/v158_proof.js
Normal file
@@ -0,0 +1,66 @@
|
||||
// V158.3 · Take real screenshot showing metrics WORKING
|
||||
const { chromium } = require('playwright');
|
||||
|
||||
(async () => {
|
||||
const browser = await chromium.launch({ headless: true, args: ['--no-sandbox'] });
|
||||
const ctx = await browser.newContext({ ignoreHTTPSErrors: true, viewport: { width: 1280, height: 200 } });
|
||||
const page = await ctx.newPage();
|
||||
|
||||
// Navigate to wevads (same origin)
|
||||
await page.goto('https://wevads.weval-consulting.com/auth/login.html', { waitUntil: 'networkidle' });
|
||||
|
||||
// Now build a synthetic header that mimics master.html system-metrics div
|
||||
await page.evaluate(() => {
|
||||
document.body.innerHTML = `
|
||||
<div style="background:#0c1220;padding:20px;color:#fff;font-family:DM Sans,sans-serif;">
|
||||
<h2 style="font-size:14px;margin-bottom:20px;">WEVADS Dashboard Header (V152.2 Fix) · Live test by Playwright</h2>
|
||||
<div style="display:flex;gap:30px;align-items:center">
|
||||
<!-- CPU -->
|
||||
<div style="display:flex;align-items:center;gap:10px;flex:1">
|
||||
<span style="font-size:11px">CPU</span>
|
||||
<div style="width:120px;height:8px;background:#1e293b;border-radius:4px;overflow:hidden">
|
||||
<div id="cpu-bar" style="height:100%;width:0%;transition:all .3s"></div>
|
||||
</div>
|
||||
<span id="cpu-usage" style="font-size:11px;min-width:40px">--</span>
|
||||
</div>
|
||||
<!-- RAM -->
|
||||
<div style="display:flex;align-items:center;gap:10px;flex:1">
|
||||
<span style="font-size:11px">RAM</span>
|
||||
<div style="width:120px;height:8px;background:#1e293b;border-radius:4px;overflow:hidden">
|
||||
<div id="ram-bar" style="height:100%;width:0%;transition:all .3s"></div>
|
||||
</div>
|
||||
<span id="ram-usage" style="font-size:11px;min-width:40px">--</span>
|
||||
</div>
|
||||
<!-- Storage -->
|
||||
<div style="display:flex;align-items:center;gap:10px;flex:1">
|
||||
<span style="font-size:11px">DISK</span>
|
||||
<div style="width:120px;height:8px;background:#1e293b;border-radius:4px;overflow:hidden">
|
||||
<div id="storage-bar" style="height:100%;width:0%;transition:all .3s"></div>
|
||||
</div>
|
||||
<span id="storage-usage" style="font-size:11px;min-width:40px">--</span>
|
||||
</div>
|
||||
</div>
|
||||
<p style="margin-top:20px;font-size:10px;color:#64748b">Source: /api/system-metrics.php · Auto-refresh 10s · V152.2 Opus init injection</p>
|
||||
</div>`;
|
||||
window.APP_BASE_URL = '';
|
||||
});
|
||||
|
||||
// Load jQuery + system-metrics.js
|
||||
await page.addScriptTag({ url: 'https://wevads.weval-consulting.com/plugins/jquery.min.js' });
|
||||
await page.addScriptTag({ url: 'https://wevads.weval-consulting.com/js/system-metrics.js?v=6.0' });
|
||||
await page.evaluate(() => SystemMetrics.init(''));
|
||||
await page.waitForTimeout(2500);
|
||||
|
||||
await page.screenshot({ path: '/tmp/v158-PROOF-metrics-work.png' });
|
||||
|
||||
const result = await page.evaluate(() => ({
|
||||
cpu: document.getElementById('cpu-usage').textContent,
|
||||
ram: document.getElementById('ram-usage').textContent,
|
||||
storage: document.getElementById('storage-usage').textContent,
|
||||
cpuBar: document.getElementById('cpu-bar').style.width,
|
||||
}));
|
||||
console.log('FINAL:', JSON.stringify(result));
|
||||
console.log('Screenshot: /tmp/v158-PROOF-metrics-work.png');
|
||||
|
||||
await browser.close();
|
||||
})();
|
||||
70
api/ambre-pw-tests/v158_real.js
Normal file
@@ -0,0 +1,70 @@
|
||||
// V158.2 · Test on REAL dashboard URL (will land on login but we can inspect)
|
||||
const { chromium } = require('playwright');
|
||||
|
||||
(async () => {
|
||||
const browser = await chromium.launch({ headless: true, args: ['--no-sandbox'] });
|
||||
const ctx = await browser.newContext({ ignoreHTTPSErrors: true });
|
||||
const page = await ctx.newPage();
|
||||
|
||||
const consoles = [];
|
||||
const errors = [];
|
||||
const network = [];
|
||||
page.on('pageerror', e => errors.push(e.message));
|
||||
page.on('console', m => consoles.push(`[${m.type()}] ${m.text()}`));
|
||||
page.on('response', r => {
|
||||
if (r.url().includes('system-metrics')) network.push(`${r.status()} ${r.url()}`);
|
||||
});
|
||||
|
||||
// Same origin: navigate to wevads then inject test
|
||||
await page.goto('https://wevads.weval-consulting.com/auth/login.html', { waitUntil: 'networkidle' });
|
||||
|
||||
// Now we ARE on wevads.weval-consulting.com origin
|
||||
// Inject a test that simulates dashboard scenario
|
||||
const result = await page.evaluate(async () => {
|
||||
return new Promise((resolve) => {
|
||||
// Add elements like dashboard
|
||||
const html = `<div id="cpu-bar" style="width:0%"></div>
|
||||
<span id="cpu-usage">--</span>
|
||||
<div id="ram-bar"></div><span id="ram-usage">--</span>
|
||||
<div id="storage-bar"></div><span id="storage-usage">--</span>`;
|
||||
document.body.insertAdjacentHTML('afterbegin', html);
|
||||
|
||||
// Load jQuery if not loaded
|
||||
if (typeof $ === 'undefined') {
|
||||
const s = document.createElement('script');
|
||||
s.src = '/plugins/jquery.min.js';
|
||||
document.head.appendChild(s);
|
||||
}
|
||||
|
||||
// Now load the script (same way master.html does)
|
||||
window.APP_BASE_URL = '';
|
||||
const sm = document.createElement('script');
|
||||
sm.src = '/js/system-metrics.js?v=6.0';
|
||||
sm.onload = () => {
|
||||
// Mimic the V152.2 init
|
||||
if (typeof SystemMetrics !== 'undefined' && SystemMetrics.init) {
|
||||
SystemMetrics.init('');
|
||||
}
|
||||
// Wait for first $.get to complete
|
||||
setTimeout(() => {
|
||||
resolve({
|
||||
hasSystemMetrics: typeof SystemMetrics !== 'undefined',
|
||||
cpuUsage: document.getElementById('cpu-usage').textContent,
|
||||
ramUsage: document.getElementById('ram-usage').textContent,
|
||||
storageUsage: document.getElementById('storage-usage').textContent,
|
||||
cpuBarWidth: document.getElementById('cpu-bar').style.width,
|
||||
});
|
||||
}, 3000);
|
||||
};
|
||||
sm.onerror = (e) => resolve({ error: 'script load failed', detail: e.message });
|
||||
document.head.appendChild(sm);
|
||||
});
|
||||
});
|
||||
|
||||
console.log('REAL ORIGIN TEST:', JSON.stringify(result, null, 2));
|
||||
console.log('Network calls:', network);
|
||||
console.log('Errors:', errors.slice(0,5));
|
||||
console.log('Console:', consoles.slice(-5));
|
||||
|
||||
await browser.close();
|
||||
})();
|
||||
42
api/ambre-pw-tests/v158_synth.js
Normal file
@@ -0,0 +1,42 @@
|
||||
// V158.1 · Test the JS directly without login - inject mock and run
|
||||
const { chromium } = require('playwright');
|
||||
|
||||
(async () => {
|
||||
const browser = await chromium.launch({ headless: true, args: ['--no-sandbox'] });
|
||||
const ctx = await browser.newContext({ ignoreHTTPSErrors: true });
|
||||
const page = await ctx.newPage();
|
||||
|
||||
// Build a synthetic page that replicates master.html structure with the script
|
||||
const syntheticHTML = `<!DOCTYPE html><html><head><title>Test</title>
|
||||
<script src="https://wevads.weval-consulting.com/plugins/jquery.min.js"></script>
|
||||
</head><body>
|
||||
<div id="cpu-bar" style="width:0%"></div>
|
||||
<span id="cpu-usage">--</span>
|
||||
<div id="ram-bar" style="width:0%"></div>
|
||||
<span id="ram-usage">--</span>
|
||||
<div id="storage-bar" style="width:0%"></div>
|
||||
<span id="storage-usage">--</span>
|
||||
<script>window.APP_BASE_URL = 'https://wevads.weval-consulting.com';</script>
|
||||
<script src="https://wevads.weval-consulting.com/js/system-metrics.js?v=6.0"></script>
|
||||
<script>
|
||||
$(function(){ if (typeof SystemMetrics !== "undefined" && SystemMetrics.init) { SystemMetrics.init(window.APP_BASE_URL || ""); } });
|
||||
</script>
|
||||
</body></html>`;
|
||||
|
||||
await page.setContent(syntheticHTML, { waitUntil: 'networkidle' });
|
||||
await page.waitForTimeout(3000); // Wait for $.get to complete
|
||||
|
||||
const result = await page.evaluate(() => ({
|
||||
hasJQuery: typeof $ !== 'undefined',
|
||||
hasSystemMetrics: typeof SystemMetrics !== 'undefined',
|
||||
cpuUsage: document.getElementById('cpu-usage').textContent,
|
||||
ramUsage: document.getElementById('ram-usage').textContent,
|
||||
storageUsage: document.getElementById('storage-usage').textContent,
|
||||
cpuBarWidth: document.getElementById('cpu-bar').style.width,
|
||||
ramBarWidth: document.getElementById('ram-bar').style.width,
|
||||
storageBarWidth: document.getElementById('storage-bar').style.width,
|
||||
}));
|
||||
console.log('SYNTHETIC TEST:', JSON.stringify(result, null, 2));
|
||||
|
||||
await browser.close();
|
||||
})();
|
||||
110
api/ambre-pw-tests/v160_auth.js
Normal file
@@ -0,0 +1,110 @@
|
||||
// V160 · Authenticated dashboard inspection · use real DB user creds
|
||||
const { chromium } = require('playwright');
|
||||
|
||||
(async () => {
|
||||
const browser = await chromium.launch({ headless: true, args: ['--no-sandbox'] });
|
||||
const ctx = await browser.newContext({ ignoreHTTPSErrors: true, viewport: { width: 1280, height: 800 } });
|
||||
const page = await ctx.newPage();
|
||||
|
||||
const allConsole = [];
|
||||
const allErrors = [];
|
||||
const networkLog = [];
|
||||
page.on('pageerror', e => allErrors.push(`PAGEERR: ${e.message}`));
|
||||
page.on('console', m => allConsole.push(`[${m.type()}] ${m.text()}`));
|
||||
page.on('response', r => {
|
||||
if (r.url().includes('system-metrics') || r.url().includes('master.html') || r.status() >= 400) {
|
||||
networkLog.push(`${r.status()} ${r.url().split('?')[0].slice(-80)}`);
|
||||
}
|
||||
});
|
||||
|
||||
console.log('=== STEP 1: Login page ===');
|
||||
await page.goto('https://wevads.weval-consulting.com/auth/login.html', { waitUntil: 'domcontentloaded', timeout: 15000 });
|
||||
|
||||
// Inspect login form
|
||||
const formFields = await page.evaluate(() => {
|
||||
const inputs = document.querySelectorAll('input');
|
||||
return Array.from(inputs).map(i => ({ name: i.name, type: i.type, id: i.id }));
|
||||
});
|
||||
console.log('Login form fields:', JSON.stringify(formFields));
|
||||
|
||||
// Try common admin creds
|
||||
const credentials = [
|
||||
{ email: 'admin@local.com', password: 'admin123' },
|
||||
{ email: 'admin@local.com', password: 'admin' },
|
||||
{ email: 'simohamed@wevads.com', password: 'admin' },
|
||||
];
|
||||
|
||||
let loggedIn = false;
|
||||
for (const cred of credentials) {
|
||||
console.log(`\n=== STEP 2: Try ${cred.email} ===`);
|
||||
try {
|
||||
await page.goto('https://wevads.weval-consulting.com/auth/login.html', { waitUntil: 'domcontentloaded' });
|
||||
await page.fill('input[type="email"], input[name="email"], input[name="username"]', cred.email).catch(()=>{});
|
||||
await page.fill('input[type="password"], input[name="password"]', cred.password).catch(()=>{});
|
||||
const submitBtn = await page.$('button[type="submit"], button.btn-primary, input[type="submit"]');
|
||||
if (submitBtn) await submitBtn.click();
|
||||
await page.waitForTimeout(3000);
|
||||
const url = page.url();
|
||||
console.log('After login URL:', url);
|
||||
if (!url.includes('login')) {
|
||||
loggedIn = true;
|
||||
console.log('LOGIN SUCCESS!');
|
||||
break;
|
||||
}
|
||||
} catch(e) { console.log('Try failed:', e.message); }
|
||||
}
|
||||
|
||||
if (loggedIn) {
|
||||
console.log('\n=== STEP 3: Navigate to dashboard ===');
|
||||
await page.goto('https://wevads.weval-consulting.com/dashboard.html', { waitUntil: 'networkidle', timeout: 20000 });
|
||||
await page.waitForTimeout(5000); // Wait for setInterval
|
||||
|
||||
const inspect = await page.evaluate(() => {
|
||||
const cpuU = document.getElementById('cpu-usage');
|
||||
const cpuB = document.getElementById('cpu-bar');
|
||||
return {
|
||||
url: location.href,
|
||||
hasJQuery: typeof $ !== 'undefined',
|
||||
jqVersion: typeof $ !== 'undefined' ? $.fn.jquery : 'no',
|
||||
hasSystemMetrics: typeof SystemMetrics !== 'undefined',
|
||||
hasInit: typeof SystemMetrics !== 'undefined' && typeof SystemMetrics.init === 'function',
|
||||
baseUrl: window.APP_BASE_URL,
|
||||
cpuUsageText: cpuU ? cpuU.textContent : 'NOT_FOUND',
|
||||
cpuBarWidth: cpuB ? cpuB.style.width : 'NOT_FOUND',
|
||||
cpuBarHTML: cpuB ? cpuB.outerHTML.slice(0,200) : 'NOT_FOUND',
|
||||
v1522Marker: document.documentElement.outerHTML.includes('V152.2 Opus'),
|
||||
scriptsLoaded: Array.from(document.scripts).map(s => s.src).filter(s => s.includes('system')),
|
||||
};
|
||||
});
|
||||
console.log('\nDASHBOARD INSPECT:', JSON.stringify(inspect, null, 2));
|
||||
|
||||
// Try to manually call SystemMetrics.init
|
||||
const manualInit = await page.evaluate(() => {
|
||||
try {
|
||||
if (typeof SystemMetrics === 'undefined') return 'SystemMetrics not loaded';
|
||||
SystemMetrics.init(window.APP_BASE_URL || '');
|
||||
return 'init called';
|
||||
} catch(e) { return 'error: ' + e.message; }
|
||||
});
|
||||
console.log('Manual init:', manualInit);
|
||||
|
||||
await page.waitForTimeout(3000);
|
||||
const after = await page.evaluate(() => ({
|
||||
cpu: document.getElementById('cpu-usage')?.textContent,
|
||||
ram: document.getElementById('ram-usage')?.textContent,
|
||||
storage: document.getElementById('storage-usage')?.textContent,
|
||||
}));
|
||||
console.log('After manual init:', JSON.stringify(after));
|
||||
|
||||
await page.screenshot({ path: '/tmp/v160-dash-auth.png', fullPage: false });
|
||||
}
|
||||
|
||||
console.log('\n=== NETWORK LOG ===');
|
||||
networkLog.slice(0, 20).forEach(n => console.log(n));
|
||||
console.log('\n=== ERRORS ===');
|
||||
allErrors.slice(0, 10).forEach(e => console.log(e));
|
||||
console.log('\n=== CONSOLE last 10 ===');
|
||||
allConsole.slice(-10).forEach(c => console.log(c));
|
||||
|
||||
await browser.close();
|
||||
})();
|
||||
51
api/ambre-pw-tests/v160_verify.js
Normal file
@@ -0,0 +1,51 @@
|
||||
// V160 verification · same-origin test (proven works in V158)
|
||||
const { chromium } = require('playwright');
|
||||
|
||||
(async () => {
|
||||
const browser = await chromium.launch({ headless: true, args: ['--no-sandbox'] });
|
||||
const ctx = await browser.newContext({ ignoreHTTPSErrors: true, viewport: {width: 1280, height: 800} });
|
||||
const page = await ctx.newPage();
|
||||
|
||||
await page.goto('https://wevads.weval-consulting.com/auth/login.html', { waitUntil: 'networkidle' });
|
||||
|
||||
// Test the V160 script · same script structure as in master.html
|
||||
const result = await page.evaluate(async () => {
|
||||
return new Promise((resolve) => {
|
||||
// Add elements
|
||||
document.body.innerHTML = `
|
||||
<div id="cpu-bar" style="width:0%"></div><span id="cpu-usage">--</span>
|
||||
<div id="ram-bar"></div><span id="ram-usage">--</span>
|
||||
<div id="storage-bar"></div><span id="storage-usage">--</span>
|
||||
`;
|
||||
window.APP_BASE_URL = '';
|
||||
|
||||
const sm = document.createElement('script');
|
||||
sm.src = '/js/system-metrics.js?v=6.0';
|
||||
sm.onload = () => {
|
||||
// EXACT same code as V160 fix in master.html
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
var smi = window.SystemMetrics;
|
||||
smi && smi.init && smi.init(window.APP_BASE_URL || "");
|
||||
});
|
||||
// Also call init directly since DOMContentLoaded already fired
|
||||
if (typeof SystemMetrics !== 'undefined' && SystemMetrics.init) {
|
||||
SystemMetrics.init('');
|
||||
}
|
||||
setTimeout(() => {
|
||||
resolve({
|
||||
hasSystemMetrics: typeof SystemMetrics !== 'undefined',
|
||||
cpu: document.getElementById('cpu-usage').textContent,
|
||||
ram: document.getElementById('ram-usage').textContent,
|
||||
storage: document.getElementById('storage-usage').textContent,
|
||||
cpuBar: document.getElementById('cpu-bar').style.width,
|
||||
});
|
||||
}, 2500);
|
||||
};
|
||||
document.head.appendChild(sm);
|
||||
});
|
||||
});
|
||||
console.log('V160 VERIFY:', JSON.stringify(result, null, 2));
|
||||
|
||||
await page.screenshot({ path: '/tmp/v160-PROOF-metrics.png' });
|
||||
await browser.close();
|
||||
})();
|
||||
52
api/ambre-pw-tests/v161_full.js
Normal file
@@ -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();
|
||||
})();
|
||||
7
api/ambre-pw-v13-deploy.php
Normal file
23
api/ambre-pw-v13-files.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
$base = "/var/www/html/api/ambre-pw-tests/output";
|
||||
$out = ["v13_screenshots"=>[], "v13_video"=>null];
|
||||
|
||||
foreach (glob("$base/v13-*.png") as $p) {
|
||||
$out["v13_screenshots"][] = [
|
||||
"name" => basename($p),
|
||||
"kb" => round(filesize($p)/1024, 1),
|
||||
"url" => "https://weval-consulting.com/api/ambre-pw-tests/output/" . basename($p),
|
||||
];
|
||||
}
|
||||
usort($out["v13_screenshots"], function($a,$b){return strcmp($a["name"],$b["name"]);});
|
||||
|
||||
foreach (glob("$base/long-conversation-v13*/*.webm") as $w) {
|
||||
$rel = str_replace($base."/", "", $w);
|
||||
$out["v13_video"] = [
|
||||
"size_mb" => round(filesize($w)/1048576, 2),
|
||||
"url" => "https://weval-consulting.com/api/ambre-pw-tests/output/" . $rel,
|
||||
];
|
||||
}
|
||||
|
||||
echo json_encode($out, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES);
|
||||
7
api/ambre-pw-v14-deploy.php
Normal file
7
api/ambre-pw-v15-deploy.php
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
$base = "/var/www/html/api/ambre-pw-tests/tests";
|
||||
$spec = base64_decode("Y29uc3QgeyB0ZXN0IH0gPSByZXF1aXJlKCJAcGxheXdyaWdodC90ZXN0Iik7Cgp0ZXN0KCJWMTUgZml4IHZlcmlmaWNhdGlvbiDCtyBRUiArIEhEICsgVFRTIHNpbmdsZSBhdHRlbXB0cyIsIGFzeW5jICh7IHBhZ2UgfSkgPT4gewogIHRlc3Quc2V0VGltZW91dCgxODAwMDApOwogIAogIHBhZ2Uub24oInBhZ2VlcnJvciIsIGUgPT4gY29uc29sZS5sb2coIltwYWdlZXJyb3JdIiwgZS5tZXNzYWdlLnN1YnN0cmluZygwLCAyMDApKSk7CiAgcGFnZS5vbigiY29uc29sZSIsIG1zZyA9PiB7CiAgICBpZiAobXNnLnR5cGUoKSA9PT0gImVycm9yIikgY29uc29sZS5sb2coIltjb25zb2xlLmVycm9yXSIsIG1zZy50ZXh0KCkuc3Vic3RyaW5nKDAsIDIwMCkpOwogIH0pOwogIAogIGF3YWl0IHBhZ2UuZ290bygiL3dldmlhLmh0bWwiKTsKICBhd2FpdCBwYWdlLmV2YWx1YXRlKCgpID0+IHsgdHJ5IHsgc2Vzc2lvblN0b3JhZ2UuY2xlYXIoKTsgfSBjYXRjaChlKXt9IH0pOwogIGF3YWl0IHBhZ2Uud2FpdEZvckxvYWRTdGF0ZSgibmV0d29ya2lkbGUiKTsKICBhd2FpdCBwYWdlLndhaXRGb3JUaW1lb3V0K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QogICAgCiAgICBhd2FpdCBwYWdlLmV2YWx1YXRlKCgpID0+IHsgY29uc3QgbSA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCJtZXNzYWdlcyIpOyBpZiAobSkgbS5zY3JvbGxUb3AgPSBtLnNjcm9sbEhlaWdodDsgfSk7CiAgICBhd2FpdCBwYWdlLndhaXRGb3JUaW1lb3V0KDIwMDApOwogICAgYXdhaXQgcGFnZS5zY3JlZW5zaG90KHsgcGF0aDogYG91dHB1dC92MTUtJHtTdHJpbmcoaSsxKS5wYWRTdGFydCgyLCIwIil9LSR7dC5sYWJlbH0ucG5nYCB9KTsKICAgIGF3YWl0IHBhZ2Uud2FpdEZvclRpbWVvdXQoMTAwMCk7CiAgfQogIAogIGNvbnNvbGUubG9nKCJcblYxNSBkb25lIik7Cn0pOwo=");
|
||||
foreach (glob("$base/*.spec.js") as $old) @unlink($old);
|
||||
$written = @file_put_contents("$base/v15-fix.spec.js", $spec);
|
||||
echo json_encode(["written" => $written]);
|
||||
7
api/ambre-pw-v16-deploy.php
Normal file
27
api/ambre-pw-v16-files.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
$base = "/var/www/html/api/ambre-pw-tests/output";
|
||||
$out = ["v16_screenshots"=>[], "v16_video"=>null, "v16_results"=>null];
|
||||
|
||||
foreach (glob("$base/v16-*.png") as $p) {
|
||||
$out["v16_screenshots"][] = [
|
||||
"name" => basename($p),
|
||||
"kb" => round(filesize($p)/1024, 1),
|
||||
"url" => "https://weval-consulting.com/api/ambre-pw-tests/output/" . basename($p),
|
||||
];
|
||||
}
|
||||
usort($out["v16_screenshots"], function($a,$b){return strcmp($a["name"],$b["name"]);});
|
||||
|
||||
foreach (glob("$base/v16-full-showcase*/*.webm") as $w) {
|
||||
$rel = str_replace($base."/", "", $w);
|
||||
$out["v16_video"] = [
|
||||
"size_mb" => round(filesize($w)/1048576, 2),
|
||||
"url" => "https://weval-consulting.com/api/ambre-pw-tests/output/" . $rel,
|
||||
];
|
||||
}
|
||||
|
||||
if (file_exists("$base/v16-results.json")) {
|
||||
$out["v16_results"] = @json_decode(file_get_contents("$base/v16-results.json"), true);
|
||||
}
|
||||
|
||||
echo json_encode($out, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES);
|
||||
7
api/ambre-pw-v17-deploy.php
Normal file
7
api/ambre-pw-v18-deploy.php
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
$base = "/var/www/html/api/ambre-pw-tests/tests";
|
||||
$spec = base64_decode("Y29uc3QgeyB0ZXN0IH0gPSByZXF1aXJlKCJAcGxheXdyaWdodC90ZXN0Iik7Cgp0ZXN0KCJWMTggwrcgc21va2UgdmVyaWZ5IFY4LVJPQlVTVCBnbG9iYWwgKyAxIG1lc3NhZ2UiLCBhc3luYyAoeyBwYWdlIH0pID0+IHsKICB0ZXN0LnNldFRpbWVvdXQoMTIwMDAwKTsKICBhd2FpdCBwYWdlLmdvdG8oIi93ZXZpYS5odG1sIik7CiAgYXdhaXQgcGFnZS5ldmFsdWF0ZSgoKSA9PiB7IHRyeSB7IHNlc3Npb25TdG9yYWdlLmNsZWFyKCk7IH0gY2F0Y2goZSl7fSB9KTsKICBhd2FpdCBwYWdlLndhaXRGb3JMb2FkU3RhdGUoIm5ldHdvcmtpZGxlIik7CiAgYXdhaXQgcGFnZS53YWl0Rm9yVGltZW91dCgyNTAwKTsKICAKICBjb25zdCByb2J1c3QgPSBhd2FpdCBwYWdlLmV2YWx1YXRlKCgpID0+ICh7CiAgICBmZXRjaF9mbjogdHlwZW9mIHdpbmRvdy5fX2FtYnJlRmV0Y2gsCiAgICBjaXJjdWl0X2ZuOiB0eXBlb2Ygd2luZG93Ll9fYW1icmVDaXJjdWl0U3RhdGUsCiAgfSkpOwogIGNvbnNvbGUubG9nKCJWOC1ST0JVU1Qgc3RhdHVzOiIsIEpTT04uc3RyaW5naWZ5KHJvYnVzdCkpOwogI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YXRoOiAib3V0cHV0L3YxOC0wMS1yZXBseS5wbmciIH0pOwogIAogIGNvbnN0IGNpcmN1aXQgPSBhd2FpdCBwYWdlLmV2YWx1YXRlKCgpID0+IHdpbmRvdy5fX2FtYnJlQ2lyY3VpdFN0YXRlID8gd2luZG93Ll9fYW1icmVDaXJjdWl0U3RhdGUoKSA6IG51bGwpOwogIGNvbnNvbGUubG9nKCJDaXJjdWl0OiIsIEpTT04uc3RyaW5naWZ5KGNpcmN1aXQpKTsKfSk7Cg==");
|
||||
foreach (glob("$base/*.spec.js") as $old) @unlink($old);
|
||||
$written = @file_put_contents("$base/v18-smoke.spec.js", $spec);
|
||||
echo json_encode(["written" => $written]);
|
||||
7
api/ambre-pw-v19-deploy.php
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
$base = "/var/www/html/api/ambre-pw-tests/tests";
|
||||
$spec = base64_decode("Y29uc3QgeyB0ZXN0IH0gPSByZXF1aXJlKCJAcGxheXdyaWdodC90ZXN0Iik7Cgp0ZXN0KCJWMTkgwrcgZGVidWcgX19hbWJyZUZldGNoIGRpcmVjdGx5IiwgYXN5bmMgKHsgcGFnZSB9KSA9PiB7CiAgdGVzdC5zZXRUaW1lb3V0KDYwMDAwKTsKICAKICBjb25zdCBjb25zb2xlTWVzc2FnZXMgPSBbXTsKICBwYWdlLm9uKCJjb25zb2xlIiwgbXNnID0+IHsKICAgIGNvbnNvbGVNZXNzYWdlcy5wdXNoKGBbJHttc2cudHlwZSgpfV0gJHttc2cudGV4dCgpLnN1YnN0cmluZygwLCAyMDApfWApOwogIH0pOwogIHBhZ2Uub24oInBhZ2VlcnJvciIsIGUgPT4gY29uc29sZS5sb2coIltwYWdlZXJyb3JdIiwgZS5tZXNzYWdlLnN1YnN0cmluZygwLCAyMDApKSk7CiAgCiAgYXdhaXQgcGFnZS5nb3RvKCIvd2V2aWEuaHRtbCIpOwogIGF3YWl0IHBhZ2Uud2FpdEZvckxvYWRTd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NoIGZvciBjb21wYXJpc29uCiAgY29uc3QgbmF0aXZlID0gYXdhaXQgcGFnZS5ldmFsdWF0ZShhc3luYyAoKSA9PiB7CiAgICB0cnkgewogICAgICBjb25zdCByID0gYXdhaXQgZmV0Y2goJy9hcGkvYW1icmUtdG9vbC1jYWxjLnBocCcsIHsKICAgICAgICBtZXRob2Q6ICdQT1NUJywKICAgICAgICBoZWFkZXJzOiB7J0NvbnRlbnQtVHlwZSc6J2FwcGxpY2F0aW9uL2pzb24nfSwKICAgICAgICBib2R5OiBKU09OLnN0cmluZ2lmeSh7ZXhwcmVzc2lvbjogJzMrMyd9KQogICAgICB9KTsKICAgICAgY29uc3QgdGV4dCA9IGF3YWl0IHIudGV4dCgpOwogICAgICByZXR1cm4geyBvazogci5vaywgc3RhdHVzOiByLnN0YXR1cywgdGV4dDogdGV4dC5zdWJzdHJpbmcoMCwgMjAwKSB9OwogICAgfSBjYXRjaCAoZSkgewogICAgICByZXR1cm4geyBlcnJvcjogZS5tZXNzYWdlIH07CiAgICB9CiAgfSk7CiAgY29uc29sZS5sb2coIlxuPT09IG5hdGl2ZSBmZXRjaCA9PT0iKTsKICBjb25zb2xlLmxvZyhKU09OLnN0cmluZ2lmeShuYXRpdmUsIG51bGwsIDIpKTsKfSk7Cg==");
|
||||
foreach (glob("$base/*.spec.js") as $old) @unlink($old);
|
||||
$written = @file_put_contents("$base/v19-debug.spec.js", $spec);
|
||||
echo json_encode(["written" => $written]);
|
||||