feat: complete TASK-WP0-07 supervisor

This commit is contained in:
suyx
2026-07-27 23:28:36 +08:00
parent 2dd6f5c2c2
commit 096a1f1279
22 changed files with 1717 additions and 6 deletions
+13
View File
@@ -2,6 +2,12 @@ import { resolve } from "node:path";
import { createApp } from "./app.js";
import { readBrowserSupportRelease } from "./browser-support.js";
import { attachApiSupervisorControl, initializeApiCredentialClients, receiveApiCredentials } from "./supervisor-channel.js";
const credentialChannelEnabled = process.argv.includes("--dada-credential-stdin");
if (credentialChannelEnabled) {
initializeApiCredentialClients(await receiveApiCredentials());
}
const browserSupportRelease = readBrowserSupportRelease(resolve("RELEASE.json"));
const app = await createApp(browserSupportRelease ? { browserSupportRelease } : {});
@@ -10,3 +16,10 @@ await app.listen({
host: "127.0.0.1",
port: 43121,
});
const controlPipeIndex = process.argv.indexOf("--dada-control-pipe");
if (controlPipeIndex >= 0) {
const controlPipe = process.argv[controlPipeIndex + 1];
if (!controlPipe) throw new Error("Supervisor control pipe name is required.");
attachApiSupervisorControl(controlPipe, () => app.close());
}