openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
25 lines (24 loc) • 1.24 kB
JavaScript
import { l as isRecord } from "./record-coerce-CVPuDqcc.mjs";
import { t as WorkerProviderError } from "./capability-provider.types-qOxhG-PT.mjs";
import { t as DEVICE_WORKER_PROVIDER_ID } from "./device-provider-identity-v6nXqNq_.mjs";
//#region src/gateway/worker-environments/inference-placement.ts
/** Inference placement is a recorded provider-profile choice, not a worker fallback. */
function workerInferencePlacement(e) {
if (e.providerId !== "device") return "gateway";
const t = e.profileSnapshot.settings;
const n = isRecord(t) ? t.inference : void 0;
if (n === void 0 || n === "gateway") return "gateway";
if (n !== "worker") throw new WorkerProviderError("Invalid device worker profile: cloudWorkers.profiles.<id>.settings.inference must be \"gateway\" or \"worker\".");
return "worker";
}
/** Invalid profiles stay visible for diagnosis without advertising worker inference. */
function workerInferenceMetadata(e) {
const t = e.profileSnapshot.settings;
try {
return workerInferencePlacement(e) === "worker" && isRecord(t) && typeof t.device === "string" && t.device.trim() ? { inference: "worker" } : {};
} catch {
return {};
}
}
//#endregion
export { workerInferencePlacement as n, workerInferenceMetadata as t };