Add support self-check diagnostics

This commit is contained in:
Sucukdeluxe
2026-03-09 03:00:36 +01:00
parent 28452373bf
commit 7027e11cbd
7 changed files with 414 additions and 10 deletions
+6 -3
View File
@@ -33,6 +33,7 @@ const DEBUG_ENDPOINTS: DebugEndpointDescriptor[] = [
{ method: "GET", path: "/health", description: "Basic health, uptime, and memory information." },
{ method: "GET", path: "/meta", description: "Lists runtime metadata and all available endpoints." },
{ method: "GET", path: "/debug/setup", description: "Checks whether the local debug setup is configured for support." },
{ method: "GET", path: "/self-check", description: "Extended support self-check with disk space, log sizes, and support bundle estimate." },
{ method: "GET", path: "/host/diagnostics", description: "Returns Windows host crash and dump diagnostics." },
{ method: "GET", path: "/log", queryExample: "lines=100&grep=keyword", description: "Legacy alias for the main application log tail." },
{ method: "GET", path: "/logs/main", queryExample: "lines=100&grep=keyword", description: "Reads the main application log tail." },
@@ -238,7 +239,7 @@ function buildAiManifest(baseDir: string): Record<string, unknown> {
"Read debug_token.txt and debug_port.txt from this runtime folder.",
"If remote access is needed, ask the user only for the server IP or DNS name.",
"Call /meta first to confirm the server is reachable and to re-read the endpoint list.",
"Use /debug/setup to quickly verify whether token, host, manifest, and trace files are in a good support state.",
"Use /self-check or /debug/setup to quickly verify whether token, host, manifest, trace, disk space, and log sizes are in a good support state.",
"Use /diagnostics for an overview, then drill into /logs/item, /logs/package, /status, /packages, /items, /settings, /accounts, /stats, /history, or /logs/trace.",
"If a full handoff is needed, download /support/bundle as a ZIP."
],
@@ -274,6 +275,7 @@ function buildAiManifest(baseDir: string): Record<string, unknown> {
remoteHostHint
},
setupCheckEndpoint: "/debug/setup",
selfCheckEndpoint: "/self-check",
askUserFor: [
"Server IP or DNS name, if remote access is required and not already known."
],
@@ -475,7 +477,8 @@ function handleRequest(req: http.IncomingMessage, res: http.ServerResponse): voi
traceLog: getTraceLogPath()
},
supportChecks: {
setup: "/debug/setup"
setup: "/debug/setup",
selfCheck: "/self-check"
},
logPaths: {
main: getLogFilePath(),
@@ -488,7 +491,7 @@ function handleRequest(req: http.IncomingMessage, res: http.ServerResponse): voi
return;
}
if (pathname === "/debug/setup") {
if (pathname === "/debug/setup" || pathname === "/self-check") {
jsonResponse(res, 200, getDebugSetupCheck(runtimeBaseDir));
return;
}