From 0ced8cf7bda468289ec9fe849db7db575f9596a7 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Mon, 25 May 2026 18:39:16 +0000 Subject: [PATCH] Changes Co-authored-by: domfelipe <53182096+domfelipe@users.noreply.github.com> --- src/routes/admin.agente.$id.tsx | 93 +++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) diff --git a/src/routes/admin.agente.$id.tsx b/src/routes/admin.agente.$id.tsx index 23923ee..692f24b 100644 --- a/src/routes/admin.agente.$id.tsx +++ b/src/routes/admin.agente.$id.tsx @@ -748,3 +748,96 @@ function HistoryCard({ ); } + +interface InspectResult { + path: string; + status: number; + ok: boolean; + body: unknown; +} + +interface InspectResponse { + agent_instance_id: string; + public_url: string; + public_domain: string; + service_id: string; + results: InspectResult[]; +} + +function RuntimeInspectSection({ agentInstanceId }: { agentInstanceId: string }) { + const [loading, setLoading] = useState(false); + const [result, setResult] = useState(null); + const [pathsInput, setPathsInput] = useState( + "/api/health,/api/cronjobs,/api/integrations,/api/plugins", + ); + + async function handleInspect() { + setLoading(true); + const paths = pathsInput + .split(",") + .map((p) => p.trim()) + .filter((p) => p.startsWith("/")); + const { data, error } = await invokeFunction( + "admin-runtime-inspect", + { agent_instance_id: agentInstanceId, paths }, + ); + setLoading(false); + if (error || !data) { + toast.error(error?.message ?? "Falha ao inspecionar runtime"); + return; + } + setResult(data); + } + + return ( +
+
+

Diagnóstico do runtime (Hermes)

+
+

+ Faz GET autenticado nos endpoints internos do container Hermes do agente. + Útil para verificar se o plugin de cron está ativo, jobs registrados na memória do runtime, integrações conhecidas etc. +

+
+ + setPathsInput(e.target.value)} + className="font-mono text-xs" + /> +
+ + {result && ( +
+

+ {result.public_url} +

+ {result.results.map((r) => ( +
+
+ {r.path} + + HTTP {r.status} + +
+
+                {typeof r.body === "string"
+                  ? r.body
+                  : JSON.stringify(r.body, null, 2)}
+              
+
+ ))} +
+ )} +
+ ); +}