Files
openclaw-studio/src/app/api/runtime/disconnect/route.ts
T
George Pickett d2c10958bc Improve Studio install onboarding for local and cloud setups
Make first-run connection setup explain how users open Studio separately from how Studio reaches OpenClaw, so remote and same-host cloud installs are less confusing for beginners.

Made-with: Cursor
2026-03-05 16:19:54 -08:00

37 lines
1.0 KiB
TypeScript

import { NextResponse } from "next/server";
import { deriveRuntimeFreshness } from "@/lib/controlplane/degraded-read";
import { peekControlPlaneRuntime } from "@/lib/controlplane/runtime";
export const runtime = "nodejs";
export async function POST() {
try {
const controlPlane = peekControlPlaneRuntime();
if (!controlPlane) {
const summary = {
status: "stopped" as const,
reason: null,
asOf: null,
outboxHead: 0,
};
return NextResponse.json({
enabled: true,
summary,
freshness: deriveRuntimeFreshness(summary, null),
});
}
await controlPlane.disconnect();
const summary = controlPlane.snapshot();
return NextResponse.json({
enabled: true,
summary,
freshness: deriveRuntimeFreshness(summary, null),
});
} catch (error) {
const message = error instanceof Error ? error.message : "Failed to disconnect Studio runtime.";
return NextResponse.json({ enabled: true, error: message }, { status: 500 });
}
}