UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

2 lines • 6.88 kB
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./_1____________________________.css","./_0____________________________________.css"])))=>i.map(i=>d[i]); import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{$u as t,Qu as n,al as r,ol as i,ut as a}from"./_4____________________________.js";import{AN as o,FN as s,GA as c,GN as l,JN as u,PN as d,ak as f,fN as p,ok as m,pN as h,zA as g}from"./_2_____________________________.js";import{Hn as _,Vn as v}from"./deferred-ui-support-DZEPWjAk.js";import{B as y,C as b,F as x,I as ee,O as S,U as C,W as w,d as T,f as E,g as D,gt as te,j as O,l as k,s as A,u as j,w as ne,x as M,yt as re}from"./_6____________________.js";import{r as N,t as P}from"./mcp-app-route-Cg1SB1yj.js";import{n as F,t as I}from"./mcp-app-icon-DkQsvoJC.js";import{n as L,t as R}from"./mcp-app-operation-error-BNu6i_FW.js";function z(e){return O(I,{get icons(){return[...e.entry.icons??[],...e.server.icons??[]]}})}function ie(e){let t=()=>e.surface??`global`,n=s(),[i,o]=y(!1),[l,d]=y(),[m,h]=ee(!1),g=!0,v=!1;te(()=>()=>{g=!1});function C(){let t=n.gateway.snapshot.client,r=e.catalog.target(),i=f(n.gateway).key;return{client:t,selected:r,current:()=>{let a=e.catalog.target();return g&&n.gateway.snapshot.client===t&&f(n.gateway).key===i&&a.sessionKey===r.sessionKey&&a.agentId===r.agentId}}}let w=()=>{e.catalog.snapshot();let t=l();return t?.current()?t:void 0};function A(e,t){let n=t.then(()=>null);n.catch(()=>{}),d({current:e,result:n})}let j=()=>t()===`thread`||t()===`file`;function M(r,i,s=!1,c=!1){if(e.catalog.available()){if(d(void 0),t()===`sidebar`||t()===`global`){let e=N({kind:`server`,serverName:r.serverName,toolName:i.toolName,deepLink:`/`});n.navigate(`apps`,{search:`${e}${s?`&settings=1`:``}${c?`&quickAction=1`:``}`})}else _(e.host(),{...e.catalog.target(),owner:n.gateway.snapshot.client,serverName:r.serverName,entrypoint:i,settings:s,quickAction:c,...t()===`file`?{filePath:e.filePath??``}:{}})?o(!1):A(C().current,Promise.reject(new a(u(`mcpApp.errors.mountUnavailable`))))}}let P=re(function*(e){h(!0),yield e});async function F(t){let{client:i,selected:a,current:o}=C();if(!i||!e.catalog.available()||v)return;v=!0;let s=(async()=>{await i.request(`mcp.app.onboard`,{...a,pluginId:t,idempotencyKey:r()})})();A(o,s);try{if(await P(s),!o())return;let e=c({context:n,sessionKey:a.sessionKey,agentId:a.agentId,face:`chat`});n.navigate(`chat`,e.options)}catch{}finally{v=!1}}return O(S,{get when(){return e.visible},get children(){return O(S,{get when(){return t()===`sidebar`},get fallback(){var r=U(),a=r.firstChild,s=a.nextSibling,c=s.nextSibling;return T(r,O(S,{get when(){return j()},get fallback(){return[(()=>{var e=W();return T(e,()=>u(`mcpApp.catalogTitle`)),e})(),(()=>{var e=G();return T(e,()=>u(`mcpApp.catalogDescription`)),e})()]},get children(){var e=B(),n=e.firstChild,r=n.nextSibling;return e._$$click=()=>o(!i()),T(e,O(p,{name:`puzzle`}),n),T(e,()=>u(t()===`file`?`mcpApp.openWith`:`mcpApp.threadApps`),r),k(()=>i()?`true`:`false`,t=>{D(e,`aria-expanded`,t)}),e}}),a),T(r,O(S,{get when(){return!j()||i()},get children(){var r=H();return T(r,O(ne,{get fallback(){var e=K();return T(e,()=>u(`mcpApp.loading`)),e},get children(){return[O(Q,{get request(){return e.catalog.request()},get emptyMessage(){return E(()=>!e.rows.length)()?u(`mcpApp.empty`):void 0},onRetry:()=>void e.catalog.refresh(),get retryDisabled(){return!e.catalog.available()}}),O(b,{get each(){return e.rows},keyed:e=>JSON.stringify([e.server.serverName,e.entry.toolName]),children:t=>{let n=x(()=>{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),T(i,O(z,{get server(){return t().server},get entry(){return t().entry}}),a),T(o,()=>t().entry.title),T(s,()=>t().server.label),T(r,O(S,{get when(){return n()},children:n=>(()=>{var r=Y();return r._$$click=()=>M(t().server,t().entry,!1,!0),T(r,()=>n().title),k(()=>!e.catalog.available(),e=>{D(r,`disabled`,e)}),r})()}),c),T(r,O(S,{get when(){return t().server.settings},get children(){var n=q();return n._$$click=()=>M(t().server,t().entry,!0),T(n,()=>u(`mcpApp.settings`)),k(()=>({e:`${u(`mcpApp.settings`)}: ${t().entry.title}`,t:!e.catalog.available()}),({e,t},r)=>{e!==r?.e&&D(n,`aria-label`,e),t!==r?.t&&D(n,`disabled`,t)}),n}}),l),k(()=>!e.catalog.available(),e=>{D(i,`disabled`,e)}),r}}),O(S,{get when(){return t()!==`file`},get children(){return O(b,{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),T(n,()=>t.label,r),T(n,()=>u(`mcpApp.settings`),i),k(()=>!e.catalog.available(),e=>{D(n,`disabled`,e)}),n})()})}}),O(b,{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),T(n,()=>u(`mcpApp.onboarding`),r),T(n,()=>t.title,i),k(()=>m()||!e.catalog.available(),e=>{D(n,`disabled`,e)}),n})()}),O(S,{get when(){return!j()},get children(){var e=V();return e._$$click=()=>n.navigate(`mcp`),T(e,()=>u(`mcpApp.configure`)),e}})]}})),r}}),s),T(r,O(S,{get when(){return w()},keyed:!0,children:e=>O(R,{get result(){return e.result}})}),c),k(()=>!!j(),e=>{r.classList.toggle(`mcp-app-catalog--compact`,e)}),r},get children(){return O(b,{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),T(r,O(z,{get server(){return t().server},get entry(){return t().entry}})),T(i,()=>t().entry.title),k(()=>({e:!e.catalog.available(),t:t().server.label}),({e,t},r)=>{e!==r?.e&&D(n,`disabled`,e),t!==r?.t&&D(n,`title`,t)}),n})()})}})}})}var B,V,H,U,W,G,K,q,J,Y,X,Z,Q;function $(){return($=e((()=>{j(),C(),m(),o(),P(),d(),l(),g(),i(),F(),v(),h(),L(),t(),B=M(`<button class="btn btn--sm"type=button><!><!>`),V=M(`<button class="btn btn--sm">`),H=M(`<div class=mcp-app-catalog__entries>`),U=M(`<section class=mcp-app-catalog><!><!><!>`),W=M(`<h2>`),G=M(`<p class=muted>`),K=M(`<p role=status>`),q=M(`<button type=button class="btn btn--sm">`),J=M(`<div class=mcp-app-catalog__entry><button class=btn type=button><span><strong></strong><small></small></span></button><!><!>`),Y=M(`<button class="btn btn--sm"type=button>`),X=M(`<button class=btn type=button> · <!>`),Z=M(`<button type=button class=nav-item><span class=nav-item__icon></span><span class=nav-item__text>`),Q=w(()=>n(()=>import(`./mcp-app-discovery-status-wg49G-Zx.js`),__vite__mapDeps([0,1]),import.meta.url),void 0,`src/components/mcp-app-discovery-status.tsx`),A([`click`])})))()}$();export{ie as McpAppCatalogView};