UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

3 lines • 2.44 kB
import{i as collectNestedErrorCandidates}from"./error-coercion-DlKnt6w-.mjs";import{t as ExitError}from"./runtime-DIcLIHcp.mjs";import{t as formatErrorMessage}from"./errors-D37BJTfI.mjs";import{n as OpenClawStateOwnershipError}from"./sqlite-lifecycle-errors-DMaudCZS.mjs";import{r as isSqliteSchemaMismatchError}from"./sqlite-schema-issues-CTIzzA67.mjs";import{r as findStartupMaintenanceRequiredError}from"./startup-maintenance-required-Cz4Y_ofl.mjs";import{s as isTerminalSqliteIntegrityError}from"./sqlite-integrity-BzUEDiX5.mjs";import{t as ConfigMutationConflictError}from"./mutation-conflict-qTMp0e4U.mjs";import{g as isAgentDatabaseOwnershipMismatchError}from"./agent-database-admission-DiJx9iIl.mjs"; //!src/commands/doctor-startup-migration-refusal.ts function isStartupConfigRefusal(e){return Boolean(findStartupMaintenanceRequiredError(e))||isAgentDatabaseOwnershipMismatchError(e)||collectNestedErrorCandidates(e).some(e=>e instanceof Error&&(e instanceof OpenClawStateOwnershipError||e instanceof ConfigMutationConflictError||isSqliteSchemaMismatchError(e)||isTerminalSqliteIntegrityError(e)||e.name===`SqliteRepairableForeignKeyError`))}function rethrowStartupConfigFailure(e){if(e instanceof ExitError||!isStartupConfigRefusal(e))throw e;return throwStartupMigrationRefusal(e instanceof ConfigMutationConflictError?`${formatErrorMessage(e)}. Retry startup so the changed config can be validated.`:formatErrorMessage(e),e)}function throwStartupMigrationRefusal(e,t){console.error(e);throw Object.assign(new ExitError(78,e),{cause:t})}function throwStartupMigrationGuardRejected(){throw new Error(`OpenClaw startup migrations were skipped because the selected config changed during startup; refusing to report the gateway ready. Retry startup so the new config can be validated.`)}async function refuseStartupMigrationsForLiveGatewayOwner(e){if(e.VITEST||e.NODE_ENV===`test`)return;const{readActiveGatewayLockIdentity:t}=await import(`./gateway-lock-BSiLZmt0.mjs`);const n=await t({env:e});if(n)throwStartupMigrationRefusal(`Another gateway (pid ${n.pid}) already owns this state directory; refusing to run automatic startup migrations or report the gateway ready. Stop it with "openclaw gateway stop" (or select a different OPENCLAW_STATE_DIR), then retry startup.`)}export{throwStartupMigrationGuardRejected as i,refuseStartupMigrationsForLiveGatewayOwner as n,rethrowStartupConfigFailure as r,isStartupConfigRefusal as t};