openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
3 lines • 1.2 kB
JavaScript
import{t as ExitError}from"./runtime-DIcLIHcp.mjs";import{t as formatErrorMessage}from"./errors-D37BJTfI.mjs";import{t as formatCliCommand}from"./command-format-D7KhNLP0.mjs";import{r as isTerminalInteractive}from"./terminal-interactivity-ijJuF5PT.mjs";
//!src/cli/invalid-config-recovery.ts
async function offerInvalidConfigRecovery(e){const t=formatCliCommand(`openclaw doctor --fix`);const printCommand=()=>{e.runtime.error(`Run "${t}" to repair the config, then retry.`)};if(!isTerminalInteractive()){printCommand();return false}const{promptYesNo:n}=await import(`./prompt-57-vh2Zi.mjs`);if(!await n(`Run "${t}" now?`,true)){printCommand();return false}try{if(e.runDoctor)await e.runDoctor();else{const{doctorCommand:t}=await import(`./doctor-DVYSfLDc.mjs`);await t(e.runtime,{repair:true})}}catch(n){if(n instanceof ExitError)throw n;e.runtime.error(`Failed to run "${t}": ${formatErrorMessage(n)}`);return false}try{await e.retry();return true}catch(n){const{isInvalidConfigError:r}=await import(`./io.invalid-config-Cw04snJA.mjs`);if(!r(n))throw n;e.runtime.error(`Config is still invalid after "${t}":`);e.runtime.error(formatErrorMessage(n));return false}}export{offerInvalidConfigRecovery};