UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

35 lines (34 loc) • 1.43 kB
import { i as isMissingPathError } from "./errno-DFcoqIT9.mjs"; import { t as createSubsystemLogger } from "./subsystem-BHJiy01V.mjs"; import { Et as _enum, Fn as object, Jn as string, xn as literal } from "./schemas-Cy6abvsu.mjs"; import { o as readJsonIfExists, t as JsonFileReadError } from "./json-files-Cb1h8pYs.mjs"; import path from "node:path"; import fs from "node:fs/promises"; //#region 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) }); /** Packaging owns this marker; absent or invalid files preserve normal install discovery. */ 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}`; } //#endregion export { readInstallOwner as n, formatInstallOwnerMessage as t };