openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
3 lines • 935 B
JavaScript
import{l as isRecord}from"./record-coerce-BTbqdJ3-.mjs";import{t as WorkerProviderError}from"./capability-provider.types-Bir_t_Rt.mjs";import{t as DEVICE_WORKER_PROVIDER_ID}from"./device-provider-identity-0id_Gtsu.mjs";
//!src/gateway/worker-environments/inference-placement.ts
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`}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{}}}export{workerInferencePlacement as n,workerInferenceMetadata as t};