UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

40 lines (39 loc) • 1.82 kB
import { s as resolveOpenClawStateSqlitePath } from "./openclaw-state-db.paths-BvBEgHyD.mjs"; import { r as resolveActivePluginInstallRoots, t as hasActivePluginInstallRoots } from "./install-root-context-0HsGHGGz.mjs"; import path from "node:path"; //#region src/plugins/installed-plugin-index-store-path.ts const LEGACY_INSTALLED_PLUGIN_INDEX_STORE_PATH = path.join("plugins", "installs.json"); function resolveStoreEnv(options) { const env = options.env ?? process.env; if (options.stateDir) return { ...env, OPENCLAW_STATE_DIR: options.stateDir }; if (hasActivePluginInstallRoots()) return { ...env, OPENCLAW_STATE_DIR: resolveActivePluginInstallRoots(env).stateDir }; return env; } /** Resolves the canonical SQLite-backed installed plugin index path. */ function resolveInstalledPluginIndexStorePath(options = {}) { if (options.filePath) return options.filePath; return resolveOpenClawStateSqlitePath(resolveStoreEnv(options)); } /** Resolves state database options for the installed plugin index store. */ function resolveInstalledPluginIndexStateDatabaseOptions(options = {}) { if (options.filePath) return { ...options.env ? { env: options.env } : {}, path: options.filePath }; return { env: resolveStoreEnv(options) }; } /** Resolves the legacy JSON installed plugin index path for migration/doctor use. */ function resolveLegacyInstalledPluginIndexStorePath(options = {}) { if (options.filePath) return options.filePath; const env = options.env ?? process.env; const stateDir = options.stateDir ?? resolveActivePluginInstallRoots(env).stateDir; return path.join(stateDir, LEGACY_INSTALLED_PLUGIN_INDEX_STORE_PATH); } //#endregion export { resolveInstalledPluginIndexStorePath as n, resolveLegacyInstalledPluginIndexStorePath as r, resolveInstalledPluginIndexStateDatabaseOptions as t };