openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
43 lines (42 loc) • 1.98 kB
JavaScript
import { s as resolveOpenClawStateSqlitePath } from "./openclaw-state-db.paths-R3ArRCcz.mjs";
import { r as resolveActivePluginInstallRoots, t as hasActivePluginInstallRoots } from "./install-root-context-CeM6pu6m.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(e) {
const t = e.env ?? process.env;
if (e.stateDir) return {
...t,
OPENCLAW_STATE_DIR: e.stateDir
};
if (hasActivePluginInstallRoots()) return {
...t,
OPENCLAW_STATE_DIR: resolveActivePluginInstallRoots(t).stateDir
};
return t;
}
/** Resolves the canonical SQLite-backed installed plugin index path. */
function resolveInstalledPluginIndexStorePath(e = {}) {
if (e.filePath) return e.filePath;
return resolveOpenClawStateSqlitePath(resolveStoreEnv(e));
}
/** Resolves state database options for the installed plugin index store. */
function resolveInstalledPluginIndexStateDatabaseOptions(e = {}) {
if (e.filePath) return {
...e.env ? { env: e.env } : {},
path: e.filePath
};
return { env: resolveStoreEnv(e) };
}
/** Locates unsupported JSON state without importing or changing it. */
function resolveLegacyInstalledPluginIndexStorePath(e = {}) {
if (e.filePath) return e.filePath;
const t = e.env ?? process.env;
const n = e.stateDir ?? resolveActivePluginInstallRoots(t).stateDir;
return path.join(n, LEGACY_INSTALLED_PLUGIN_INDEX_STORE_PATH);
}
function legacyInstalledPluginIndexUnsupportedMessage(e) {
return `Plugin install index ${e} uses a retired JSON format and was left unchanged. Run openclaw doctor --fix to archive the original bytes in the retired-state recovery archive and continue.`;
}
//#endregion
export { resolveLegacyInstalledPluginIndexStorePath as i, resolveInstalledPluginIndexStateDatabaseOptions as n, resolveInstalledPluginIndexStorePath as r, legacyInstalledPluginIndexUnsupportedMessage as t };