openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
72 lines • 5.81 kB
JavaScript
import{n as e}from"./rolldown-runtime-8BhlS34s.js";import{a as t,l as n,qr as r}from"./control-ui-foundation-ZY_Flbbd.js";import{hu as i,lu as a,su as o,uu as s}from"./control-ui-core-3P365fbR.js";import{$ as c,X as l,Y as u,nt as d,ut as f}from"./lit-runtime-P5vbNq6b.js";import{Do as p,Eo as m,Oo as h}from"./control-ui-boot-shared-CG9HtEG-.js";import{n as g,t as _}from"./en-update-actions-B4FZH2_u.js";import{n as v,t as y}from"./stream-auto-follow-controller-BZ0UzGsg.js";function b(e){let n=h(e);if(t.some(e=>e===n))return i(`updates.run.phase.${n}`);let r=x[n],a=r?i(`updates.run.stepLabel.${r}`):n.replace(/[-_:]+/gu,` `).replace(/^./u,e=>e.toUpperCase());return e.startsWith(`warning:`)?i(`updates.run.stepWarning`,{step:a}):a}var x,S,C,w;function T(){return(T=e((()=>{u(),d(),n(),m(),s(),_(),a(),v(),g(),x={"snapshot-space-preflight":`snapshotSpace`,"updater-runtime-retention":`prepareUpdater`,"candidate-snapshot":`snapshot`,"git fetch":`fetch`,"git fetch tags":`fetch`,"git fetch target tag":`fetch`,"global update":`update`,"global update (omit optional)":`update`,install:`install`,build:`build`,"ui:build":`buildUi`,doctor:`doctor`},S={completed:`✓`,in_progress:`◌`,pending:`○`,failed:`×`,skipped:`−`},C={pass:`✓`,warn:`!`,fail:`×`,pending:`○`},w=class extends o{constructor(...e){super(...e),this.run=null,this.connected=!0,this.streamFollow=new y(this,{selector:`.update-run-view__details`,isEnabled:()=>!0,captureCurrent:()=>{let e=this.run?.runId;return()=>this.isConnected&&this.run?.runId===e}}),this.stepsFollow=new y(this,{selector:`.update-run-view__step-scroll`,isEnabled:()=>!!this.querySelector(`.update-run-view__step-list`)?.open,captureCurrent:()=>{let e=this.run?.runId;return()=>this.isConnected&&this.run?.runId===e}})}updated(e){if(super.updated(e),e.has(`run`)){let t=e.get(`run`);this.streamFollow.schedule(t?.runId!==this.run?.runId),this.stepsFollow.schedule(t?.runId!==this.run?.runId)}}renderStep(e,t=b(e.step)){let n=e.detail,r=i(`updates.run.step.${e.status}`);return c`<li
class="update-run-view__step update-run-view__step--${e.status}"
data-step=${e.step}
data-status=${e.status}
title=${e.step}
aria-label=${`${t}: ${r}`}
>
<span class="update-run-view__mark" aria-hidden="true">${S[e.status]}</span>
${n?c`<details class="update-run-view__step-detail">
<summary>${t}</summary>
<pre class="update-run-view__step-output" tabindex="0" aria-label=${t}>
${n}</pre>
</details>`:c`<span>${t}</span>`}
<span class="update-run-view__step-status">${r}</span>
</li>`}render(){if(!this.run)return l;let e=p(this.run,this.connected);return c`<section
class="update-run-view"
data-run-id=${this.run.runId}
data-run-status=${this.run.status}
aria-label=${i(`updates.run.title`)}
>
<header class="update-run-view__heading">
<h3 role="status" aria-live="polite">${e.headline}</h3>
${e.compactLabel?c`<span class="update-run-view__progress">${e.compactLabel}</span>`:l}
</header>
${!this.connected&&!e.terminal?c`<p class="update-run-view__connection">${i(`updates.run.reconnecting`)}</p>`:l}
${e.phases.length?c`<ol class="update-run-view__phases" aria-label=${i(`updates.run.phases`)}>
${e.phases.map(e=>this.renderStep(e,e.label))}
</ol>`:l}
${e.steps.length?c`<details
class="update-run-view__step-list"
@toggle=${e=>{e.currentTarget instanceof HTMLDetailsElement&&e.currentTarget.open&&this.stepsFollow.schedule(!0)}}
>
<summary>${i(`updates.run.steps`)}</summary>
<ol
class="update-run-view__step-scroll"
tabindex="0"
aria-label=${i(`updates.run.steps`)}
@scroll=${e=>this.stepsFollow.handleScroll(e)}
>
${e.steps.map(e=>this.renderStep(e))}
</ol>
</details>`:l}
<details
class="update-run-view__diagnostics"
open
@toggle=${e=>{e.currentTarget instanceof HTMLDetailsElement&&e.currentTarget.open&&this.streamFollow.schedule(!0)}}
>
<summary>
${i(`updates.run.details`)}
${e.detailStep?c`<span title=${e.detailStep}>${b(e.detailStep)}</span>`:l}
</summary>
<pre
class="update-run-view__details"
tabindex="0"
aria-label=${i(`updates.run.details`)}
@scroll=${e=>this.streamFollow.handleScroll(e)}
>
${e.details||i(e.detailStep===`updater-runtime-retention`?`updates.run.prepareUpdaterDetails`:`updates.run.noDetails`)}</pre>
</details>
${e.oracles.length?c`<ul class="update-run-view__oracles" aria-label=${i(`updates.run.verification`)}>
${e.oracles.map(e=>c`<li data-oracle=${e.name} data-state=${e.state} class="update-run-view__oracle update-run-view__oracle--${e.state}"><span aria-hidden="true">${C[e.state]}</span><span>${i(`updates.run.oracle.${e.name}`)}</span><small>${i(`updates.run.oracleState.${e.state}`)}</small></li>`)}
</ul>`:l}
${e.terminal?c`<section
class="update-run-view__report ${e.reconciled?``:`update-run-view__report--${this.run.status}`}"
aria-label=${i(`updates.run.report`)}
>
<h4>${e.report.headline}</h4>
<div class="update-run-view__report-body" tabindex="0">
${e.report.lines.map(e=>c`<p>${e}</p>`)}
</div>
</section>`:l}
</section>`}},r([f({attribute:!1})],w.prototype,`run`,void 0),r([f({type:Boolean})],w.prototype,`connected`,void 0),customElements.get(`openclaw-update-run-view`)||customElements.define(`openclaw-update-run-view`,w)})))()}export{T as t};