Files
html/api/ambre-scan-w259.php

47 lines
2.2 KiB
PHP

<?php
header("Content-Type: application/json");
$out = [];
chdir("/var/www/html");
$out["recent_tags"] = array_filter(array_map("trim", explode("\n", @shell_exec("git tag -l 'wave-*' --sort=-creatordate 2>&1 | head -8"))));
$out["recent_commits_30m"] = array_filter(array_map("trim", explode("\n", @shell_exec("git log --since='30 minutes ago' --oneline 2>&1 | head -10"))));
// Internal chats candidates - what pages have chatbots?
$chat_pages = [];
foreach (["wevia.html", "wevia-master.html", "all-ia-hub.html", "wevia-orchestrator.html", "index.html", "director-chat.html", "l99-brain.html", "agents-enterprise.html", "paperclip.html", "director-center.html"] as $p) {
$f = "/var/www/html/$p";
if (file_exists($f)) {
$c = @file_get_contents($f);
$chat_pages[$p] = [
"size" => strlen($c),
"has_chat_api" => strpos($c, "session-chat") !== false || strpos($c, "wevia-master-api") !== false || strpos($c, "wevia-autonomous") !== false || strpos($c, "chat-api") !== false,
"has_sessionstorage" => strpos($c, "sessionStorage") !== false,
"has_internal_memory" => strpos($c, "internal-memory") !== false,
];
}
}
$out["chat_pages"] = $chat_pages;
// Cloudflare workers/rules check
$cf = @file_get_contents("/etc/weval/secrets.env");
$out["cf_token_present"] = (bool)preg_match("/CF_API_TOKEN=.{20,}/", $cf ?? "");
$out["cf_token_len"] = 0;
if (preg_match("/CF_API_TOKEN=([^\n\"]+)/", $cf ?? "", $m)) $out["cf_token_len"] = strlen($m[1]);
// Check CF cache status on chatbot endpoints (are they cached wrongly?)
$endpoints = ["/api/ambre-session-chat.php", "/api/wevia-autonomous.php", "/api/ambre-multiagent-parallel.php"];
$out["cf_cache_status"] = [];
foreach ($endpoints as $ep) {
$h = @get_headers("https://weval-consulting.com$ep?cb=" . time(), 1);
$out["cf_cache_status"][$ep] = $h["cf-cache-status"] ?? $h["CF-Cache-Status"] ?? "none";
}
// Check cross-chat learning possibility
$out["internal_memory_dir_exists"] = is_dir("/opt/wevads/internal-memory");
$out["internal_memory_chats"] = count(glob("/opt/wevads/internal-memory/*.jsonl") ?: []);
// Load
$out["load"] = trim(@shell_exec("uptime"));
echo json_encode($out, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES);