feat: 拆分 HWPOD Temporal 服务与独立 Web

This commit is contained in:
root
2026-07-20 19:58:02 +02:00
parent d2e9e3593d
commit d7709f0a27
18 changed files with 520 additions and 1 deletions
+20
View File
@@ -0,0 +1,20 @@
/*
* SPEC: PJ2026-010103 HWPOD 服务。
* 实现引用: draft-2026-07-20-hwpod-temporal-split。
* 责任: HWPOD API 的 Temporal 与迁移期 Cloud API 配置解析。
*/
import { createHwpodTemporalGateway } from "./temporal.ts";
export function hwpodRuntime(env: Record<string, string | undefined> = process.env) {
const address = String(env.HWPOD_TEMPORAL_ADDRESS ?? env.TEMPORAL_ADDRESS ?? "").trim();
const namespace = String(env.HWPOD_TEMPORAL_NAMESPACE ?? "unidesk").trim();
const taskQueue = String(env.HWPOD_TEMPORAL_TASK_QUEUE ?? "hwlab-v03-hwpod").trim();
const runtimeApiUrl = String(env.HWPOD_RUNTIME_API_URL ?? "").trim().replace(/\/+$/u, "");
const runtimeApiAuthorization = String(env.HWPOD_RUNTIME_API_AUTHORIZATION ?? "").trim();
if (!runtimeApiUrl) throw codedError("hwpod_runtime_api_url_required", "HWPOD_RUNTIME_API_URL is required");
if (!runtimeApiAuthorization) throw codedError("hwpod_runtime_api_authorization_required", "HWPOD_RUNTIME_API_AUTHORIZATION is required");
return { address, namespace, taskQueue, runtimeApiUrl, runtimeApiAuthorization, temporal: createHwpodTemporalGateway({ address, namespace, taskQueue }) };
}
function codedError(code: string, message: string) { return Object.assign(new Error(message), { code }); }