UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

99 lines 10.6 kB
import{n as e}from"./rolldown-runtime-DkW27tQK.js";import{R as t,wr as n,z as r}from"./control-ui-foundation-Cydpkyqa.js";import{Bn as i,E as a,Eo as o,Oo as s,Sc as ee,bc as c,k as l,zn as u}from"./control-ui-core-Rwzhj6nO.js";import{$ as d,K as f,X as p,at as m,q as h,r as g,t as _}from"./lit-runtime-CV_MH99K.js";import{_ as v,_n as y,g as te,jn as ne}from"./control-ui-core-YphAl4aM.js";import{Yt as re,en as b}from"./control-ui-core-vvcQQV2m.js";import{B as x,U as S,V as C,z as w}from"./control-ui-boot-shared-BYq7Cchl.js";import{An as T,kn as E}from"./control-ui-boot-shared-DfZ39Yj9.js";import{J as D,K as O,L as k,Q as A,V as j,X as M}from"./control-ui-boot-chat-_QSl8fbH.js";import{Is as N,Ls as P,hs as F,i as I,ms as ie,n as L,r as R}from"./control-ui-boot-shared-CXVvK2AW.js";import{n as z,t as B}from"./settings-workspace-Bseic8Tf.js";import{i as V,s as H}from"./presenter-DkWDWjgv.js";import{a as U,n as W,t as G}from"./lane-table-CREVCF-J.js";function K(e,t){return D({title:e,stacked:!0,control:p`<pre class="code-block"> ${g(E(JSON.stringify(t??{},null,2)))}</pre>`})}function q(e){let t=(e.status&&typeof e.status==`object`?e.status.securityAudit:null)?.summary??null;if(!t)return h;let n=t.critical??0,r=t.warn??0,i=t.info??0,a=n>0?`danger`:r>0?`warn`:`ok`,o=n>0?b(`debug.security.critical`,{count:String(n)}):r>0?b(`debug.security.warnings`,{count:String(r)}):b(`debug.security.noCriticalIssues`),s=i>0?` · ${b(`debug.security.info`,{count:String(i)})}`:``;return D({title:b(`debug.security.audit`),description:p` ${b(`debug.security.runPrefix`)} <span class="mono">openclaw security audit --deep</span> ${b(`debug.security.runSuffix`)} `,control:A({kind:a,label:`${o}${s}`})})}function J(e){return e?p` <div class="settings-row" role="alert"> <div class="settings-row__text"> <span class="settings-row__title"> ${A({kind:`danger`,label:b(`common.failed`)})} </span> <span class="settings-row__desc">${e}</span> </div> </div> `:h}function Y(e){if(!(e.connected?e.loading:e.offlineStable))return h;let t=e.connected;return D({title:A({kind:t?`accent`:`muted`,label:b(t?`common.refreshing`:`common.offline`)}),description:b(t?`debug.refreshingSnapshots`:`debug.offlineSnapshots`)})}function ae(e){return D({title:e.event,description:a(e.ts,void 0,``),stacked:!0,control:p`<pre class="code-block"> ${g(E(V(e.payload)))}</pre>`})}function oe(e){let t=e.connected&&e.loading,n=M({title:b(`debug.snapshotsTitle`),description:b(`debug.snapshotsSubtitle`),actions:p` <button class="btn" ?disabled=${!e.connected||e.loading} @click=${e.onRefresh} > ${b(t?`common.refreshing`:`common.refresh`)} </button> `},p` ${Y(e)} ${J(e.diagnosticsError)} ${q(e)} ${K(b(`debug.status`),e.status)} ${K(b(`debug.health`),e.health)} ${K(b(`debug.lastHeartbeat`),e.heartbeat)} `),r=M({title:b(`debug.lanes.title`),description:b(`debug.lanes.subtitle`),actions:p` <button class="btn" @click=${e.onOpenOverlay}> ${b(`debug.overlay.openWithShortcut`,{shortcut:L})} </button> `},p` <div class="data-table-container command-lanes-table-wrap"> <table class="data-table command-lanes-table"> <thead> <tr> <th>${b(`debug.lanes.lane`)}</th> <th>${b(`debug.lanes.active`)}</th> <th>${b(`debug.lanes.queued`)}</th> <th>${b(`debug.lanes.group`)}</th> <th>${b(`debug.lanes.blocked`)}</th> </tr> </thead> <tbody> ${W({lanes:e.lanes,dynamic:e.dynamic})} </tbody> </table> </div> `),i=M({title:b(`debug.manualRpcTitle`),description:b(`debug.manualRpcSubtitle`)},p` ${D({title:b(`debug.method`),control:p` <select class="settings-select" aria-label=${b(`debug.method`)} .value=${e.callMethod} @change=${t=>e.onCallMethodChange(t.target.value)} > ${e.callMethod?h:p` <option value="" disabled>${b(`debug.selectMethod`)}</option> `} ${e.methods.map(e=>p`<option value=${e}>${e}</option>`)} </select> `})} ${D({title:b(`debug.paramsJson`),stacked:!0,control:p` <textarea class="settings-input" aria-label=${b(`debug.paramsJson`)} .value=${e.callParams} @input=${t=>e.onCallParamsChange(t.target.value)} rows="6" ></textarea> `})} ${D({title:b(`common.call`),control:p` <button class="btn primary" @click=${e.onCall}>${b(`common.call`)}</button> `})} ${e.callError?p` <div class="settings-row settings-row--stacked"> ${A({kind:`danger`,label:b(`debug.callFailed`)})} <pre class="code-block">${e.callError}</pre> </div> `:h} ${e.callResult?p` <div class="settings-row settings-row--stacked"> ${A({kind:`ok`,label:b(`common.ok`)})} <pre class="code-block">${g(E(e.callResult))}</pre> </div> `:h} `),a=M({title:b(`debug.modelsTitle`),description:b(`debug.modelsSubtitle`)},p` <div class="settings-row settings-row--stacked"> <pre class="code-block"> ${g(E(JSON.stringify(e.models??[],null,2)))}</pre> </div> `),o=M({title:b(`debug.eventLogTitle`),description:b(`debug.eventLogSubtitle`)},e.eventLog.length===0?j(b(`debug.noEvents`)):e.eventLog.map(e=>ae(e)));return O(p`${n} ${r} ${i} ${a} ${o}`,{wide:!0})}function X(){return(X=e((()=>{f(),_(),T(),k(),re(),l(),H(),R(),G()})))()}var Z,Q;function $(){return($=e((()=>{r(),w(),f(),d(),y(),v(),B(),s(),P(),ee(),F(),i(),R(),X(),Z=3e3,Q=class extends c{constructor(...e){super(...e),this.debugStatus=null,this.debugHealth=null,this.debugModels=[],this.debugHeartbeat=null,this.debugLanes=[],this.debugDynamic=null,this.debugCallMethod=``,this.debugCallParams=`{}`,this.debugCallResult=null,this.debugCallError=null,this.debugDiagnosticsError=null,this.eventLog=[],this.polling=new ie(this,Z,()=>{this.loadDiagnostics()},!1),this.callEpoch=0,this.diagnosticsTaskActiveClient=null,this.diagnosticsAgentId=null,this.diagnosticsTask=new x(this,{autoRun:!1,args:()=>[this.gateway.connected?this.gateway.client:null,this.context?.agentSelection.state.selectedId??null],task:([e,t],{signal:n})=>e?U(e,t,n):C,onComplete:e=>{this.diagnosticsTaskActiveClient=null,this.debugDiagnosticsError=null,this.debugStatus=e.status,this.debugHealth=e.health,this.debugModels=e.models,this.debugHeartbeat=e.heartbeat,this.debugLanes=e.lanes,this.debugDynamic=e.dynamic},onError:e=>{this.diagnosticsTaskActiveClient=null,this.debugDiagnosticsError=o(e)}}),this.gateway=new N(this,{getGateway:()=>this.context?.gateway,onIdentityChange:()=>{this.debugStatus=null,this.debugHealth=null,this.debugModels=[],this.debugHeartbeat=null,this.debugLanes=[],this.debugDynamic=null,this.debugCallResult=null,this.debugCallError=null,this.debugDiagnosticsError=null},invalidateRequests:()=>{this.diagnosticsTask.run([null,null]),this.diagnosticsTaskActiveClient=null,this.callEpoch+=1},onSnapshot:()=>{this.syncPolling(),this.ensureInitialDebug()}}),this.subscriptions=new u(this).watch(()=>this.context?.gateway,(e,t)=>e.subscribeEventLog(t),e=>{this.eventLog=e.eventLog}).watch(()=>this.context?.agentSelection,(e,t)=>e.subscribe(t),e=>{let t=e.state.selectedId;t!==this.diagnosticsAgentId&&(this.diagnosticsAgentId=t,this.debugModels=[],this.diagnosticsTask.run([null,null]),this.diagnosticsTaskActiveClient=null,this.loadDiagnostics())})}disconnectedCallback(){this.subscriptions.clear(),this.diagnosticsTask.run([null,null]),this.diagnosticsTaskActiveClient=null,this.diagnosticsAgentId=null,this.callEpoch+=1,super.disconnectedCallback()}syncPolling(){if(!this.gateway.connected||!this.gateway.client){this.polling.stop();return}this.polling.start()}ensureInitialDebug(){!this.gateway.connected||!this.gateway.client||this.debugStatus||this.diagnosticsTaskActiveClient||this.loadDiagnostics()}loadDiagnostics(){let e=this.gateway.connected?this.gateway.client:null;return!e||this.diagnosticsTaskActiveClient?Promise.resolve():(this.diagnosticsTaskActiveClient=e,this.diagnosticsTask.run([e,this.context.agentSelection.state.selectedId]))}async callDebugMethod(){let e=this.gateway.connected?this.gateway.client:null;if(!e)return;this.debugCallError=null,this.debugCallResult=null;let t=this.gateway.gateway,n=++this.callEpoch,r=()=>this.gateway.connected&&this.gateway.client===e&&this.gateway.gateway===t&&this.context.gateway===t&&this.callEpoch===n;try{let t=this.debugCallParams.trim()?JSON.parse(this.debugCallParams):{},n=await e.request(this.debugCallMethod.trim(),t);r()&&(this.debugCallResult=JSON.stringify(n,null,2))}catch(e){r()&&(this.debugCallError=o(e))}}render(){let e=oe({connected:this.gateway.connected,offlineStable:this.gateway.snapshot?.offlineStable??!1,loading:this.diagnosticsTask.status===S.PENDING,status:this.debugStatus,health:this.debugHealth,models:this.debugModels,heartbeat:this.debugHeartbeat,lanes:this.debugLanes,dynamic:this.debugDynamic,diagnosticsError:this.debugDiagnosticsError,eventLog:this.eventLog,methods:(this.context.gateway.snapshot.hello?.features?.methods??[]).toSorted(),callMethod:this.debugCallMethod,callParams:this.debugCallParams,callResult:this.debugCallResult,callError:this.debugCallError,onCallMethodChange:e=>this.debugCallMethod=e,onCallParamsChange:e=>this.debugCallParams=e,onRefresh:()=>void this.loadDiagnostics(),onOpenOverlay:I,onCall:()=>void this.callDebugMethod()});return p` <section class="content-header"> <div> <div class="page-title">${ne(`debug`)}</div> </div> </section> ${z(e)} `}},n([t({context:te,subscribe:!0})],Q.prototype,`context`,void 0),n([m()],Q.prototype,`debugStatus`,void 0),n([m()],Q.prototype,`debugHealth`,void 0),n([m()],Q.prototype,`debugModels`,void 0),n([m()],Q.prototype,`debugHeartbeat`,void 0),n([m()],Q.prototype,`debugLanes`,void 0),n([m()],Q.prototype,`debugDynamic`,void 0),n([m()],Q.prototype,`debugCallMethod`,void 0),n([m()],Q.prototype,`debugCallParams`,void 0),n([m()],Q.prototype,`debugCallResult`,void 0),n([m()],Q.prototype,`debugCallError`,void 0),n([m()],Q.prototype,`debugDiagnosticsError`,void 0),n([m()],Q.prototype,`eventLog`,void 0),customElements.get(`openclaw-debug-page`)||customElements.define(`openclaw-debug-page`,Q)})))()}$(); //# sourceMappingURL=debug-page-EiWwxMgB.js.map