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
+20
View File
@@ -0,0 +1,20 @@
import { Readable } from "node:stream";
import { initializeApiCredentialClients, receiveApiCredentials } from "../apps/api/dist/supervisor-channel.js";
import { initializeWorkerCredentialClient, receiveWorkerCredentials } from "../apps/worker/dist/supervisor-channel.js";
const marker = `wp0-${Date.now().toString(36)}`;
const api = await receiveApiCredentials(Readable.from([Buffer.from(JSON.stringify({
"Dada/P0A/api/amap": `${marker}-map`,
"Dada/P0A/api/resend": `${marker}-mail`,
}))]));
initializeApiCredentialClients(api);
if (Object.values(api).some(Boolean)) throw new Error("API credential receive object was not cleared after client initialization.");
const worker = await receiveWorkerCredentials(Readable.from([Buffer.from(JSON.stringify({
"Dada/P0A/worker/ai-gateway": `${marker}-ai`,
}))]));
initializeWorkerCredentialClient(worker);
if (Object.values(worker).some(Boolean)) throw new Error("Worker credential receive object was not cleared after client initialization.");
console.log(JSON.stringify({ api_scope: "resend_amap", receive_buffer: "cleared", status: "passed", worker_scope: "ai_gateway" }));