66 lines
2.0 KiB
PHP
66 lines
2.0 KiB
PHP
<?php
|
|
/**
|
|
* intent-opus4-read_truth_registry.php
|
|
* AMBRE session · 2026-04-21
|
|
* Ferme gap autonomie : remplace LLM fallback qui hallucinait "Yacine Khaled"
|
|
* quand on demandait /api/wevia-truth-registry.json.
|
|
* Doctrine #4 ZERO FAKE DATA — retourne les scalaires du vrai registry.
|
|
* Invocation : /api/opus-arch-generic.php?tool=read_truth_registry
|
|
*/
|
|
header('Content-Type: application/json');
|
|
|
|
$candidates = [
|
|
'/var/www/html/api/wevia-truth-registry.json',
|
|
'/var/www/html/api/truth-registry.json',
|
|
'/opt/wevads/vault/wevia-truth-registry.json',
|
|
];
|
|
$path = null;
|
|
foreach ($candidates as $c) {
|
|
if (file_exists($c)) { $path = $c; break; }
|
|
}
|
|
if (!$path) {
|
|
echo json_encode(['ok'=>false, 'error'=>'truth registry not found', 'tried'=>$candidates]);
|
|
exit;
|
|
}
|
|
|
|
$raw = file_get_contents($path);
|
|
$data = json_decode($raw, true);
|
|
if (!is_array($data)) {
|
|
echo json_encode(['ok'=>false, 'error'=>'invalid JSON', 'path'=>$path]);
|
|
exit;
|
|
}
|
|
|
|
// Extract scalars (flat values) + count nested arrays
|
|
$scalars = [];
|
|
$nested = [];
|
|
foreach ($data as $k => $v) {
|
|
if (is_array($v) || is_object($v)) {
|
|
$nested[$k] = is_array($v) ? count($v) : 'object';
|
|
} else {
|
|
$scalars[$k] = $v;
|
|
}
|
|
}
|
|
|
|
// Pick the 10 most relevant headline metrics if they exist
|
|
$headlines = [];
|
|
foreach ([
|
|
'agents_count','agents_total','intents_count','tools_count','providers_count',
|
|
'skills_total','brains_count','doctrines_count','dashboards_count',
|
|
'nonreg_score','l99_score','autonomy_level','autonomy_score',
|
|
'ethica_hcps_total','pages_count','apis_count','crons_count','built_at','last_update'
|
|
] as $key) {
|
|
if (isset($data[$key]) && !is_array($data[$key])) {
|
|
$headlines[$key] = $data[$key];
|
|
}
|
|
}
|
|
|
|
echo json_encode([
|
|
'ok' => true,
|
|
'path' => $path,
|
|
'bytes' => strlen($raw),
|
|
'headlines' => $headlines,
|
|
'scalars' => $scalars,
|
|
'nested' => $nested,
|
|
'source' => 'intent-opus4-read_truth_registry.php · ambre · doctrine#4 honest · no hallucination',
|
|
], JSON_PRETTY_PRINT);
|