Files
html/api/ambre-diag-snapshot.php

43 lines
1.4 KiB
PHP

<?php
/**
* ambre-diag-snapshot.php — appelle __ambre_truth_snapshot et dump resultat
*/
header("Content-Type: application/json");
// Load fast-path-v3 to have the function available
$fp = "/var/www/html/api/wevia-fast-path-v3.php";
if (file_exists($fp)) @require_once $fp;
$fn_exists = function_exists("__ambre_truth_snapshot");
$out = ["ok" => true, "helper_loaded" => $fn_exists];
if ($fn_exists) {
$out["snapshot"] = __ambre_truth_snapshot();
}
// Also load truth registry ourselves to see nested structure
$p = "/var/www/html/api/wevia-truth-registry.json";
if (file_exists($p)) {
$d = @json_decode(@file_get_contents($p), true);
if (is_array($d)) {
$out["file_ok"] = true;
$out["file_size"] = filesize($p);
$out["top_keys"] = array_keys($d);
// Probe nested structures to find count-like fields
foreach (["tools","providers","intents","skills","brains","doctrines","dashboards","nonreg"] as $k) {
if (isset($d[$k]) && is_array($d[$k])) {
$out["nested"][$k] = [
"keys" => array_keys($d[$k]),
];
// List sub-types
foreach ($d[$k] as $sk => $sv) {
$out["nested"][$k]["types"][$sk] = is_array($sv) ? "array[" . count($sv) . "]" : (is_numeric($sv) ? "num=" . $sv : gettype($sv));
}
}
}
}
}
echo json_encode($out, JSON_PRETTY_PRINT);