Integrate NemoClaw recovery and dashboard routing

This commit is contained in:
mmckeen-nv
2026-05-08 09:32:56 -07:00
parent 819e3e5f7d
commit 94bd7737d3
25 changed files with 1001 additions and 152 deletions
@@ -1,6 +1,7 @@
import { NextResponse } from "next/server"
import { execOpenShell, normalizeSandboxPhase, resolveSandboxRef } from "@/app/lib/openshellHost"
import { listBackupCatalog } from "@/app/lib/backupCatalog"
import { getNemoClawDoctorReport } from "@/app/lib/nemoclawCli"
function parseField(output: string, label: string) {
const normalizedLabel = label.toLowerCase()
@@ -23,6 +24,15 @@ export async function GET(
const phase = normalizeSandboxPhase(parseField(resolved.details, "Phase"))
const catalog = await listBackupCatalog()
const relatedBackups = catalog.filter((backup) => backup.sandboxId === sandboxId || backup.sandboxName === resolved.name)
const nemoclawDoctor = await getNemoClawDoctorReport(resolved.name).catch((error) => ({
available: false,
supported: false,
attempted: false,
version: null,
minimumVersion: "0.0.37",
report: null,
error: error instanceof Error ? error.message : "NemoClaw doctor check failed",
}))
let sshConfig = ""
let sshConfigError = ""
@@ -60,6 +70,16 @@ export async function GET(
? `${relatedBackups.length} saved backup${relatedBackups.length === 1 ? "" : "s"} in catalog.`
: "No saved catalog backups yet.",
},
{
key: "nemoclaw-doctor",
label: "NemoClaw doctor",
ok: !nemoclawDoctor.supported || Boolean(nemoclawDoctor.report && nemoclawDoctor.report.status !== "fail"),
detail: nemoclawDoctor.supported
? nemoclawDoctor.report
? `NemoClaw ${nemoclawDoctor.version || "unknown"} doctor reported ${nemoclawDoctor.report.status} (${nemoclawDoctor.report.failed} failed, ${nemoclawDoctor.report.warnings} warnings).`
: nemoclawDoctor.error || "NemoClaw doctor did not return a report."
: `Using OpenShell compatibility checks; NemoClaw doctor requires ${nemoclawDoctor.minimumVersion}+${nemoclawDoctor.version ? `, found ${nemoclawDoctor.version}` : ""}.`,
},
]
return NextResponse.json({
@@ -71,6 +91,19 @@ export async function GET(
phase,
},
checks,
nemoclaw: {
doctor: {
available: nemoclawDoctor.available,
supported: nemoclawDoctor.supported,
attempted: nemoclawDoctor.attempted,
version: nemoclawDoctor.version,
minimumVersion: nemoclawDoctor.minimumVersion,
status: nemoclawDoctor.report?.status ?? null,
failed: nemoclawDoctor.report?.failed ?? null,
warnings: nemoclawDoctor.report?.warnings ?? null,
error: nemoclawDoctor.error ?? null,
},
},
backupCount: relatedBackups.length,
durationMs: Date.now() - startedAt,
checkedAt: new Date().toISOString(),