UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

2 lines • 7.24 kB
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./control-ui-connection-D5QrEAFW.css","./control-ui-boot-shared-styles-BorAdMVO.css"])))=>i.map(i=>d[i]); import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{$s as t,Qs as n,Qt as r,Yt as i,lu as a,uu as o}from"./control-ui-connection-Bfj9beF_.js";import{BA as s,XO as c,dj as l,ej as u,fD as d,mj as f,nk as ee,pD as p,tj as m,zA as h}from"./control-ui-boot-shared-DFTSUQQ0.js";import{B as g,C as _,F as v,I as y,O as b,U as x,W as S,d as C,f as w,g as T,gt as E,j as D,l as O,s as k,u as A,w as te,x as j,yt as ne}from"./solid-runtime-C416s-HC.js";import{r as re,t as M}from"./mcp-app-route-TBo2ntnJ.js";import{fn as N,hn as P,mn as F}from"./deferred-ui-support-D-VedBtc.js";import{n as I,t as L}from"./mcp-app-operation-error-CLTGWuVI.js";function R(e){let t=()=>[...e.entry.icons??[],...e.server.icons??[]].find(e=>(!e.theme||e.theme===document.documentElement.dataset.themeMode)&&N(e.src));return D(b,{get when(){return t()},get fallback(){return D(h,{name:`puzzle`})},children:e=>(()=>{var t=z();return O(()=>e().src,e=>{T(t,`src`,e)}),t})()})}function ie(e){let t=()=>e.surface??`global`,r=m(),[a,o]=g(!1),[s,c]=g(),[l,u]=y(!1),p=!0,x=!1;E(()=>()=>{p=!1});function S(){let t=r.gateway.snapshot.client,n=e.catalog.target(),i=d(r.gateway).key;return{client:t,selected:n,current:()=>{let a=e.catalog.target();return p&&r.gateway.snapshot.client===t&&d(r.gateway).key===i&&a.sessionKey===n.sessionKey&&a.agentId===n.agentId}}}let k=()=>{e.catalog.snapshot();let t=s();return t?.current()?t:void 0};function A(e,t){let n=t.then(()=>null);n.catch(()=>{}),c({current:e,result:n})}let j=()=>t()===`thread`||t()===`file`;function M(n,a,s=!1,l=!1){if(e.catalog.available()){if(c(void 0),t()===`sidebar`||t()===`global`){let e=re({kind:`server`,serverName:n.serverName,toolName:a.toolName,deepLink:`/`});r.navigate(`apps`,{search:`${e}${s?`&settings=1`:``}${l?`&quickAction=1`:``}`})}else P(e.host(),{...e.catalog.target(),owner:r.gateway.snapshot.client,serverName:n.serverName,entrypoint:a,settings:s,quickAction:l,...t()===`file`?{filePath:e.filePath??``}:{}})?o(!1):A(S().current,Promise.reject(new i(f(`mcpApp.errors.mountUnavailable`))))}}let N=ne(function*(e){u(!0),yield e});async function F(t){let{client:i,selected:a,current:o}=S();if(!i||!e.catalog.available()||x)return;x=!0;let s=(async()=>{await i.request(`mcp.app.onboard`,{...a,pluginId:t,idempotencyKey:n()})})();A(o,s);try{if(await N(s),!o())return;let e=ee({context:r,sessionKey:a.sessionKey,agentId:a.agentId,face:`chat`});r.navigate(`chat`,e.options)}catch{}finally{x=!1}}return D(b,{get when(){return e.visible},get children(){return D(b,{get when(){return t()===`sidebar`},get fallback(){var n=U(),i=n.firstChild,s=i.nextSibling,c=s.nextSibling;return C(n,D(b,{get when(){return j()},get fallback(){return[(()=>{var e=W();return C(e,()=>f(`mcpApp.catalogTitle`)),e})(),(()=>{var e=G();return C(e,()=>f(`mcpApp.catalogDescription`)),e})()]},get children(){var e=B(),n=e.firstChild,r=n.nextSibling;return e._$$click=()=>o(!a()),C(e,D(h,{name:`puzzle`}),n),C(e,()=>f(t()===`file`?`mcpApp.openWith`:`mcpApp.threadApps`),r),O(()=>a()?`true`:`false`,t=>{T(e,`aria-expanded`,t)}),e}}),i),C(n,D(b,{get when(){return!j()||a()},get children(){var n=H(),i=n.firstChild,a=i.nextSibling,o=a.nextSibling,s=o.nextSibling,c=s.nextSibling;return C(n,D(te,{get fallback(){var e=K();return C(e,()=>f(`mcpApp.loading`)),e},get children(){return D(Q,{get request(){return e.catalog.request()},get emptyMessage(){return w(()=>!e.rows.length)()?f(`mcpApp.empty`):void 0},onRetry:()=>void e.catalog.refresh(),get retryDisabled(){return!e.catalog.available()}})}}),i),C(n,D(_,{get each(){return e.rows},keyed:e=>JSON.stringify([e.server.serverName,e.entry.toolName]),children:t=>{let n=v(()=>{let e=t().entry.entrypoint;return e.type===`global`&&e.quickAction});var r=J(),i=r.firstChild,a=i.firstChild,o=a.firstChild,s=o.nextSibling,c=i.nextSibling,l=c.nextSibling;return i._$$click=()=>M(t().server,t().entry),C(i,D(R,{get server(){return t().server},get entry(){return t().entry}}),a),C(o,()=>t().entry.title),C(s,()=>t().server.label),C(r,D(b,{get when(){return n()},children:n=>(()=>{var r=Y();return r._$$click=()=>M(t().server,t().entry,!1,!0),C(r,()=>n().title),O(()=>!e.catalog.available(),e=>{T(r,`disabled`,e)}),r})()}),c),C(r,D(b,{get when(){return t().server.settings},get children(){var n=q();return n._$$click=()=>M(t().server,t().entry,!0),C(n,()=>f(`mcpApp.settings`)),O(()=>({e:`${f(`mcpApp.settings`)}: ${t().entry.title}`,t:!e.catalog.available()}),({e,t},r)=>{e!==r?.e&&T(n,`aria-label`,e),t!==r?.t&&T(n,`disabled`,t)}),n}}),l),O(()=>!e.catalog.available(),e=>{T(i,`disabled`,e)}),r}}),a),C(n,D(b,{get when(){return t()!==`file`},get children(){return D(_,{get each(){return e.catalog.snapshot().servers.filter(t=>t.settings&&!e.entries(t).length)},children:t=>(()=>{var n=X(),r=n.firstChild,i=r.nextSibling;return n._$$click=()=>M(t,{toolName:t.settings.readTool,title:t.label,resourceUri:``,entrypoint:{type:`settings`}},!0),C(n,()=>t.label,r),C(n,()=>f(`mcpApp.settings`),i),O(()=>!e.catalog.available(),e=>{T(n,`disabled`,e)}),n})()})}}),o),C(n,D(_,{get each(){return e.catalog.snapshot().onboarding},children:t=>(()=>{var n=X(),r=n.firstChild,i=r.nextSibling;return n._$$click=()=>void F(t.pluginId),C(n,()=>f(`mcpApp.onboarding`),r),C(n,()=>t.title,i),O(()=>l()||!e.catalog.available(),e=>{T(n,`disabled`,e)}),n})()}),s),C(n,D(b,{get when(){return!j()},get children(){var e=V();return e._$$click=()=>r.navigate(`mcp`),C(e,()=>f(`mcpApp.configure`)),e}}),c),n}}),s),C(n,D(b,{get when(){return k()},keyed:!0,children:e=>D(L,{get result(){return e.result}})}),c),O(()=>!!j(),e=>{n.classList.toggle(`mcp-app-catalog--compact`,e)}),n},get children(){return D(_,{get each(){return e.rows},keyed:e=>JSON.stringify([e.server.serverName,e.entry.toolName]),children:t=>(()=>{var n=Z(),r=n.firstChild,i=r.nextSibling;return n._$$click=()=>M(t().server,t().entry),C(r,D(R,{get server(){return t().server},get entry(){return t().entry}})),C(i,()=>t().entry.title),O(()=>({e:!e.catalog.available(),t:t().server.label}),({e,t},r)=>{e!==r?.e&&T(n,`disabled`,e),t!==r?.t&&T(n,`title`,t)}),n})()})}})}})}var z,B,V,H,U,W,G,K,q,J,Y,X,Z,Q;function $(){return($=e((()=>{A(),x(),p(),r(),M(),u(),l(),c(),t(),F(),s(),I(),o(),z=j(`<img class=mcp-app-icon alt referrerpolicy=no-referrer>`),B=j(`<button class="btn btn--sm"type=button><!><!>`),V=j(`<button class="btn btn--sm">`),H=j(`<div class=mcp-app-catalog__entries><!><!><!><!><!>`),U=j(`<section class=mcp-app-catalog><!><!><!>`),W=j(`<h2>`),G=j(`<p class=muted>`),K=j(`<p role=status>`),q=j(`<button type=button class="btn btn--sm">`),J=j(`<div class=mcp-app-catalog__entry><button class=btn type=button><span><strong></strong><small></small></span></button><!><!>`),Y=j(`<button class="btn btn--sm"type=button>`),X=j(`<button class=btn type=button> · <!>`),Z=j(`<button type=button class=nav-item><span class=nav-item__icon></span><span class=nav-item__text>`),Q=S(()=>a(()=>import(`./mcp-app-discovery-status-K6UynUAy.js`),__vite__mapDeps([0,1]),import.meta.url),void 0,`src/components/mcp-app-discovery-status.tsx`),k([`click`])})))()}$();export{ie as McpAppCatalogView};