mirror of
https://github.com/grp06/openclaw-studio.git
synced 2026-08-14 08:52:03 +00:00
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
37 lines
1.0 KiB
TypeScript
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 });
|
|
}
|
|
}
|