UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

3 lines • 1.19 kB
import{i as isMissingPathError}from"./errno-DUBt6SQQ.mjs";import{t as createSubsystemLogger}from"./subsystem-DLCDFvCH.mjs";import{Et as _enum,Fn as object,Jn as string,xn as literal}from"./schemas-DuCQi-Qb.mjs";import{o as readJsonIfExists,t as JsonFileReadError}from"./json-files-BBQ_0Np0.mjs";import path from"node:path";import fs from"node:fs/promises"; //!src/infra/install-owner.ts const log=createSubsystemLogger(`install-owner`);const InstallOwnerSchema=object({schemaVersion:literal(1),owner:_enum([`macos-app`,`desktop-app`]),displayName:string().trim().min(1),updateHint:string().trim().min(1)});async function readInstallOwner(e){if(!e)return null;const t=path.join(e,`openclaw-install-owner.json`);try{const e=await readJsonIfExists(t,{maxBytes:16384});if(e===null)await fs.access(t);const n=InstallOwnerSchema.safeParse(e);if(n.success)return n.data}catch(e){if(isMissingPathError(e)||e instanceof JsonFileReadError&&isMissingPathError(e.cause))return null}log.warn(`Ignoring invalid install owner marker: ${t}`);return null}function formatInstallOwnerMessage(e){return`Managed by ${e.displayName}. ${e.updateHint}`}export{readInstallOwner as n,formatInstallOwnerMessage as t};