UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

4 lines • 16.8 kB
import{n as e,r as t}from"./rolldown-runtime-CNOWq4Kh.js";import{Oc as n,Tc as r,zc as i}from"./control-ui-connection-Bfj9beF_.js";import{dM as a,fM as o,mM as s,uM as c}from"./control-ui-boot-shared-DFTSUQQ0.js";var l;function u(){return(u=e((()=>{l=[`requested`,`staging`,`validating`,`repairing`,`activating`,`restarting`,`verifying`,`finished`]})))()}function d(e=e=>e){return`Inspect \`${e(`openclaw update status`)}\` and \`${e(`openclaw doctor`)}\`. Wait for the owning updater and its child processes to stop before running \`${e(`openclaw update repair`)}\`. The timeout does not make rollback or removal of retained update state safe.`}var f;function p(){return(p=e((()=>{f={"external-supervisor-update-required":"This Gateway is managed by an external supervisor. Use your server or deployment's update workflow to update OpenClaw and restart the Gateway. The Control UI and `openclaw update` cannot update this installation. No package changes or Gateway restart were attempted.","container-image-install":`Pull or build the target Docker/container image, then redeploy it with the same state/config mounts. No package changes or Gateway restart were attempted.`,"unmanaged-package-install":`No npm, pnpm, or Bun global owner was detected. Reinstall using the original method; use Yarn for Yarn global installs. No package changes or Gateway restart were attempted.`,"package-update-requires-cli":"Run `openclaw update` through this install's npm, pnpm, or Bun global launcher. No package changes or Gateway restart were attempted."}})))()}function m(e,t={}){if(!Number.isFinite(e))return`unknown`;let n=t.decimals??1,r=t.unit??`s`,i=(Math.max(0,e)/1e3).toFixed(Math.max(0,n)).replace(/\.0+$/,``).replace(/(\.\d*[1-9])0+$/,`$1`);return r===`seconds`?`${i} seconds`:`${i}s`}function h(e,t={}){if(!Number.isFinite(e))return`unknown`;let n=Math.max(0,Math.round(e));return n<1e3?`${n}ms`:m(e,{decimals:t.decimals??2,unit:t.unit??`s`})}function g(){return(g=e((()=>{})))()}function _(e){return`Doctor config promotion refused for top-level keys: ${e.keys.join(`, `)||`none recorded`}. ${e.reason}: ${e.message}`}function v(e){return e.reason===`expired`?`lease loss: expired; expiredByMs=${e.expiredByMs}; expiresAt=${e.expiresAt}; heartbeatAgeMs=${e.heartbeatAgeMs}${e.renewalTimerLateByMs===void 0?``:`; renewal timer late ${e.renewalTimerLateByMs} ms`}`:e.reason===`replaced`?`lease loss: replaced; owner=[redacted]`:`lease loss: ${e.reason}`}function y(e){let t=[[`prefix`,e.prefix],[`package`,e.packageRoot],[`running install`,e.runningRoot],[`running prefix`,e.runningPrefix],[`launcher`,e.launcher],[`launcher target`,e.launcherTarget]];return[`Warning: npm destination ownership ${e.ownership}; cause ${e.cause}; kind ${e.destinationKind}`,...t.flatMap(([e,t])=>t===null?[]:[`${e} \`${t}\``]),`Next step: ${S}`].join(`; `)}function b(e){let t=e.slice(-3),n=e.find(e=>(e.failureFacts?.length??0)>0);return n&&!t.includes(n)?[n,...t.slice(-2)]:t}function x(e){let t=e.destination?y(e.destination):e.message;return`Failing check ${e.check} (${e.code})${e.location?` at ${e.location}`:``}${e.pluginId?`; plugin ${e.pluginId}`:``}${e.affectedKey?`; key ${e.affectedKey}`:``}${t?`: ${t}`:``}${e.leaseLoss?`; ${v(e.leaseLoss)}`:``}`}var S;function C(){return(C=e((()=>{S=`Use the destination's owning installation and service account, or correct the npm prefix mismatch before retrying: https://docs.openclaw.ai/install/update-troubleshooting#node-and-global-install-permissions. Do not overwrite another installation.`})))()}function w(e,t=e=>e){switch(e){case`inside-gateway-process-tree`:case`inside-gateway-service`:case`service-membership-unverified`:case`service-ancestry-unverified`:return`Run \`${t(`openclaw update repair`)}\` from a terminal outside the Gateway process tree. Do not run this repair through the Gateway's exec tool.`;case`inside-triage-process-tree`:return`Run \`${t(`openclaw update repair`)}\` from a terminal outside automatic triage and the Gateway process tree. Do not stop the Gateway from its fixing subtree.`;default:return}}function T(){return(T=e((()=>{})))()}function E(e){return[...new Set(e.flatMap(e=>(e.step===`reconcile:settle`||e.status===`completed`&&e.step.startsWith(`warning:`))&&e.detail?[e.detail]:[]))]}function D(e){let t=e=>i(e,{style:`iec`,maxUnit:`giga`,separator:` `,fractionDigits:(e,t)=>+(t===`giga`&&e<10)}),n=`${t(e.sqliteBytes)} SQLite and ${e.pluginBytes===null?`plugin files not yet inspected`:`${t(e.pluginBytes)} plugin files`}`,r=e.candidates.map(({directory:e,availableBytes:n,allocationError:r})=>`${e}: ${n===null?`free space unavailable`:`${t(n)} available`}${r?` (unavailable: ${r})`:``}`).join(`; `),a=e.selection?`Snapshot location: ${e.selection.directory} (${e.selection.kind}).`:e.reason===`snapshot-location-unavailable`?`No snapshot location with enough free space could be allocated.`:`No snapshot location has enough measured free space.`,o=e.reason===`snapshot-location-unavailable`?` Fix the reported path or permissions, or set TMPDIR to a writable directory with sufficient space, then retry the update.`:` Free space or set TMPDIR to a directory on a filesystem with sufficient space, then retry the update.`;return`${a} Snapshot requires ${e.pluginBytes===null?`at least `:``}${t(e.requiredBytes)} for ${n} and scratch space. Checked ${r}.${e.selection?``:o}`}function O(){return(O=e((()=>{r()})))()}var k=t({renderUpdateRunReport:()=>R});function A(e,t){return e.versionMatch===void 0?{kind:`unobserved`}:e.versionMatch?{kind:`verified`}:e.runningVersion&&t.version&&e.runningVersion!==t.version?{kind:`mismatch`,field:`version`}:e.runningBuildId&&t.buildId&&e.runningBuildId!==t.buildId?{kind:`mismatch`,field:`build`}:{kind:`unavailable`}}function j(e,t){let n=A(e,t);return n.kind===`mismatch`?`${n.field} mismatch`:{unobserved:null,verified:`version verified`,unavailable:`service identity unavailable`}[n.kind]}function M(e){return e.kind===`responding`?`Current health: Gateway answered on the recorded port (${F(e.version,120)}).`:`Current health unavailable; saved verification describes the update attempt only.`}function N(e,t){if(t?.exitCode!==0||t.failureFacts?.length)return;let{recovery:n}=e;return n?.serviceRestartSafe&&n.service===`healthy`?n.version:e.versionMatch&&(e.coreReady??e.readyz)&&e.settled?e.runningVersion:void 0}function P(e,t,n=e.recovery?.reason??`not-recorded`){let{recovery:r}=e;if(!t){if(!r)return;let e=r.packageRollbackVerified;if(!r.serviceRestartSafe)return`${e?`package rollback verified; service restart not verified`:`not verified`} (${n})`;let t=F(r.version,120);return r.service===`healthy`?`${e?`package rollback verified; `:``}Gateway serving ${t}; health verified`:r.service!==`failed`&&!e?`verified safe to restart`:`${e?`package rollback verified (${t})`:`runtime files verified`}; Gateway health ${r.service===`failed`?`failed`:`unverified`} (${n}). Run \`openclaw gateway status --deep\` to check the serving version and readiness.`}let i=N(e,t);if(i){let e=r?.serviceRestartSafe===!1?`; restart remains unsafe (${n})`:``;return`${r?.packageRollbackVerified?`package rollback verified; `:``}verified serving ${F(i,120)}${e}`}let a=t.failureFacts?.[0]?.code;return a?a===`gateway-probe-failed`?`recovery check failed (${a})`:a===`stopped-free`?`not serving (${a})`:`readiness unverified (${a})`:`Gateway readiness is pending; recovery check completed without verified readiness`}function F(e,t){return e.length<=t?e:`${n(e,0,t-1)}…`}function I(e){let t=e.sha?.slice(0,8);return e.version?`${e.version}${t?` (${t})`:``}`:t}function L(e,t){if(e.target?.installationMethod===`ocm`)return t?[]:e.origin.nextAction?[e.origin.nextAction]:[];if(e.status===`running`)return[`Check progress with openclaw update status.`];if(e.status!==`failed`)return[];let n=w(e.reason);if(n)return t?[]:[n];if(e.reason===`legacy-driver-expired`)return[o];if(e.reason===`update-activation-timeout`)return t?[]:[d()];if(e.reason===`global-install-foreign-destination`)return t?[]:[`Next step: ${S}`];if(e.reason===`state-migrated-no-rollback`||e.verification.rollbackOutcome?.reason===`state-migrated-no-rollback`)return t?[]:[`State may have changed during migration, so rolling back code alone is unsafe. Keep the new installation and backups; inspect openclaw update status and run openclaw doctor before recovery.`];let r=e.reason&&Object.hasOwn(B,e.reason)?B[e.reason]:void 0,i=r?[r]:[];return t||i.push(e.reason===`repair-failed`?`Run openclaw triage to diagnose this repair failure.`:`Run openclaw triage to diagnose and repair the failed update.`),i}function R(e,t={}){let n=a(e),r=t.currentHealth??(e.target?.installationMethod!==`ocm`&&e.status!==`running`&&t.nextAction===void 0&&e.origin.nextAction?{kind:`unavailable`}:void 0),i=e.status===`failed`&&r?.kind===`responding`&&!!e.after.version&&r.version===e.after.version&&e.verification.recovery?.serviceRestartSafe===!1&&e.verification.recovery.reason===`runtime-verification-failed`&&!e.steps.some(e=>e.step===`doctor process settlement`),o=I(e.before),s=I(e.after),c=F(e.reason?.trim()||e.status===`failed`&&e.steps.find(e=>e.status===`failed`&&e.step!==`requested`)?.step||`unknown reason`,240),l=!r&&e.verification.serviceRunning===!0?e.verification.runningVersion:void 0,u=e.status===`failed`&&(e.reason===`node-runtime-preflight`||e.reason===`preflight-node-runtime-incompatible`),d=E(e.steps).map(e=>`Warning: ${e}`),p;switch(e.status){case`succeeded`:{let e=d.length>0?`; ${d.length} warning${d.length===1?` needs`:`s need`} attention`:``;p=s?`✅ OpenClaw updated to ${s}${o?` (from ${o})`:``}${e}.`:`✅ OpenClaw updated${e}.`;break}case`failed`:p=n?`ℹ️ OpenClaw abandoned update reconciled.`:e.reason===`legacy-driver-expired`?`ℹ️ OpenClaw update abandoned: ${c}.`:u?`⚠️ OpenClaw could not complete the update. A required system check failed.`:`⚠️ OpenClaw ${e.reason===`repair-failed`?`repair`:`update`} failed: ${c}.`;break;case`skipped`:p=e.reason===`still-starting`?`ℹ️ OpenClaw${s?` ${s}`:``} installed; Gateway still starting; readiness unverified; recovery backups retained.`:e.reason===`gateway-readiness-unverified`?`ℹ️ OpenClaw${s?` ${s}`:``} installed; Gateway readiness unverified; recovery backups retained.`:e.reason===`doctor-maintenance-pending`?`ℹ️ OpenClaw repair pending: Doctor maintenance remains unfinished.`:`ℹ️ OpenClaw update skipped: ${c}.`;break;case`rolled-back`:p=`↩️ OpenClaw update rolled back to ${s??l??o??`the previous version`}: ${c}.`;break;case`running`:p=`${z}${e.target?.installationMethod===`ocm`?`managed by OCM`:e.phase}.`}p=F(p,500);let m=t.markdownLimit??1500,g=e.status===`succeeded`?[...d]:[];r&&(i||!e.origin.nextAction&&!t.nextAction)&&(g.push(M(r)),i&&g.push(`The target version is serving; the saved runtime verification failure no longer applies. The recorded update outcome is unchanged.`)),t.mode&&t.mode!==`unknown`&&g.push(`Update mode: ${t.mode}`);let v=e.target&&(I(e.target)||e.target.tag||e.target.channel);v&&g.push(`Update target: ${F(v,120)}`);let y=e.origin.admission;if(y){let e=y.candidateVersion?` (${F(y.candidateVersion,120)})`:``;g.push(`Update safety checks ran in the ${y.owner} updater${e}.`),y.checks?.length&&g.push(`Admission checks: ${y.checks.map(e=>`${F(e.name,120)}: ${e.status}`).join(`, `)}.`),y.fallbackReason&&g.push(`Admission fallback: ${F(y.fallbackReason,500)}`)}for(let t of e.steps)e.status===`running`&&t.status===`in_progress`&&t.detail&&g.push(`Waiting: ${t.step}${t.startedAtMs===void 0?``:` (started ${new Date(t.startedAtMs).toISOString()})`} — ${t.detail}`),t.snapshotCapacity&&g.push(D(t.snapshotCapacity)),t.detail&&(t.step.startsWith(`diagnostic:database snapshot`)||t.step.startsWith(`diagnostic:database migration writes`)||t.step.startsWith(`diagnostic:database rollback`))&&g.push(t.detail),t.configWriteRefusal&&g.push(_(t.configWriteRefusal));let S=e.steps.flatMap(e=>e.configChange?[e.configChange]:[]),C=[...new Set(S.flatMap(e=>e.kind===`key`?[e.key]:[]))];C.length&&g.push(`Doctor changed config keys: ${C.join(`, `)}.`);for(let e of new Set(S.flatMap(e=>e.kind===`migration`?[e.message]:[])))g.push(`Warning: Doctor migration: ${e}`);let w=e.steps.filter(e=>V.has(e.step)),T=w.map(e=>{let t=e.startedAtMs!=null&&e.endedAtMs!=null?` (${h(Math.max(0,e.endedAtMs-e.startedAtMs))})`:``;return`${e.step}${t}`});if(T.length){g.push(`Phases: ${T.join(` → `)}`);let t=w.reduce((e,t)=>e+(t.startedAtMs!=null&&t.endedAtMs!=null?Math.max(0,t.endedAtMs-t.startedAtMs):0),0),n=e.createdAtMs==null||e.finishedAtMs==null?0:e.finishedAtMs-e.createdAtMs;n-t>=1e3&&g.push(`Total: ${h(n)}, including work outside these phases.`)}for(let t of b(e.steps.filter(e=>e.status===`failed`))){let e=`Failed: ${t.step}${t.detail?` — ${t.detail}`:``}`;g.push(F(e,300)),t.stderrTail&&(t.termination===`signal`||t.step===`candidate-state-snapshot`)&&g.push(`Stderr${t.termination===`signal`?` (${t.signal??`unknown signal`})`:``}:\n${t.stderrTail}`),g.push(...(t.failureFacts??[]).slice(0,5).map(n=>x({...n,message:e.length<=300&&n.message&&t.detail?.includes(n.message)?void 0:n.message})))}e.status!==`succeeded`&&g.push(...d);let O=e.verification,k=e.steps.findLast(e=>e.step===`gateway recovery verification`),A=!i&&k&&P(O,k);A&&g.push(`Recorded recovery: ${A}.`);let N=[O.booted?`gateway booted`:void 0,O.serviceRunning===void 0?void 0:O.serviceRunning?`service running${O.runningVersion?` (${F(O.runningVersion,120)})`:``}`:`service stopped`,j(O,e.after),O.channelsReady===void 0?void 0:O.channelsReady?`channels ready`:`channels not ready`,O.readyz===void 0?void 0:O.readyz?`HTTP ready`:`HTTP not ready`,O.coreReady===void 0?void 0:O.coreReady?`core ready`:`core not ready`,O.pluginErrors?.length?`${O.pluginErrors.length} plugin activation error(s)`:void 0].filter(Boolean);N.length&&g.push(`Recorded verification: ${N.join(`; `)}.`);for(let t of e.repair.slice(-3))g.push(F(`Repair ${t.attempt}: ${t.status}${t.summary||t.reason?` — ${t.summary??t.reason}`:``}`,300));e.downtimeMs!=null&&g.push(`Gateway downtime: ${h(e.downtimeMs)}.`);let R=e.status===`skipped`&&e.reason&&Object.hasOwn(f,e.reason)?f[e.reason]:void 0,B=t.nextAction??(i?void 0:e.origin.nextAction)??R,H=B&&r?`${M(r)} ${r.kind===`responding`?`This observation supersedes saved claims that the Gateway is stopped; other recovery constraints still apply. The recorded update outcome is unchanged.`:`Check current Gateway status before acting on this saved advice.`}\nHistorical recovery advice: “${B}”`:B,U=e.repair.at(-1)?.reason,W=U===`requester-revoked`||U===`repair-requires-config-change`?U:e.reason,G=e.status===`failed`&&W===`requester-revoked`?H?`Repair stopped because the chat requester is no longer a command owner. Further recovery requires a current command owner.`:`Repair stopped because the chat requester is no longer a command owner. A current command owner must start a new update, or the operator can run openclaw triage locally.`:e.status===`failed`&&W===`repair-requires-config-change`?H?`Doctor could not promote config changes. Review the named keys and writer refusal before continuing recovery.`:`Doctor could not promote config changes. Review the named keys and writer refusal, then run openclaw doctor --fix under your own authority, or openclaw triage.`:void 0,K=n?[]:e.status===`running`?t.nextAction?[t.nextAction]:L(e):G?[G,...H?[H]:[]]:[...new Set([R?void 0:t.doctorHint??O.doctorHint??e.origin.doctorHint,...L(e,H),H].filter(e=>!!e))],q=K.at(-1);if(u||e.reason===`doctor-maintenance-pending`){let e=[`Details:`,`Reason code: ${c}`,...g,...K.filter(e=>e!==q)],t=[p,...q?[F(q,1100)]:[],``].join(` `);return{headline:p,lines:[...q?[q,``]:[],...e],markdown:`${t}\n${F(e.join(` `),m-t.length-1)}`}}g.push(...K);let J=[p,...g.filter(e=>e!==q)].join(` `),Y=q?`\n${F(q,1100)}`:``;return{headline:p,lines:g,markdown:`${F(J,m-Y.length)}${Y}`}}var z,B,V;function H(){return(H=e((()=>{u(),p(),g(),C(),T(),s(),c(),O(),z=`⬆️ OpenClaw update in progress: `,B={"preflight-insufficient-space":`Free space on the preflight staging and package-manager store filesystems, then rerun the update.`,"pnpm-corepack-missing":`This pnpm checkout could not auto-enable pnpm because corepack is missing. Install pnpm manually or install Node with corepack available, then rerun the update command.`,"pnpm-corepack-enable-failed":`Run corepack enable manually or install pnpm manually, then rerun the update command.`,"pnpm-npm-bootstrap-failed":`This pnpm checkout could not bootstrap pnpm from npm automatically. Install pnpm manually, then rerun the update command.`,"preferred-manager-unavailable":`Install the checkout's declared package manager manually, then rerun the update command.`},V=new Set(l)})))()}export{l as a,k as i,R as n,u as o,A as r,H as t};