UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

3 lines • 965 B
import{l as normalizeOptionalString}from"./string-coerce-CpTFcSwY.mjs";import{r as truncateUtf16Safe}from"./utf16-slice-DA3Mllbx.mjs";import{t as DARWIN_SYSTEM_PROBE_TIMEOUT_MS}from"./os-summary-Cvw6cXSp.mjs";import{readFileSync}from"node:fs";import os from"node:os";import{spawnSync}from"node:child_process"; //!src/infra/machine-model.ts const models=/* @__PURE__ */ new Map;function resolveMachineModelIdentifier(e=os.platform()){if(models.has(e))return models.get(e);let t;if(e===`darwin`){const e=spawnSync(`sysctl`,[`-n`,`hw.model`],{encoding:`utf-8`,timeout:DARWIN_SYSTEM_PROBE_TIMEOUT_MS,killSignal:`SIGKILL`});t=normalizeOptionalString(e.stdout)}else if(e===`linux`)for(const e of[`/sys/devices/virtual/dmi/id/product_name`,`/proc/device-tree/model`])try{const n=readFileSync(e,`utf-8`);t=normalizeOptionalString(n.trim().replace(/\0+$/,``));if(t){t=truncateUtf16Safe(t,64);break}}catch{}models.set(e,t);return t}export{resolveMachineModelIdentifier as t};