Add global seal-use stop command and shutdown HTTP route

This commit is contained in:
gitea committed 2026-09-04 17:58:30 +08:00
1 parent 37580dac44
commit f9b8b06647
4 files changed
+90 -69

No files matched your search

+12
View File
@@ -75,6 +75,18 @@ export async function handleHttpRequest(req: IncomingMessage, res: ServerRespons
return;
}
if (method === "POST" && (pathname === "/shutdown" || pathname === "/api/shutdown")) {
sendJson(res, 200, {
success: true,
message: "Shutting down seal-use background daemon",
pid: process.pid
});
setTimeout(() => {
process.kill(process.pid, "SIGTERM");
}, 50);
return;
}
// 3. Command Execution Endpoint: POST /api/cli
if (method === "POST" && pathname === "/api/cli") {
const body = await parseJsonBody(req);