openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
1 lines • 3.33 kB
JavaScript
import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{A_ as t,BA as n,N_ as r,dj as i,ej as a,fD as o,mj as s,pD as c,tj as l,zA as u}from"./control-ui-boot-shared-DFTSUQQ0.js";import{B as d,C as f,L as p,O as m,U as h,d as g,g as _,gt as v,j as y,l as b,s as x,u as S,x as C,yt as w}from"./solid-runtime-C416s-HC.js";import{Fr as T,Ir as E,Lr as D,Pr as O,Rr as k}from"./control-ui-boot-chat-DewxEbIm.js";import{n as A,t as j}from"./mcp-app-operation-error-CLTGWuVI.js";function M(e){let t=l(),n=r(t.gateway),[i,a]=d(),c=()=>{let e=i();return e?.current()?e:void 0},[h,x]=p({}),S=!1;v(()=>(S=!0,()=>{S=!1}));let C=w(function*(e,t,n){t()&&x(n=>{n[e]=t}),yield n});async function O(r,i){let s=t.gateway.snapshot.client,c=r.state;if(!s||!c||t.gateway.snapshot.phase!==`connected`)return;let l=o(t.gateway).key,u=e.sessionKey,d=e.agentId,f=()=>(n.read(),S&&t.gateway.snapshot.client===s&&o(t.gateway).key===l&&e.sessionKey===u&&e.agentId===d),p=(async()=>{try{let e=await s.request(`mcp.app.removeModelContext`,{sessionKey:r.sessionKey,agentId:r.agentId,viewId:r.viewId,updateId:c.updateId,...i===void 0?{}:{index:i}});f()&&k(s,u,d).find(e=>e.viewId===r.viewId)?.state?.updateId===c.updateId&&D(s,{...r,state:e.state})}catch(e){if(f())throw e}})(),m=p.then(()=>null);return m.catch(()=>{}),a({current:f,result:m}),await Promise.resolve(),f()?C(r.viewId,f,p).catch(()=>{}):p}var A=N(),M=A.firstChild,R=M.firstChild,z=R.nextSibling,B=M.nextSibling,V=B.nextSibling;return g(M,y(u,{name:`puzzle`}),R),g(M,()=>s(`mcpApp.contextTitle`),z),g(A,y(f,{get each(){return e.entries},children:e=>(()=>{var t=F(),n=t.firstChild,r=n.nextSibling;return g(t,y(f,{get each(){return e.state?.content??[]},children:(t,n)=>{let r=t.type===`image`?`mcpApp.imageContent`:t.type===`text`?`mcpApp.textContent`:`mcpApp.resourceContent`,i=()=>T(t,`${e.title} · ${s(r)}`),a=E(t);var o=I(),c=o.firstChild,l=c.nextSibling;return g(o,a?(()=>{var e=L();return _(e,`src`,a),b(()=>i(),t=>{_(e,`alt`,t)}),e})():y(u,{name:`fileText`}),c),g(c,i),l._$$click=()=>void O(e,n()),g(l,y(u,{name:`x`})),b(()=>({e:i(),t:h[e.viewId]?.(),a:s(`mcpApp.removeContext`,{title:i()})}),({e,t,a:n},r)=>{e!==r?.e&&_(c,`title`,e),t!==r?.t&&_(l,`disabled`,t),n!==r?.a&&_(l,`aria-label`,n)}),o}}),n),g(t,y(m,{get when(){return e.state?.structuredContent},get children(){var t=P(),n=t.firstChild,r=n.nextSibling;return g(n,()=>e.title),r._$$click=()=>void O(e),g(r,y(u,{name:`x`})),b(()=>({e:h[e.viewId]?.(),t:s(`mcpApp.removeContext`,{title:e.title})}),({e,t},n)=>{e!==n?.e&&_(r,`disabled`,e),t!==n?.t&&_(r,`aria-label`,t)}),t}}),r),t})()}),B),g(A,y(m,{get when(){return c()},keyed:!0,children:e=>y(j,{get result(){return e.result}})}),V),b(()=>({e:s(`mcpApp.contextTitle`),t:s(`mcpApp.contextDescription`)}),({e,t},n)=>{e!==n?.e&&_(A,`aria-label`,e),t!==n?.t&&_(M,`title`,t)}),A}var N,P,F,I,L;function R(){return(R=e((()=>{S(),h(),c(),O(),t(),a(),i(),n(),A(),N=C(`<section class=mcp-app-context><div class=mcp-app-context__header> <!></div><!><!>`),P=C(`<div class=mcp-app-context__item><span></span><button type=button>`),F=C(`<div class=mcp-app-context__items><!><!>`),I=C(`<div class=mcp-app-context__item><span class=mcp-app-context__label></span><button type=button>`),L=C(`<img referrerpolicy=no-referrer loading=lazy>`,1),x([`click`])})))()}R();export{M as McpAppContextStripView};