UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

1 lines • 3.6 kB
import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{fi as t,vi as n}from"./control-ui-connection-Bfj9beF_.js";import{QA as r,Qj as i,Xj as a,ZA as o,Zj as s,dj as c,mj as l}from"./control-ui-boot-shared-DFTSUQQ0.js";import{B as u,C as d,F as f,O as p,Rt as m,U as h,d as g,f as _,g as v,gt as y,j as b,l as x,s as S,u as C,x as w}from"./solid-runtime-C416s-HC.js";import{E as T}from"./route-controls-runtime-Bx6nx3QW.js";import{c as E,d as D,i as O,l as k,n as A,o as j,s as M,t as N,u as P}from"./exec-approval-card-solid-dwfmcQpU.js";function F(e){let t=e.queue.filter(t=>t.id!==e.activeId);if(t.length===0)return;let n=l(`execApproval.morePending`,{count:String(t.length)});var r=R(),i=r.firstChild;return v(r,`aria-label`,n),g(i,n),g(r,b(d,{each:t,children:t=>{let n=t.request.command,r=t.request.agentId?.trim(),i=r||`—`;var a=z(),o=a.firstChild,s=o.nextSibling;return a._$$click=()=>e.onSelect(t.id),g(a,b(p,{when:r,get fallback(){return B()},children:e=>b(N,{get agentId(){return e()},class:`exec-approval-list__agent`})}),o),v(o,`title`,n),g(o,n),g(s,b(E,{get expiresAtMs(){return t.expiresAtMs},compact:!0})),x(()=>l(`execApproval.reviewRequest`,{agent:i,command:n}),e=>{v(a,`aria-label`,e)}),a}}),null),r}function I(e){return e.composedPath().some(e=>e instanceof Element&&e.closest(`input, textarea, [contenteditable]:not([contenteditable='false'])`)!==null)}function L(e){return I(e)?null:i(a.approveAlways,e)?`allow-always`:i(a.modifiedEnter,e)?`allow-once`:i(a.denyApproval,e)?`deny`:null}var R,z,B,V,H,U;function W(){return(W=e((()=>{C(),h(),s(),c(),n(),r(),P(),j(),T(),R=w(`<div class=exec-approval-list><div class=exec-approval-list__heading>`),z=w(`<button class=exec-approval-list__item type=button><span class="exec-approval-list__command mono"></span><span class=exec-approval-list__expiry aria-hidden=true>`),B=w(`<span class=exec-approval-list__agent aria-hidden=true>`),V=w(`<openclaw-modal-dialog><div class=exec-approval-modal-stack>`,1),H=new WeakMap,U=o(`openclaw-exec-approval`,(e,n)=>{n.style.display=`contents`;let r=()=>e.props?.queue??[],[i,a]=u(e=>r().some(t=>t.id===e)?e:r()[0]?.id??null),[o,s]=u(e=>r().length>0&&(e??!1)),c=()=>r().find(e=>e.id===i())??r()[0],l=f(()=>{let n=c()?.sourceSessionKey??c()?.request.sessionKey;return n?e.props?.sessions?.find(e=>t(e.key,n)):void 0}),d,p=()=>!1;H.set(n,{show(){r().length&&s(!0)}}),Object.defineProperty(n,"dialogOpen",{configurable:!0,get:()=>o()&&r().length>0}),y(()=>()=>H.delete(n));let h=t=>{let n=e.props,r=c();if(!r||t.defaultPrevented||t.repeat||n?.busy||p()||!n?.connected||!n?.canGrant)return;let i=L(t);i&&M(r).includes(i)&&(t.preventDefault(),d?.(r.id,i))},S=t=>{p()||e.props?.busy?t.preventDefault():s(!1)};return _(()=>_(()=>!!(o()&&c()&&e.props))()?(()=>{var t=V(),n=t.firstChild;return t.addEventListener(`modal-cancel`,S),t._$$keydown=h,t._$owner=m(),g(n,b(A,{get props(){return{approval:c(),sourceSession:l(),currentSessionKey:e.props.currentSessionKey,nodeDisplayName:e.props.nodeNames?.get(c().request.nodeId??``),busy:e.props.busy,connected:e.props.connected,canGrant:e.props.canGrant,error:e.props.errors.get(c().id)??null,variant:`modal`,queueCount:r().length,renderPendingQueue:()=>F({queue:r(),activeId:c().id,onSelect:a}),onDecision:e.props.onDecision,onDecisionReady:(e,t)=>{d=e,p=t}}}})),x(()=>({e:O(c()),t:k(c().expiresAtMs,D(c().expiresAtMs))}),({e,t:n},r)=>{e!==r?.e&&v(t,`label`,e),n!==r?.t&&v(t,`description`,n)}),t})():void 0)},{properties:{props:{default:void 0,attribute:!1}},methods:{show:e=>H.get(e)?.show()}}),S([`click`,`keydown`])})))()}W();export{U as ExecApproval};