Files
html/api/ambre-list-stubs.php
opus 511b5dcb6f
Some checks failed
WEVAL NonReg / nonreg (push) Has been cancelled
auto-sync via WEVIA git_sync_all intent 2026-04-21T15:24:47+02:00
2026-04-21 15:24:48 +02:00

34 lines
1.0 KiB
PHP

<?php
/**
* ambre-list-stubs.php · listing wired-pending stubs related to capabilities
*/
header("Content-Type: application/json");
$dir = "/var/www/html/api/wired-pending";
$files = glob("$dir/intent-opus4-*.php") ?: [];
$kw = $_GET["kw"] ?? "";
$out = ["count"=>count($files), "matches"=>[]];
foreach ($files as $f) {
$name = basename($f, ".php");
$short = str_replace("intent-opus4-", "", $name);
if ($kw && stripos($short, $kw) === false) continue;
// Read metadata if array stub
ob_start();
$info = @include $f;
@ob_end_clean();
$meta = [
"name" => $short,
"size" => filesize($f),
"mtime" => gmdate("c", filemtime($f)),
];
if (is_array($info)) {
$meta["triggers"] = $info["triggers"] ?? [];
$meta["status"] = $info["status"] ?? "?";
$meta["cmd"] = $info["cmd"] ?? "?";
} else {
$meta["type"] = "direct-exec";
}
$out["matches"][] = $meta;
}
$out["matches_count"] = count($out["matches"]);
echo json_encode($out, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES);