openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
43 lines (42 loc) • 2.21 kB
JavaScript
import { c as resolveOpenClawStateSqlitePath } from "./openclaw-state-db.paths-DfifnSGp.mjs";
import { r as resolveActivePluginInstallRoots, t as hasActivePluginInstallRoots } from "./install-root-context-DhumTK8D.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) };
}
/** Locates unsupported JSON state without importing or changing it. */
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);
}
function legacyInstalledPluginIndexUnsupportedMessage(sourcePath) {
return `Plugin install index ${sourcePath} predates the July 2026 upgrade support window and was left unchanged. Run openclaw doctor --fix on 2026.9.5 with a pre-update backup before upgrading again: https://docs.openclaw.ai/install/updating#upgrading-very-old-versions`;
}
//#endregion
export { resolveLegacyInstalledPluginIndexStorePath as i, resolveInstalledPluginIndexStateDatabaseOptions as n, resolveInstalledPluginIndexStorePath as r, legacyInstalledPluginIndexUnsupportedMessage as t };