openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
3 lines • 5.3 kB
JavaScript
import{l as normalizeOptionalString}from"./string-coerce-CpTFcSwY.mjs";import{c as redactSensitiveText}from"./redact-BT59pdZ_.mjs";import{b as resolveGatewayPort}from"./paths-D_FOvGon.mjs";import{t as VERSION}from"./version-DrZ9Nfde.mjs";import{H as resolveUpdateChannelDisplay,z as normalizeUpdateChannel}from"./official-external-plugin-catalog-BkSwu5lo.mjs";import"./config-DkZ8y8Gv.mjs";import{a as projectGatewayUrlForDiagnostics}from"./connection-details-CL6thwAz.mjs";import{r as formatDurationPrecise}from"./format-duration-CDAHVcL7.mjs";import{r as formatGitInstallLabel}from"./update-check-BQE4JkTA.mjs";import"./format-relative-CyNS0X3c.mjs";import{n as resolveControlUiLinks}from"./control-ui-links-k_iiqk-l.mjs";import{a as resolveUpdateAvailability,n as formatUpdateOneLiner}from"./status.update-DyedeIOF.mjs";
//!src/commands/status-all/format.ts
function resolveStatusUpdateChannelInfo(e){return resolveUpdateChannelDisplay({configChannel:normalizeUpdateChannel(e.updateConfigChannel),currentVersion:VERSION,installKind:e.update.installKind??`unknown`,gitTag:e.update.git?.tag??null,gitBranch:e.update.git?.branch??null})}function buildStatusUpdateSurface(e){return{channelLabel:resolveStatusUpdateChannelInfo(e).label,gitLabel:formatGitInstallLabel(e.update),updateLine:formatUpdateOneLiner(e.update).replace(/^Update:\s*/i,``),updateAvailable:resolveUpdateAvailability(e.update).available}}function formatStatusServiceValue(e){const t=e.loadState?.status===`unknown`?e.loadState.detail:e.runtime?.status===`unknown`?e.runtime.detail:void 0;const n=e.loadState?.status===`unknown`||Boolean(t);if(e.installed===false&&!n&&!e.runtime?.systemd?.startRefusal)return`${e.label} not installed`;const r=e.managedByOpenClaw?`installed · `:``;const i=t?`${e.loadedText} (inspection failed: ${redactSensitiveText(t,{mode:`tools`})})`:e.loadedText;const a=e.runtimeShort?` · ${e.runtimeShort}`:[e.runtime?.status?` · ${e.runtime.status}`:``,e.runtime?.pid?` (pid ${e.runtime.pid})`:``].join(``);const o=n?redactSensitiveText(a,{mode:`tools`}):a;const s=e.installationDrift?` · ${e.installationDrift}`:``;return`${e.label} ${r}${i}${o}${s}`}function buildStatusOverviewSurfaceRows(e){const t=buildStatusUpdateSurface({updateConfigChannel:e.cfg.update?.channel,update:e.update});const n=e.decorateOk??(e=>e);const r=e.decorateWarn??(e=>e);const i=projectGatewayUrlForDiagnostics(e.gatewayConnection.url);const a=e.remoteUrlMissing?`fallback ${i}`:i;const o=e.gatewayConnection.urlSource?`${a} (${e.gatewayConnection.urlSource})`:a;const s=e.remoteUrlMissing?`misconfigured (remote.url missing)`:e.gatewayProbe?.startupPhase?`still starting (phase ${e.gatewayProbe.startupPhase})`:e.gatewayReachable?`reachable ${formatDurationPrecise(e.gatewayProbe?.connectLatencyMs??0)}`:e.gatewayProbe?.error?`unreachable (${e.gatewayProbe.error})`:`unreachable`;const c=e.gatewayReachable?`auth ${formatGatewayAuthUsed(e.gatewayProbeAuth)}`:``;const l=`${e.gatewayMode}${e.remoteUrlMissing?` (remote.url missing)`:``}`;const u=formatGatewaySelfSummary(e.gatewaySelf);const d=e.nodeOnlyGateway?.gatewayValue??`${l} · ${o} · ${e.remoteUrlMissing?r(s):e.gatewayReachable?n(s):r(s)}${e.gatewayReachable&&!e.remoteUrlMissing&&c?` · ${c}`:``}${u?` · ${u}`:``}`;const f=e.advertisedControlUiLinks?.httpUrl??(e.cfg.gateway?.controlUi?.enabled??true?resolveControlUiLinks({port:resolveGatewayPort(e.cfg),bind:e.cfg.gateway?.bind,customBindHost:e.cfg.gateway?.customBindHost,basePath:e.cfg.gateway?.controlUi?.basePath,tlsEnabled:e.cfg.gateway?.tls?.enabled===true}).httpUrl:null);const p=formatStatusServiceValue(e.gatewayService);const m=formatStatusServiceValue(e.nodeService);const h=e.decorateTailscaleOff??(e=>e);const g=e.decorateTailscaleWarn??(e=>e);let _;if(e.tailscaleMode===`off`){const t=e.includeDnsNameWhenOff?e.tailscaleDns:null;_=h(t?`off · ${t}`:`off`)}else{const t=e.tailscaleDns&&e.tailscaleHttpsUrl;const n=[e.tailscaleMode,e.includeBackendStateWhenOn?`unknown`:null,...t?[e.tailscaleDns,e.tailscaleHttpsUrl]:[`magicdns unknown`]].filter(Boolean).join(` · `);_=t?n:g(n)}const v=e.gatewayAuthWarningValue!==void 0?e.gatewayAuthWarningValue:e.gatewayProbeAuthWarning;const y=u??e.gatewaySelfFallbackValue;const b=[...e.prefixRows??[],{Item:`Dashboard`,Value:normalizeOptionalString(f)??`disabled`},{Item:`Tailscale exposure`,Value:_},{Item:`Channel`,Value:t.channelLabel}];if(t.gitLabel)b.push({Item:`Git`,Value:t.gitLabel});b.push({Item:`Update`,Value:e.updateValue??t.updateLine},{Item:`Gateway`,Value:d});if(v)b.push({Item:`Gateway auth warning`,Value:v});b.push(...e.middleRows??[]);if(y!=null)b.push({Item:`Gateway self`,Value:y});b.push({Item:`Gateway service`,Value:p},{Item:`Node service`,Value:m},{Item:`Agents`,Value:e.agentsValue},...e.suffixRows??[]);return b}function formatGatewayAuthUsed(e){const t=Boolean(e?.token?.trim());const n=Boolean(e?.password?.trim());if(t&&n)return`token+password`;if(t)return`token`;if(n)return`password`;return`none`}function formatGatewaySelfSummary(e){return e?.host||e?.ip||e?.version||e?.platform?[e.host?e.host:null,e.ip?`(${e.ip})`:null,e.version?`app ${e.version}`:null,e.platform?e.platform:null].filter(Boolean).join(` `):null}export{buildStatusUpdateSurface as n,resolveStatusUpdateChannelInfo as r,buildStatusOverviewSurfaceRows as t};