UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

46 lines (45 loc) • 2.09 kB
import { t as _usingCtx } from "./usingCtx-rhpPzaNq.mjs"; import { t as CLIENT_CREDENTIAL_CUTOVER_SCHEMA_VERSION } from "./openclaw-state-db-contract-DfPjvL0M.mjs"; import { s as resolveOpenClawStateSqlitePath } from "./openclaw-state-db.paths-R3ArRCcz.mjs"; import { a as isStatePostgres } from "./openclaw-state-db-engine-sM0tpxNy.mjs"; import { r as openClientCredentialCustody } from "./client-credential-store-rd7DZXgD.mjs"; import { t as preparePostgresClientCredentials } from "./startup-client-credentials-D3J07QiZ.mjs"; import fs from "node:fs"; //#region src/commands/doctor-client-credentials.ts /** Runs under Doctor's maintenance owner; startup never grants this identity change. */ async function prepareDoctorClientCredentials(e) { if (!isStatePostgres() || !fs.existsSync(resolveOpenClawStateSqlitePath())) return true; if (e.schemas.pendingMigrations?.some((e) => e.kind === "state" && e.foundVersion < 29)) { if (e.maintenanceActive) await preparePostgresClientCredentials(process.env, e.runtime); return true; } let t; try { var n = _usingCtx(); t = n.u(openClientCredentialCustody(process.env, { readOnly: true, migration: true })) !== void 0; } catch (e) { n.e = e; } finally { n.d(); } if (t) { if (e.maintenanceActive) await preparePostgresClientCredentials(process.env, e.runtime); return true; } e.runtime.log("Local client credentials are missing. Repair gives clients on this host new identities, so they must re-pair. Paired remote devices keep working; their pairing records stay in PostgreSQL."); if (!(e.maintenanceActive && (e.options.repair === true || e.options.yes === true) && (e.options.yes === true || await e.prompter.confirmRuntimeRepair({ message: "Create new local client identities?", initialValue: false, requiresInteractiveConfirmation: true })))) { e.runtime.log("Local credentials were not repaired. Run openclaw doctor --fix --yes."); return false; } await preparePostgresClientCredentials(process.env, e.runtime, true); return true; } //#endregion export { prepareDoctorClientCredentials };