@decocms/mesh 2.29.1 → 2.29.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{AlertCircle-B2wU6D_n.js → AlertCircle-BjDAjYli.js} +1 -1
- package/dist/client/assets/{ArrowLeft-NyHGzvbe.js → ArrowLeft-C3b0kZkv.js} +1 -1
- package/dist/client/assets/{ArrowUp-C6Sqn9AG.js → ArrowUp-UuyzMrp7.js} +1 -1
- package/dist/client/assets/{Check-D3xuSVGj.js → Check-BBlt8nj4.js} +1 -1
- package/dist/client/assets/{ChevronDown-C-3EfjEP.js → ChevronDown-C2nnNiko.js} +1 -1
- package/dist/client/assets/{Code01-DfyMLaC-.js → Code01-BkX8PbNA.js} +1 -1
- package/dist/client/assets/{Copy01-Dc1RdJpq.js → Copy01-eVnag3mk.js} +1 -1
- package/dist/client/assets/{DotsHorizontal-B2UMMt8A.js → DotsHorizontal-D8Oa-FB4.js} +1 -1
- package/dist/client/assets/{DotsVertical-DvDijuvP.js → DotsVertical-Cl1hRwhg.js} +1 -1
- package/dist/client/assets/{Download01-CkMxNb0B.js → Download01-BW7f1rv9.js} +1 -1
- package/dist/client/assets/{Edit01-L4Nnr0QQ.js → Edit01-C2f_e3xp.js} +1 -1
- package/dist/client/assets/{File06-CBX_wyuh.js → File06-D5XMLdKt.js} +1 -1
- package/dist/client/assets/{FilterLines-CDH3HxTZ.js → FilterLines-ZY2ZET-V.js} +1 -1
- package/dist/client/assets/{FlipBackward-BEzqS8y7.js → FlipBackward-BX_e7PV2.js} +1 -1
- package/dist/client/assets/{GitBranch01-XjgV7Utb.js → GitBranch01-BBkuZ0g6.js} +1 -1
- package/dist/client/assets/{Grid01-Bdr8TdFN.js → Grid01-uChhmLMS.js} +1 -1
- package/dist/client/assets/{Home02-DCkHxmzr.js → Home02-C3AGNyGt.js} +1 -1
- package/dist/client/assets/{Image01-Cz2WeHIZ.js → Image01-Ca9fCk1g.js} +1 -1
- package/dist/client/assets/{Inbox01-Bl63CjOF.js → Inbox01-7yaEdhih.js} +1 -1
- package/dist/client/assets/{InfoCircle-nAODGDfn.js → InfoCircle-ZFVXEe-o.js} +1 -1
- package/dist/client/assets/{Key01-CohHKaNI.js → Key01-BVzZzDXG.js} +1 -1
- package/dist/client/assets/{LinkExternal01-BVGqLQdf.js → LinkExternal01-DYbIdjWG.js} +1 -1
- package/dist/client/assets/{List-BiMBtc9h.js → List-DTNJ5e_Z.js} +1 -1
- package/dist/client/assets/{Loading01-BGMvClGA.js → Loading01-CVbOjnPi.js} +1 -1
- package/dist/client/assets/{Lock01-DkDYnCig.js → Lock01-Irv7dEl1.js} +1 -1
- package/dist/client/assets/{Play-D6WkVhCH.js → Play-el8E8avm.js} +1 -1
- package/dist/client/assets/{Plus-DOLhHKPS.js → Plus-jsBXu2Jm.js} +1 -1
- package/dist/client/assets/{SearchMd-wW0y4rSg.js → SearchMd-CDx95UHX.js} +1 -1
- package/dist/client/assets/{Terminal-wdncdOY3.js → Terminal-C4vz1dQ0.js} +1 -1
- package/dist/client/assets/{Trash01-uBQo4R5K.js → Trash01-hrLLpuYX.js} +1 -1
- package/dist/client/assets/{Upload01-DrOTJQud.js → Upload01-CdFUIAAb.js} +1 -1
- package/dist/client/assets/{X-BsuyfM7l.js → X-Bp6jT_CT.js} +1 -1
- package/dist/client/assets/{XClose-D2cxj93b.js → XClose-ChfIwjbU.js} +1 -1
- package/dist/client/assets/{agent-detail-VQXvW-QJ.js → agent-detail-BvL0RN-C.js} +1 -1
- package/dist/client/assets/{agents-D6fLoeau.js → agents-CDU0paf2.js} +1 -1
- package/dist/client/assets/{alert-dialog-njkM7m-D.js → alert-dialog-5F29h7ch.js} +1 -1
- package/dist/client/assets/{auth-catchall-BgrOMedF.js → auth-catchall-BnUTAkiU.js} +1 -1
- package/dist/client/assets/{avatar-DN0XBse5.js → avatar-_fJCi1jf.js} +1 -1
- package/dist/client/assets/{badge-C4NA8Y3o.js → badge-DIpSEo79.js} +1 -1
- package/dist/client/assets/{binder-Kl7aT5vq.js → binder-QE3BUq_4.js} +1 -1
- package/dist/client/assets/{button-BvR2W8G4.js → button-BID2CMhP.js} +1 -1
- package/dist/client/assets/{card-COq6R1Ol.js → card-6juGo41K.js} +1 -1
- package/dist/client/assets/{checkbox-eVOKaait.js → checkbox-BR6ZWQcp.js} +1 -1
- package/dist/client/assets/{collection-detail-BIHW3g46.js → collection-detail-DdU0S4bC.js} +1 -1
- package/dist/client/assets/{collection-display-button-BCRnx64a.js → collection-display-button-CES97i9G.js} +1 -1
- package/dist/client/assets/{collection-header-BfyNoDrz.js → collection-header-C2jCnQ0V.js} +1 -1
- package/dist/client/assets/{collection-page-DGdU_exK.js → collection-page-DQBRHwuf.js} +1 -1
- package/dist/client/assets/{collection-search-DqgXXQWv.js → collection-search-CYQ70Hoa.js} +1 -1
- package/dist/client/assets/{collection-tab-WUfWVMgI.js → collection-tab-5E9Q1B_9.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-bSjbJgfa.js → collection-table-wrapper-CVkp-9hJ.js} +1 -1
- package/dist/client/assets/{connection-sopQjWTN.js → connection-CzagOXhI.js} +1 -1
- package/dist/client/assets/{connection-card-D5GbzeyC.js → connection-card-De1P7KUX.js} +1 -1
- package/dist/client/assets/{connection-detail-DzUcsbPz.js → connection-detail-C6yPmWnc.js} +1 -1
- package/dist/client/assets/{connections-DmmC3rw3.js → connections-JU4CGCz5.js} +1 -1
- package/dist/client/assets/constants-VQyKSexs.js +1 -0
- package/dist/client/assets/{create-organization-dialog-nASMtJST.js → create-organization-dialog-DjIYezTr.js} +1 -1
- package/dist/client/assets/{dialog-B904z6ZY.js → dialog-N6lD2G23.js} +1 -1
- package/dist/client/assets/{dropdown-menu-BnIr5Jx8.js → dropdown-menu-CZuHPcK3.js} +1 -1
- package/dist/client/assets/{dynamic-plugin-layout-DahJzuQA.js → dynamic-plugin-layout-D2QU16mz.js} +1 -1
- package/dist/client/assets/{empty-state-CVynnCY5.js → empty-state-B2MmEXSc.js} +1 -1
- package/dist/client/assets/{empty-state-Dw5rHePk.js → empty-state-aph8hymo.js} +1 -1
- package/dist/client/assets/{env-vars-editor-C4fVY6WB.js → env-vars-editor-Bw5ArpUL.js} +1 -1
- package/dist/client/assets/{error-boundary-BQAARcQ8.js → error-boundary-BSc3aikh.js} +1 -1
- package/dist/client/assets/{extract-connection-data-BOG_2a3a.js → extract-connection-data-DsBhcJbM.js} +1 -1
- package/dist/client/assets/{file-browser-DW8BOHM2.js → file-browser-C7oCWAQD.js} +2 -2
- package/dist/client/assets/{form-SKjUzorv.js → form-R15NVDAL.js} +1 -1
- package/dist/client/assets/{grid-view-CEUpbNrR.js → grid-view-CW_NhGu9.js} +1 -1
- package/dist/client/assets/{home-Cqfqey-F.js → home-QfrULyzV.js} +1 -1
- package/dist/client/assets/{index-sI-UsvfH.js → index-BfX1PMhV.js} +1 -1
- package/dist/client/assets/{index-DEnww9gD.js → index-C0cxXUhv.js} +2 -2
- package/dist/client/assets/{index-BGkDS5MK.js → index-DJuj6s5W.js} +1 -1
- package/dist/client/assets/{index-DSRGhYN3.js → index-kNWs-Kaj.js} +1 -1
- package/dist/client/assets/{index-D4KRNGOL.js → index-wl-vFw7b.js} +1 -1
- package/dist/client/assets/{infiniteQueryObserver-CGYWk_ac.js → infiniteQueryObserver-CzQcKMvF.js} +1 -1
- package/dist/client/assets/{input-DgTGe31P.js → input-DHdPZHvh.js} +1 -1
- package/dist/client/assets/{layout-BIa7Ww4X.js → layout-DVqtFrGe.js} +1 -1
- package/dist/client/assets/{localstorage-keys-D17OGozQ.js → localstorage-keys-CySryjw_.js} +1 -1
- package/dist/client/assets/{login-B5xXqMPx.js → login-DK-wLmSi.js} +1 -1
- package/dist/client/assets/{mcp-oauth-dZd55Tzg.js → mcp-oauth-C_uVzdje.js} +1 -1
- package/dist/client/assets/{mcp-server-card-DJM3hj-p.js → mcp-server-card-utdZ5S32.js} +1 -1
- package/dist/client/assets/{mcp-server-detail-DLyr08JI.js → mcp-server-detail-MhY6fdyG.js} +1 -1
- package/dist/client/assets/{members-CyhMUe46.js → members-BM4vbqXY.js} +1 -1
- package/dist/client/assets/{monaco-editor-DqozmIOD.js → monaco-editor-Bvv8L85C.js} +1 -1
- package/dist/client/assets/{monitoring-CnFXHSqu.js → monitoring-CaEhdIcr.js} +1 -1
- package/dist/client/assets/{oauth-callback-CubY7ZAH.js → oauth-callback-HFODG9C4.js} +1 -1
- package/dist/client/assets/{page-DFKun2Tu.js → page-0IgoQPj0.js} +1 -1
- package/dist/client/assets/{page-u6lkgihQ.js → page-BbtKYCEh.js} +1 -1
- package/dist/client/assets/{pin-to-sidebar-button-BGiKx435.js → pin-to-sidebar-button-BTWnJIgz.js} +1 -1
- package/dist/client/assets/{plugin-empty-state-C6RQEnQT.js → plugin-empty-state-LAcvmaUO.js} +1 -1
- package/dist/client/assets/{plugin-header-BIVYVkxH.js → plugin-header-CIa7SNC1.js} +1 -1
- package/dist/client/assets/{plugins-CgIotr1d.js → plugins-Zgv-qqyu.js} +1 -1
- package/dist/client/assets/{popover-Dn4ivO-8.js → popover-ffhxj7L9.js} +1 -1
- package/dist/client/assets/{project-context-provider-D72115Hk.js → project-context-provider-CG5Jt9jX.js} +1 -1
- package/dist/client/assets/{registry-utils-BP4AlvoC.js → registry-utils-Cqqa8TSE.js} +1 -1
- package/dist/client/assets/{resizable-CvvIJMA2.js → resizable-e7LRtN-0.js} +1 -1
- package/dist/client/assets/{resource-tabs-BIg7eAtK.js → resource-tabs-B6SPH4Q6.js} +1 -1
- package/dist/client/assets/{schema-uDdRhKGN.js → schema-BesiDnBO.js} +1 -1
- package/dist/client/assets/{select-B9MrHEQV.js → select-Cd19OBy8.js} +1 -1
- package/dist/client/assets/{settings-Q3YU3dT_.js → settings-DgjJ7rwy.js} +1 -1
- package/dist/client/assets/shell-layout-C4m50Amb.js +3 -0
- package/dist/client/assets/{spinner-D65UOVx5.js → spinner-B3XPkxOB.js} +1 -1
- package/dist/client/assets/{switch-CRRx7Ihv.js → switch-rXNPyRWr.js} +1 -1
- package/dist/client/assets/{textarea-CPHR6Kxa.js → textarea-B0dfI4Xu.js} +1 -1
- package/dist/client/assets/{tool-set-selector-CCX0O6mj.js → tool-set-selector-DCV0H2hh.js} +1 -1
- package/dist/client/assets/{tools-list-CXNtlBT4.js → tools-list-DcCgeTm7.js} +1 -1
- package/dist/client/assets/{tooltip-D08WG2Dp.js → tooltip-BpIeWmG3.js} +1 -1
- package/dist/client/assets/{typewriter-title-CwCkt48S.js → typewriter-title-vmu3HKS1.js} +1 -1
- package/dist/client/assets/{use-binding-B3nCylWG.js → use-binding-CmWOKG-X.js} +1 -1
- package/dist/client/assets/{use-collections-GcxvTgiJ.js → use-collections-BRVu5nwP.js} +1 -1
- package/dist/client/assets/{use-connection-CkN55J_1.js → use-connection-D__nfNf6.js} +1 -1
- package/dist/client/assets/{use-connection-resources-D2edaHva.js → use-connection-resources-CaArMBqO.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-D-dhpSeW.js → use-create-virtual-mcp-CULFY9tZ.js} +1 -1
- package/dist/client/assets/{use-list-state-BRnheB8y.js → use-list-state-D7wpG1Rh.js} +1 -1
- package/dist/client/assets/{use-mcp-BQQPfGWJ.js → use-mcp-DsR0-4yM.js} +1 -1
- package/dist/client/assets/{use-members-DYIVgUcO.js → use-members-BTTcGaAb.js} +1 -1
- package/dist/client/assets/{use-mobile-CfOQmwhW.js → use-mobile-Bw0zGvKx.js} +1 -1
- package/dist/client/assets/{use-organization-settings-XdMGyJnx.js → use-organization-settings-DYYG9Qqm.js} +1 -1
- package/dist/client/assets/{use-tool-call-PpVkvWqr.js → use-tool-call-DdCnWg9K.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-BjvB4zxw.js → use-virtual-mcp-aCxo16E3.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-system-prompt-nay7WZGK.js → use-virtual-mcp-system-prompt-Be4EZZHh.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-Dee7xpCM.js +1 -0
- package/dist/client/assets/{useMutation-BwDH9xn6.js → useMutation-DujnxbMG.js} +1 -1
- package/dist/client/assets/useQuery-CENoGrPp.js +1 -0
- package/dist/client/assets/{value-ClLnPq5S.js → value-BpSoQ0Q3.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-DO5T8Hqo.js → view-mode-toggle--WEYRZgf.js} +1 -1
- package/dist/client/assets/{workflow-CfVwecJB.js → workflow-DtxWy1GI.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/cli.js +1 -1
- package/dist/server/migrate.js +1 -1
- package/dist/server/server.js +1 -1
- package/package.json +1 -1
- package/dist/client/assets/constants-hDYh8bMu.js +0 -1
- package/dist/client/assets/shell-layout-BHlunMbQ.js +0 -3
- package/dist/client/assets/useInfiniteQuery-ft5Nm7Gb.js +0 -1
- package/dist/client/assets/useQuery-DqDScg2z.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{I as u}from"./infiniteQueryObserver-CzQcKMvF.js";import{b8 as i}from"./index-C0cxXUhv.js";function t(e,r){return i(e,u,r)}export{t as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{bf as l,bh as d,c3 as a,c4 as b,bg as h,x as p,r as o,bp as m,c5 as v}from"./index-
|
|
1
|
+
import{bf as l,bh as d,c3 as a,c4 as b,bg as h,x as p,r as o,bp as m,c5 as v}from"./index-C0cxXUhv.js";var y=class extends l{#s;#i=void 0;#t;#e;constructor(t,s){super(),this.#s=t,this.setOptions(s),this.bindMethods(),this.#r()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){const s=this.options;this.options=this.#s.defaultMutationOptions(t),d(this.options,s)||this.#s.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#t,observer:this}),s?.mutationKey&&this.options.mutationKey&&a(s.mutationKey)!==a(this.options.mutationKey)?this.reset():this.#t?.state.status==="pending"&&this.#t.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#t?.removeObserver(this)}onMutationUpdate(t){this.#r(),this.#o(t)}getCurrentResult(){return this.#i}reset(){this.#t?.removeObserver(this),this.#t=void 0,this.#r(),this.#o()}mutate(t,s){return this.#e=s,this.#t?.removeObserver(this),this.#t=this.#s.getMutationCache().build(this.#s,this.options),this.#t.addObserver(this),this.#t.execute(t)}#r(){const t=this.#t?.state??b();this.#i={...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset}}#o(t){h.batch(()=>{if(this.#e&&this.hasListeners()){const s=this.#i.variables,r=this.#i.context,e={client:this.#s,meta:this.options.meta,mutationKey:this.options.mutationKey};if(t?.type==="success"){try{this.#e.onSuccess?.(t.data,s,r,e)}catch(i){Promise.reject(i)}try{this.#e.onSettled?.(t.data,null,s,r,e)}catch(i){Promise.reject(i)}}else if(t?.type==="error"){try{this.#e.onError?.(t.error,s,r,e)}catch(i){Promise.reject(i)}try{this.#e.onSettled?.(void 0,t.error,s,r,e)}catch(i){Promise.reject(i)}}}this.listeners.forEach(s=>{s(this.#i)})})}};function O(t,s){const r=p(s),[e]=o.useState(()=>new y(r,t));o.useEffect(()=>{e.setOptions(t)},[e,t]);const i=o.useSyncExternalStore(o.useCallback(n=>e.subscribe(h.batchCalls(n)),[e]),()=>e.getCurrentResult(),()=>e.getCurrentResult()),u=o.useCallback((n,c)=>{e.mutate(n,c).catch(m)},[e]);if(i.error&&v(e.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:u,mutateAsync:i.mutate}}export{O as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b8 as u,bj as s}from"./index-C0cxXUhv.js";function o(e,r){return u(e,s,r)}export{o as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as z,a8 as A,j as c,a3 as M,a6 as ge,H as h,a9 as he,aa as X,a4 as pe,a2 as be,ab as me,i as ve,c as Y}from"./index-DEnww9gD.js";import{c as Z}from"./button-BvR2W8G4.js";var ee="Toggle",te=z.forwardRef((t,e)=>{const{pressed:r,defaultPressed:n,onPressedChange:a,...o}=t,[i,s]=A({prop:r,onChange:a,defaultProp:n??!1,caller:ee});return c.jsx(M.button,{type:"button","aria-pressed":i,"data-state":i?"on":"off","data-disabled":t.disabled?"":void 0,...o,ref:e,onClick:ge(t.onClick,()=>{t.disabled||s(!i)})})});te.displayName=ee;var b="ToggleGroup",[re]=pe(b,[X]),ne=X(),S=h.forwardRef((t,e)=>{const{type:r,...n}=t;if(r==="single"){const a=n;return c.jsx(we,{...a,ref:e})}if(r==="multiple"){const a=n;return c.jsx(ye,{...a,ref:e})}throw new Error(`Missing prop \`type\` expected on \`${b}\``)});S.displayName=b;var[ae,ie]=re(b),we=h.forwardRef((t,e)=>{const{value:r,defaultValue:n,onValueChange:a=()=>{},...o}=t,[i,s]=A({prop:r,defaultProp:n??"",onChange:a,caller:b});return c.jsx(ae,{scope:t.__scopeToggleGroup,type:"single",value:h.useMemo(()=>i?[i]:[],[i]),onItemActivate:s,onItemDeactivate:h.useCallback(()=>s(""),[s]),children:c.jsx(oe,{...o,ref:e})})}),ye=h.forwardRef((t,e)=>{const{value:r,defaultValue:n,onValueChange:a=()=>{},...o}=t,[i,s]=A({prop:r,defaultProp:n??[],onChange:a,caller:b}),f=h.useCallback(l=>s((d=[])=>[...d,l]),[s]),u=h.useCallback(l=>s((d=[])=>d.filter(xe=>xe!==l)),[s]);return c.jsx(ae,{scope:t.__scopeToggleGroup,type:"multiple",value:i,onItemActivate:f,onItemDeactivate:u,children:c.jsx(oe,{...o,ref:e})})});S.displayName=b;var[$e,Ne]=re(b),oe=h.forwardRef((t,e)=>{const{__scopeToggleGroup:r,disabled:n=!1,rovingFocus:a=!0,orientation:o,dir:i,loop:s=!0,...f}=t,u=ne(r),l=be(i),d={role:"group",dir:l,...f};return c.jsx($e,{scope:r,rovingFocus:a,disabled:n,children:a?c.jsx(me,{asChild:!0,...u,orientation:o,dir:l,loop:s,children:c.jsx(M.div,{...d,ref:e})}):c.jsx(M.div,{...d,ref:e})})}),k="ToggleGroupItem",se=h.forwardRef((t,e)=>{const r=ie(k,t.__scopeToggleGroup),n=Ne(k,t.__scopeToggleGroup),a=ne(t.__scopeToggleGroup),o=r.value.includes(t.value),i=n.disabled||t.disabled,s={...t,pressed:o,disabled:i},f=h.useRef(null);return n.rovingFocus?c.jsx(he,{asChild:!0,...a,focusable:!i,active:o,ref:f,children:c.jsx(D,{...s,ref:e})}):c.jsx(D,{...s,ref:e})});se.displayName=k;var D=h.forwardRef((t,e)=>{const{__scopeToggleGroup:r,value:n,...a}=t,o=ie(k,r),i={role:"radio","aria-checked":t.pressed,"aria-pressed":void 0},s=o.type==="single"?i:void 0;return c.jsx(te,{...s,...a,ref:e,onPressedChange:f=>{f?o.onItemActivate(n):o.onItemDeactivate(n)}})}),Ge=S,Pe=se;const Re=ve("inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none transition-[color,box-shadow] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive whitespace-nowrap",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"},size:{default:"h-10 px-2 min-w-9",sm:"h-7 px-1.5 min-w-8",lg:"h-10 px-2.5 min-w-10"}},defaultVariants:{variant:"default",size:"default"}}),fe=z.createContext({size:"default",variant:"default"});function Ye(t){const e=Y.c(20);let r,n,a,o,i;e[0]!==t?({className:n,variant:i,size:o,children:r,...a}=t,e[0]=t,e[1]=r,e[2]=n,e[3]=a,e[4]=o,e[5]=i):(r=e[1],n=e[2],a=e[3],o=e[4],i=e[5]);let s;e[6]!==n?(s=Z("group/toggle-group flex w-fit items-center rounded-md data-[variant=outline]:shadow-xs",n),e[6]=n,e[7]=s):s=e[7];let f;e[8]!==o||e[9]!==i?(f={variant:i,size:o},e[8]=o,e[9]=i,e[10]=f):f=e[10];let u;e[11]!==r||e[12]!==f?(u=c.jsx(fe.Provider,{value:f,children:r}),e[11]=r,e[12]=f,e[13]=u):u=e[13];let l;return e[14]!==a||e[15]!==o||e[16]!==s||e[17]!==u||e[18]!==i?(l=c.jsx(Ge,{"data-slot":"toggle-group","data-variant":i,"data-size":o,className:s,...a,children:u}),e[14]=a,e[15]=o,e[16]=s,e[17]=u,e[18]=i,e[19]=l):l=e[19],l}function Ze(t){const e=Y.c(18);let r,n,a,o,i;e[0]!==t?({className:n,children:r,variant:i,size:o,...a}=t,e[0]=t,e[1]=r,e[2]=n,e[3]=a,e[4]=o,e[5]=i):(r=e[1],n=e[2],a=e[3],o=e[4],i=e[5]);const s=z.useContext(fe),f=s.variant||i,u=s.size||o;let l;e[6]!==n||e[7]!==s.size||e[8]!==s.variant||e[9]!==o||e[10]!==i?(l=Z(Re({variant:s.variant||i,size:s.size||o}),"min-w-0 flex-1 shrink-0 rounded-none shadow-none first:rounded-l-md last:rounded-r-md focus:z-10 focus-visible:z-10 data-[variant=outline]:border-l-0 data-[variant=outline]:first:border-l",n),e[6]=n,e[7]=s.size,e[8]=s.variant,e[9]=o,e[10]=i,e[11]=l):l=e[11];let d;return e[12]!==r||e[13]!==a||e[14]!==f||e[15]!==u||e[16]!==l?(d=c.jsx(Pe,{"data-slot":"toggle-group-item","data-variant":f,"data-size":u,className:l,...a,children:r}),e[12]=r,e[13]=a,e[14]=f,e[15]=u,e[16]=l,e[17]=d):d=e[17],d}function V(t,e,r){t.prototype=e.prototype=r,r.constructor=t}function le(t,e){var r=Object.create(t.prototype);for(var n in e)r[n]=e[n];return r}function G(){}var y=.7,C=1/y,w="\\s*([+-]?\\d+)\\s*",$="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",p="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",ke=/^#([0-9a-f]{3,8})$/,Ce=new RegExp(`^rgb\\(${w},${w},${w}\\)$`),Te=new RegExp(`^rgb\\(${p},${p},${p}\\)$`),je=new RegExp(`^rgba\\(${w},${w},${w},${$}\\)$`),_e=new RegExp(`^rgba\\(${p},${p},${p},${$}\\)$`),Me=new RegExp(`^hsl\\(${$},${p},${p}\\)$`),Ie=new RegExp(`^hsla\\(${$},${p},${p},${$}\\)$`),F={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};V(G,N,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:O,formatHex:O,formatHex8:Ee,formatHsl:He,formatRgb:B,toString:B});function O(){return this.rgb().formatHex()}function Ee(){return this.rgb().formatHex8()}function He(){return ue(this).formatHsl()}function B(){return this.rgb().formatRgb()}function N(t){var e,r;return t=(t+"").trim().toLowerCase(),(e=ke.exec(t))?(r=e[1].length,e=parseInt(e[1],16),r===6?L(e):r===3?new x(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):r===8?P(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):r===4?P(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=Ce.exec(t))?new x(e[1],e[2],e[3],1):(e=Te.exec(t))?new x(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=je.exec(t))?P(e[1],e[2],e[3],e[4]):(e=_e.exec(t))?P(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=Me.exec(t))?K(e[1],e[2]/100,e[3]/100,1):(e=Ie.exec(t))?K(e[1],e[2]/100,e[3]/100,e[4]):F.hasOwnProperty(t)?L(F[t]):t==="transparent"?new x(NaN,NaN,NaN,0):null}function L(t){return new x(t>>16&255,t>>8&255,t&255,1)}function P(t,e,r,n){return n<=0&&(t=e=r=NaN),new x(t,e,r,n)}function ze(t){return t instanceof G||(t=N(t)),t?(t=t.rgb(),new x(t.r,t.g,t.b,t.opacity)):new x}function I(t,e,r,n){return arguments.length===1?ze(t):new x(t,e,r,n??1)}function x(t,e,r,n){this.r=+t,this.g=+e,this.b=+r,this.opacity=+n}V(x,I,le(G,{brighter(t){return t=t==null?C:Math.pow(C,t),new x(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?y:Math.pow(y,t),new x(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new x(v(this.r),v(this.g),v(this.b),T(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:U,formatHex:U,formatHex8:Ae,formatRgb:J,toString:J}));function U(){return`#${m(this.r)}${m(this.g)}${m(this.b)}`}function Ae(){return`#${m(this.r)}${m(this.g)}${m(this.b)}${m((isNaN(this.opacity)?1:this.opacity)*255)}`}function J(){const t=T(this.opacity);return`${t===1?"rgb(":"rgba("}${v(this.r)}, ${v(this.g)}, ${v(this.b)}${t===1?")":`, ${t})`}`}function T(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function v(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function m(t){return t=v(t),(t<16?"0":"")+t.toString(16)}function K(t,e,r,n){return n<=0?t=e=r=NaN:r<=0||r>=1?t=e=NaN:e<=0&&(t=NaN),new g(t,e,r,n)}function ue(t){if(t instanceof g)return new g(t.h,t.s,t.l,t.opacity);if(t instanceof G||(t=N(t)),!t)return new g;if(t instanceof g)return t;t=t.rgb();var e=t.r/255,r=t.g/255,n=t.b/255,a=Math.min(e,r,n),o=Math.max(e,r,n),i=NaN,s=o-a,f=(o+a)/2;return s?(e===o?i=(r-n)/s+(r<n)*6:r===o?i=(n-e)/s+2:i=(e-r)/s+4,s/=f<.5?o+a:2-o-a,i*=60):s=f>0&&f<1?0:i,new g(i,s,f,t.opacity)}function Se(t,e,r,n){return arguments.length===1?ue(t):new g(t,e,r,n??1)}function g(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}V(g,Se,le(G,{brighter(t){return t=t==null?C:Math.pow(C,t),new g(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?y:Math.pow(y,t),new g(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*e,a=2*r-n;return new x(j(t>=240?t-240:t+120,a,n),j(t,a,n),j(t<120?t+240:t-120,a,n),this.opacity)},clamp(){return new g(Q(this.h),R(this.s),R(this.l),T(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=T(this.opacity);return`${t===1?"hsl(":"hsla("}${Q(this.h)}, ${R(this.s)*100}%, ${R(this.l)*100}%${t===1?")":`, ${t})`}`}}));function Q(t){return t=(t||0)%360,t<0?t+360:t}function R(t){return Math.max(0,Math.min(1,t||0))}function j(t,e,r){return(t<60?e+(r-e)*t/60:t<180?r:t<240?e+(r-e)*(240-t)/60:e)*255}const q=t=>()=>t;function Ve(t,e){return function(r){return t+r*e}}function qe(t,e,r){return t=Math.pow(t,r),e=Math.pow(e,r)-t,r=1/r,function(n){return Math.pow(t+n*e,r)}}function De(t){return(t=+t)==1?ce:function(e,r){return r-e?qe(e,r,t):q(isNaN(e)?r:e)}}function ce(t,e){var r=e-t;return r?Ve(t,r):q(isNaN(t)?e:t)}const W=(function t(e){var r=De(e);function n(a,o){var i=r((a=I(a)).r,(o=I(o)).r),s=r(a.g,o.g),f=r(a.b,o.b),u=ce(a.opacity,o.opacity);return function(l){return a.r=i(l),a.g=s(l),a.b=f(l),a.opacity=u(l),a+""}}return n.gamma=t,n})(1);function Fe(t,e){e||(e=[]);var r=t?Math.min(e.length,t.length):0,n=e.slice(),a;return function(o){for(a=0;a<r;++a)n[a]=t[a]*(1-o)+e[a]*o;return n}}function Oe(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function Be(t,e){var r=e?e.length:0,n=t?Math.min(r,t.length):0,a=new Array(n),o=new Array(r),i;for(i=0;i<n;++i)a[i]=de(t[i],e[i]);for(;i<r;++i)o[i]=e[i];return function(s){for(i=0;i<n;++i)o[i]=a[i](s);return o}}function Le(t,e){var r=new Date;return t=+t,e=+e,function(n){return r.setTime(t*(1-n)+e*n),r}}function E(t,e){return t=+t,e=+e,function(r){return t*(1-r)+e*r}}function Ue(t,e){var r={},n={},a;(t===null||typeof t!="object")&&(t={}),(e===null||typeof e!="object")&&(e={});for(a in e)a in t?r[a]=de(t[a],e[a]):n[a]=e[a];return function(o){for(a in r)n[a]=r[a](o);return n}}var H=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,_=new RegExp(H.source,"g");function Je(t){return function(){return t}}function Ke(t){return function(e){return t(e)+""}}function Qe(t,e){var r=H.lastIndex=_.lastIndex=0,n,a,o,i=-1,s=[],f=[];for(t=t+"",e=e+"";(n=H.exec(t))&&(a=_.exec(e));)(o=a.index)>r&&(o=e.slice(r,o),s[i]?s[i]+=o:s[++i]=o),(n=n[0])===(a=a[0])?s[i]?s[i]+=a:s[++i]=a:(s[++i]=null,f.push({i,x:E(n,a)})),r=_.lastIndex;return r<e.length&&(o=e.slice(r),s[i]?s[i]+=o:s[++i]=o),s.length<2?f[0]?Ke(f[0].x):Je(e):(e=f.length,function(u){for(var l=0,d;l<e;++l)s[(d=f[l]).i]=d.x(u);return s.join("")})}function de(t,e){var r=typeof e,n;return e==null||r==="boolean"?q(e):(r==="number"?E:r==="string"?(n=N(e))?(e=n,W):Qe:e instanceof N?W:e instanceof Date?Le:Oe(e)?Fe:Array.isArray(e)?Be:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?Ue:E)(t,e)}export{Ze as T,W as a,Qe as b,N as c,de as d,Ye as e,E as i};
|
|
1
|
+
import{r as z,a8 as A,j as c,a3 as M,a6 as ge,H as h,a9 as he,aa as X,a4 as pe,a2 as be,ab as me,i as ve,c as Y}from"./index-C0cxXUhv.js";import{c as Z}from"./button-BID2CMhP.js";var ee="Toggle",te=z.forwardRef((t,e)=>{const{pressed:r,defaultPressed:n,onPressedChange:a,...o}=t,[i,s]=A({prop:r,onChange:a,defaultProp:n??!1,caller:ee});return c.jsx(M.button,{type:"button","aria-pressed":i,"data-state":i?"on":"off","data-disabled":t.disabled?"":void 0,...o,ref:e,onClick:ge(t.onClick,()=>{t.disabled||s(!i)})})});te.displayName=ee;var b="ToggleGroup",[re]=pe(b,[X]),ne=X(),S=h.forwardRef((t,e)=>{const{type:r,...n}=t;if(r==="single"){const a=n;return c.jsx(we,{...a,ref:e})}if(r==="multiple"){const a=n;return c.jsx(ye,{...a,ref:e})}throw new Error(`Missing prop \`type\` expected on \`${b}\``)});S.displayName=b;var[ae,ie]=re(b),we=h.forwardRef((t,e)=>{const{value:r,defaultValue:n,onValueChange:a=()=>{},...o}=t,[i,s]=A({prop:r,defaultProp:n??"",onChange:a,caller:b});return c.jsx(ae,{scope:t.__scopeToggleGroup,type:"single",value:h.useMemo(()=>i?[i]:[],[i]),onItemActivate:s,onItemDeactivate:h.useCallback(()=>s(""),[s]),children:c.jsx(oe,{...o,ref:e})})}),ye=h.forwardRef((t,e)=>{const{value:r,defaultValue:n,onValueChange:a=()=>{},...o}=t,[i,s]=A({prop:r,defaultProp:n??[],onChange:a,caller:b}),f=h.useCallback(l=>s((d=[])=>[...d,l]),[s]),u=h.useCallback(l=>s((d=[])=>d.filter(xe=>xe!==l)),[s]);return c.jsx(ae,{scope:t.__scopeToggleGroup,type:"multiple",value:i,onItemActivate:f,onItemDeactivate:u,children:c.jsx(oe,{...o,ref:e})})});S.displayName=b;var[$e,Ne]=re(b),oe=h.forwardRef((t,e)=>{const{__scopeToggleGroup:r,disabled:n=!1,rovingFocus:a=!0,orientation:o,dir:i,loop:s=!0,...f}=t,u=ne(r),l=be(i),d={role:"group",dir:l,...f};return c.jsx($e,{scope:r,rovingFocus:a,disabled:n,children:a?c.jsx(me,{asChild:!0,...u,orientation:o,dir:l,loop:s,children:c.jsx(M.div,{...d,ref:e})}):c.jsx(M.div,{...d,ref:e})})}),k="ToggleGroupItem",se=h.forwardRef((t,e)=>{const r=ie(k,t.__scopeToggleGroup),n=Ne(k,t.__scopeToggleGroup),a=ne(t.__scopeToggleGroup),o=r.value.includes(t.value),i=n.disabled||t.disabled,s={...t,pressed:o,disabled:i},f=h.useRef(null);return n.rovingFocus?c.jsx(he,{asChild:!0,...a,focusable:!i,active:o,ref:f,children:c.jsx(D,{...s,ref:e})}):c.jsx(D,{...s,ref:e})});se.displayName=k;var D=h.forwardRef((t,e)=>{const{__scopeToggleGroup:r,value:n,...a}=t,o=ie(k,r),i={role:"radio","aria-checked":t.pressed,"aria-pressed":void 0},s=o.type==="single"?i:void 0;return c.jsx(te,{...s,...a,ref:e,onPressedChange:f=>{f?o.onItemActivate(n):o.onItemDeactivate(n)}})}),Ge=S,Pe=se;const Re=ve("inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none transition-[color,box-shadow] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive whitespace-nowrap",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"},size:{default:"h-10 px-2 min-w-9",sm:"h-7 px-1.5 min-w-8",lg:"h-10 px-2.5 min-w-10"}},defaultVariants:{variant:"default",size:"default"}}),fe=z.createContext({size:"default",variant:"default"});function Ye(t){const e=Y.c(20);let r,n,a,o,i;e[0]!==t?({className:n,variant:i,size:o,children:r,...a}=t,e[0]=t,e[1]=r,e[2]=n,e[3]=a,e[4]=o,e[5]=i):(r=e[1],n=e[2],a=e[3],o=e[4],i=e[5]);let s;e[6]!==n?(s=Z("group/toggle-group flex w-fit items-center rounded-md data-[variant=outline]:shadow-xs",n),e[6]=n,e[7]=s):s=e[7];let f;e[8]!==o||e[9]!==i?(f={variant:i,size:o},e[8]=o,e[9]=i,e[10]=f):f=e[10];let u;e[11]!==r||e[12]!==f?(u=c.jsx(fe.Provider,{value:f,children:r}),e[11]=r,e[12]=f,e[13]=u):u=e[13];let l;return e[14]!==a||e[15]!==o||e[16]!==s||e[17]!==u||e[18]!==i?(l=c.jsx(Ge,{"data-slot":"toggle-group","data-variant":i,"data-size":o,className:s,...a,children:u}),e[14]=a,e[15]=o,e[16]=s,e[17]=u,e[18]=i,e[19]=l):l=e[19],l}function Ze(t){const e=Y.c(18);let r,n,a,o,i;e[0]!==t?({className:n,children:r,variant:i,size:o,...a}=t,e[0]=t,e[1]=r,e[2]=n,e[3]=a,e[4]=o,e[5]=i):(r=e[1],n=e[2],a=e[3],o=e[4],i=e[5]);const s=z.useContext(fe),f=s.variant||i,u=s.size||o;let l;e[6]!==n||e[7]!==s.size||e[8]!==s.variant||e[9]!==o||e[10]!==i?(l=Z(Re({variant:s.variant||i,size:s.size||o}),"min-w-0 flex-1 shrink-0 rounded-none shadow-none first:rounded-l-md last:rounded-r-md focus:z-10 focus-visible:z-10 data-[variant=outline]:border-l-0 data-[variant=outline]:first:border-l",n),e[6]=n,e[7]=s.size,e[8]=s.variant,e[9]=o,e[10]=i,e[11]=l):l=e[11];let d;return e[12]!==r||e[13]!==a||e[14]!==f||e[15]!==u||e[16]!==l?(d=c.jsx(Pe,{"data-slot":"toggle-group-item","data-variant":f,"data-size":u,className:l,...a,children:r}),e[12]=r,e[13]=a,e[14]=f,e[15]=u,e[16]=l,e[17]=d):d=e[17],d}function V(t,e,r){t.prototype=e.prototype=r,r.constructor=t}function le(t,e){var r=Object.create(t.prototype);for(var n in e)r[n]=e[n];return r}function G(){}var y=.7,C=1/y,w="\\s*([+-]?\\d+)\\s*",$="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",p="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",ke=/^#([0-9a-f]{3,8})$/,Ce=new RegExp(`^rgb\\(${w},${w},${w}\\)$`),Te=new RegExp(`^rgb\\(${p},${p},${p}\\)$`),je=new RegExp(`^rgba\\(${w},${w},${w},${$}\\)$`),_e=new RegExp(`^rgba\\(${p},${p},${p},${$}\\)$`),Me=new RegExp(`^hsl\\(${$},${p},${p}\\)$`),Ie=new RegExp(`^hsla\\(${$},${p},${p},${$}\\)$`),F={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};V(G,N,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:O,formatHex:O,formatHex8:Ee,formatHsl:He,formatRgb:B,toString:B});function O(){return this.rgb().formatHex()}function Ee(){return this.rgb().formatHex8()}function He(){return ue(this).formatHsl()}function B(){return this.rgb().formatRgb()}function N(t){var e,r;return t=(t+"").trim().toLowerCase(),(e=ke.exec(t))?(r=e[1].length,e=parseInt(e[1],16),r===6?L(e):r===3?new x(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):r===8?P(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):r===4?P(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=Ce.exec(t))?new x(e[1],e[2],e[3],1):(e=Te.exec(t))?new x(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=je.exec(t))?P(e[1],e[2],e[3],e[4]):(e=_e.exec(t))?P(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=Me.exec(t))?K(e[1],e[2]/100,e[3]/100,1):(e=Ie.exec(t))?K(e[1],e[2]/100,e[3]/100,e[4]):F.hasOwnProperty(t)?L(F[t]):t==="transparent"?new x(NaN,NaN,NaN,0):null}function L(t){return new x(t>>16&255,t>>8&255,t&255,1)}function P(t,e,r,n){return n<=0&&(t=e=r=NaN),new x(t,e,r,n)}function ze(t){return t instanceof G||(t=N(t)),t?(t=t.rgb(),new x(t.r,t.g,t.b,t.opacity)):new x}function I(t,e,r,n){return arguments.length===1?ze(t):new x(t,e,r,n??1)}function x(t,e,r,n){this.r=+t,this.g=+e,this.b=+r,this.opacity=+n}V(x,I,le(G,{brighter(t){return t=t==null?C:Math.pow(C,t),new x(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?y:Math.pow(y,t),new x(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new x(v(this.r),v(this.g),v(this.b),T(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:U,formatHex:U,formatHex8:Ae,formatRgb:J,toString:J}));function U(){return`#${m(this.r)}${m(this.g)}${m(this.b)}`}function Ae(){return`#${m(this.r)}${m(this.g)}${m(this.b)}${m((isNaN(this.opacity)?1:this.opacity)*255)}`}function J(){const t=T(this.opacity);return`${t===1?"rgb(":"rgba("}${v(this.r)}, ${v(this.g)}, ${v(this.b)}${t===1?")":`, ${t})`}`}function T(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function v(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function m(t){return t=v(t),(t<16?"0":"")+t.toString(16)}function K(t,e,r,n){return n<=0?t=e=r=NaN:r<=0||r>=1?t=e=NaN:e<=0&&(t=NaN),new g(t,e,r,n)}function ue(t){if(t instanceof g)return new g(t.h,t.s,t.l,t.opacity);if(t instanceof G||(t=N(t)),!t)return new g;if(t instanceof g)return t;t=t.rgb();var e=t.r/255,r=t.g/255,n=t.b/255,a=Math.min(e,r,n),o=Math.max(e,r,n),i=NaN,s=o-a,f=(o+a)/2;return s?(e===o?i=(r-n)/s+(r<n)*6:r===o?i=(n-e)/s+2:i=(e-r)/s+4,s/=f<.5?o+a:2-o-a,i*=60):s=f>0&&f<1?0:i,new g(i,s,f,t.opacity)}function Se(t,e,r,n){return arguments.length===1?ue(t):new g(t,e,r,n??1)}function g(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}V(g,Se,le(G,{brighter(t){return t=t==null?C:Math.pow(C,t),new g(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?y:Math.pow(y,t),new g(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*e,a=2*r-n;return new x(j(t>=240?t-240:t+120,a,n),j(t,a,n),j(t<120?t+240:t-120,a,n),this.opacity)},clamp(){return new g(Q(this.h),R(this.s),R(this.l),T(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=T(this.opacity);return`${t===1?"hsl(":"hsla("}${Q(this.h)}, ${R(this.s)*100}%, ${R(this.l)*100}%${t===1?")":`, ${t})`}`}}));function Q(t){return t=(t||0)%360,t<0?t+360:t}function R(t){return Math.max(0,Math.min(1,t||0))}function j(t,e,r){return(t<60?e+(r-e)*t/60:t<180?r:t<240?e+(r-e)*(240-t)/60:e)*255}const q=t=>()=>t;function Ve(t,e){return function(r){return t+r*e}}function qe(t,e,r){return t=Math.pow(t,r),e=Math.pow(e,r)-t,r=1/r,function(n){return Math.pow(t+n*e,r)}}function De(t){return(t=+t)==1?ce:function(e,r){return r-e?qe(e,r,t):q(isNaN(e)?r:e)}}function ce(t,e){var r=e-t;return r?Ve(t,r):q(isNaN(t)?e:t)}const W=(function t(e){var r=De(e);function n(a,o){var i=r((a=I(a)).r,(o=I(o)).r),s=r(a.g,o.g),f=r(a.b,o.b),u=ce(a.opacity,o.opacity);return function(l){return a.r=i(l),a.g=s(l),a.b=f(l),a.opacity=u(l),a+""}}return n.gamma=t,n})(1);function Fe(t,e){e||(e=[]);var r=t?Math.min(e.length,t.length):0,n=e.slice(),a;return function(o){for(a=0;a<r;++a)n[a]=t[a]*(1-o)+e[a]*o;return n}}function Oe(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function Be(t,e){var r=e?e.length:0,n=t?Math.min(r,t.length):0,a=new Array(n),o=new Array(r),i;for(i=0;i<n;++i)a[i]=de(t[i],e[i]);for(;i<r;++i)o[i]=e[i];return function(s){for(i=0;i<n;++i)o[i]=a[i](s);return o}}function Le(t,e){var r=new Date;return t=+t,e=+e,function(n){return r.setTime(t*(1-n)+e*n),r}}function E(t,e){return t=+t,e=+e,function(r){return t*(1-r)+e*r}}function Ue(t,e){var r={},n={},a;(t===null||typeof t!="object")&&(t={}),(e===null||typeof e!="object")&&(e={});for(a in e)a in t?r[a]=de(t[a],e[a]):n[a]=e[a];return function(o){for(a in r)n[a]=r[a](o);return n}}var H=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,_=new RegExp(H.source,"g");function Je(t){return function(){return t}}function Ke(t){return function(e){return t(e)+""}}function Qe(t,e){var r=H.lastIndex=_.lastIndex=0,n,a,o,i=-1,s=[],f=[];for(t=t+"",e=e+"";(n=H.exec(t))&&(a=_.exec(e));)(o=a.index)>r&&(o=e.slice(r,o),s[i]?s[i]+=o:s[++i]=o),(n=n[0])===(a=a[0])?s[i]?s[i]+=a:s[++i]=a:(s[++i]=null,f.push({i,x:E(n,a)})),r=_.lastIndex;return r<e.length&&(o=e.slice(r),s[i]?s[i]+=o:s[++i]=o),s.length<2?f[0]?Ke(f[0].x):Je(e):(e=f.length,function(u){for(var l=0,d;l<e;++l)s[(d=f[l]).i]=d.x(u);return s.join("")})}function de(t,e){var r=typeof e,n;return e==null||r==="boolean"?q(e):(r==="number"?E:r==="string"?(n=N(e))?(e=n,W):Qe:e instanceof N?W:e instanceof Date?Le:Oe(e)?Fe:Array.isArray(e)?Be:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?Ue:E)(t,e)}export{Ze as T,W as a,Qe as b,N as c,de as d,Ye as e,E as i};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as Y,r as V,j as i}from"./index-
|
|
1
|
+
import{c as Y,r as V,j as i}from"./index-C0cxXUhv.js";import{c as n}from"./button-BID2CMhP.js";const Z={sm:{button:"size-7",icon:"size-4"},md:{button:"size-9",icon:"size-5"},lg:{button:"size-12",icon:"size-6"}};function oe(J){const e=Y.c(66),{value:o,onValueChange:l,options:t,size:D,fullWidth:F,className:W}=J,K=D===void 0?"sm":D,w=F===void 0?!1:F,G=V.useRef(null),H=V.useRef(null);let R;e[0]===Symbol.for("react.memo_cache_sentinel")?(R={left:0,width:0,opacity:0},e[0]=R):R=e[0];const[N,O]=V.useState(R);let _;e[1]===Symbol.for("react.memo_cache_sentinel")?(_=S=>{if(!S.current)return;const{offsetLeft:U,offsetWidth:X}=S.current;O({left:U,width:X,opacity:1})},e[1]=_):_=e[1];const Q=_;let C;e[2]!==t[0].value||e[3]!==o?(C=()=>{const S=o===t[0].value?G:H;Q(S)},e[2]=t[0].value,e[3]=o,e[4]=C):C=e[4];let E;e[5]!==t||e[6]!==o?(E=[o,t],e[5]=t,e[6]=o,e[7]=E):E=e[7],V.useEffect(C,E);const s=Z[K];let a;e[8]!==W?(a=n("relative flex gap-0 bg-muted rounded-lg",W),e[8]=W,e[9]=a):a=e[9];let c;e[10]!==l||e[11]!==t[0].value?(c=()=>l(t[0].value),e[10]=l,e[11]=t[0].value,e[12]=c):c=e[12];const $=w?"flex-1 h-12 px-4":s.button,I=!w&&t[0].label?"px-3":"";let r;e[13]!==I||e[14]!==$?(r=n("relative z-10 flex items-center justify-center gap-2 rounded-lg transition-colors [transition-timing-function:var(--ease-out-cubic)] duration-200",$,I),e[13]=I,e[14]=$,e[15]=r):r=e[15];const P=o===t[0].value?"text-foreground":"text-muted-foreground";let u;e[16]!==s.icon||e[17]!==P?(u=n("transition-colors ease-out duration-200 flex items-center justify-center [&>svg]:size-[1em]",s.icon,P),e[16]=s.icon,e[17]=P,e[18]=u):u=e[18];let f;e[19]!==t[0].icon||e[20]!==u?(f=i.jsx("span",{className:u,children:t[0].icon}),e[19]=t[0].icon,e[20]=u,e[21]=f):f=e[21];let d;e[22]!==t[0].label||e[23]!==t[0].value||e[24]!==o?(d=t[0].label&&i.jsx("span",{className:n("text-xs transition-colors ease-out duration-200 whitespace-nowrap",o===t[0].value?"text-foreground":"text-muted-foreground"),children:t[0].label}),e[22]=t[0].label,e[23]=t[0].value,e[24]=o,e[25]=d):d=e[25];let m;e[26]!==r||e[27]!==f||e[28]!==d||e[29]!==c?(m=i.jsxs("button",{ref:G,type:"button",onClick:c,className:r,children:[f,d]}),e[26]=r,e[27]=f,e[28]=d,e[29]=c,e[30]=m):m=e[30];let x;e[31]!==l||e[32]!==t[1].value?(x=()=>l(t[1].value),e[31]=l,e[32]=t[1].value,e[33]=x):x=e[33];const L=w?"flex-1 h-12 px-4":s.button,M=!w&&t[1].label?"px-3":"";let p;e[34]!==L||e[35]!==M?(p=n("relative z-10 flex items-center justify-center gap-2 rounded-lg transition-colors [transition-timing-function:var(--ease-out-cubic)] duration-200",L,M),e[34]=L,e[35]=M,e[36]=p):p=e[36];const T=o===t[1].value?"text-foreground":"text-muted-foreground";let b;e[37]!==s.icon||e[38]!==T?(b=n("transition-colors ease-out duration-200 flex items-center justify-center [&>svg]:size-[1em]",s.icon,T),e[37]=s.icon,e[38]=T,e[39]=b):b=e[39];let v;e[40]!==t[1].icon||e[41]!==b?(v=i.jsx("span",{className:b,children:t[1].icon}),e[40]=t[1].icon,e[41]=b,e[42]=v):v=e[42];let g;e[43]!==t[1].label||e[44]!==t[1].value||e[45]!==o?(g=t[1].label&&i.jsx("span",{className:n("text-xs transition-colors ease-out duration-200 whitespace-nowrap",o===t[1].value?"text-foreground":"text-muted-foreground"),children:t[1].label}),e[43]=t[1].label,e[44]=t[1].value,e[45]=o,e[46]=g):g=e[46];let h;e[47]!==x||e[48]!==p||e[49]!==v||e[50]!==g?(h=i.jsxs("button",{ref:H,type:"button",onClick:x,className:p,children:[v,g]}),e[47]=x,e[48]=p,e[49]=v,e[50]=g,e[51]=h):h=e[51];const q=w?"h-12":s.button;let y;e[52]!==q?(y=n("absolute z-0 bg-background rounded-lg border-shadow transition-all [transition-timing-function:var(--ease-out-cubic)] duration-200",q),e[52]=q,e[53]=y):y=e[53];const A=`${N.left}px`,B=`${N.width}px`;let j;e[54]!==N.opacity||e[55]!==A||e[56]!==B?(j={left:A,width:B,opacity:N.opacity},e[54]=N.opacity,e[55]=A,e[56]=B,e[57]=j):j=e[57];let z;e[58]!==y||e[59]!==j?(z=i.jsx("div",{className:y,style:j}),e[58]=y,e[59]=j,e[60]=z):z=e[60];let k;return e[61]!==m||e[62]!==h||e[63]!==z||e[64]!==a?(k=i.jsxs("div",{className:a,children:[m,h,z]}),e[61]=m,e[62]=h,e[63]=z,e[64]=a,e[65]=k):k=e[65],k}export{oe as V};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as L,f as P,r as v,j as e,c as k}from"./index-
|
|
1
|
+
import{a as L,f as P,r as v,j as e,c as k}from"./index-C0cxXUhv.js";import{d as _}from"./well-known-mcp-DOEdYmKO.js";import{C as R}from"./collection-tab-5E9Q1B_9.js";import{a as z,u as A}from"./use-connection-D__nfNf6.js";import{u as B}from"./project-context-provider-CG5Jt9jX.js";import{B as y}from"./button-BID2CMhP.js";import{E as F}from"./empty-state-aph8hymo.js";import{C as M}from"./collection-header-C2jCnQ0V.js";import{b as O,a as H}from"./use-binding-CmWOKG-X.js";import{i as T}from"./Loading01-CVbOjnPi.js";import"./generate-id-Dyweu44Y.js";import"./connection-CzagOXhI.js";import"./collection-display-button-CES97i9G.js";import"./dropdown-menu-CZuHPcK3.js";import"./Grid01-uChhmLMS.js";import"./ArrowUp-UuyzMrp7.js";import"./Check-BBlt8nj4.js";import"./List-DTNJ5e_Z.js";import"./tooltip-BpIeWmG3.js";import"./view-mode-toggle--WEYRZgf.js";import"./collection-search-CYQ70Hoa.js";import"./SearchMd-CDx95UHX.js";import"./input-DHdPZHvh.js";import"./card-6juGo41K.js";import"./Copy01-eVnag3mk.js";import"./DotsVertical-Cl1hRwhg.js";import"./Edit01-C2f_e3xp.js";import"./use-list-state-D7wpG1Rh.js";import"./use-mobile-Bw0zGvKx.js";import"./Trash01-hrLLpuYX.js";import"./collection-table-wrapper-CVkp-9hJ.js";import"./empty-state-B2MmEXSc.js";import"./Inbox01-7yaEdhih.js";import"./avatar-_fJCi1jf.js";import"./useQuery-CENoGrPp.js";import"./pin-to-sidebar-button-BTWnJIgz.js";import"./use-organization-settings-DYYG9Qqm.js";import"./useMutation-DujnxbMG.js";import"./use-collections-BRVu5nwP.js";import"./constants-VQyKSexs.js";import"./alert-dialog-5F29h7ch.js";import"./Plus-jsBXu2Jm.js";import"./layout-DVqtFrGe.js";import"./ArrowLeft-C3b0kZkv.js";import"./binder-QE3BUq_4.js";function V({title:i,description:t,wellKnownMcp:o,imageSrc:n,onConnected:s}){const r=z(),{org:{slug:m}}=B(),{data:h}=L.useSession(),p=P(),[a,N]=v.useState(!1),l=async()=>{if(!(!o||!h?.user?.id)){N(!0);try{const c=await r.create.mutateAsync(o);s?.(c.id),p({to:"/$org/mcps/$connectionId",params:{org:m,connectionId:c.id}})}finally{N(!1)}}},j=()=>{p({to:"/$org/mcps",params:{org:m},search:{action:"create"}})};return e.jsx(F,{image:n?e.jsx("img",{src:n,alt:i,width:336,height:320,className:"max-w-full h-auto"}):null,title:i,description:t,actions:e.jsxs(e.Fragment,{children:[e.jsxs(y,{variant:"outline",onClick:l,disabled:a||!o,children:[o?.icon&&e.jsx("img",{src:o.icon,alt:"",className:"size-4"}),a?"Installing...":`Install ${o?.title||"MCP"}`]}),e.jsx(y,{variant:"outline",onClick:j,children:"Custom Connection"})]})})}function q(i){const t=k.c(28),{bindingName:o,collectionName:n,title:s,emptyState:r,wellKnownMcp:m}=i,{org:h}=B(),p=A();let a;t[0]!==p||t[1]!==o?(a={connections:p,binding:o},t[0]=p,t[1]=o,t[2]=a):a=t[2];const l=O(a)[0],j=H(l);let c;if(t[3]!==n||t[4]!==j){let C;t[6]!==n?(C=$=>$.name.toLowerCase()===n.toLowerCase(),t[6]=n,t[7]=C):C=t[7],c=j.find(C),t[3]=n,t[4]=j,t[5]=c}else c=t[5];const S=c,[E,W]=v.useState(null),b=l&&S&&(l.id||E);let d;t[8]!==s?(d=e.jsx(M,{title:s}),t[8]=s,t[9]=d):d=t[9];let I;t[10]===Symbol.for("react.memo_cache_sentinel")?(I=e.jsx(T,{size:32,className:"animate-spin text-muted-foreground mb-4"}),t[10]=I):I=t[10];let f;t[11]!==s?(f=s.toLowerCase(),t[11]=s,t[12]=f):f=t[12];let u;t[13]!==f?(u=e.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[I,e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Loading ",f,"..."]})]}),t[13]=f,t[14]=u):u=t[14];let g;t[15]!==S||t[16]!==l||t[17]!==r||t[18]!==h||t[19]!==b||t[20]!==m?(g=b?e.jsx(R,{connectionId:l.id,org:h.slug,activeCollection:S}):e.jsx("div",{className:"flex flex-col items-center justify-center h-full",children:e.jsx(V,{title:r.title,description:r.description,wellKnownMcp:m,imageSrc:r.imageSrc,onConnected:C=>{W(C)}})}),t[15]=S,t[16]=l,t[17]=r,t[18]=h,t[19]=b,t[20]=m,t[21]=g):g=t[21];let x;t[22]!==u||t[23]!==g?(x=e.jsx("div",{className:"h-full flex flex-col overflow-hidden",children:e.jsx(v.Suspense,{fallback:u,children:g})}),t[22]=u,t[23]=g,t[24]=x):x=t[24];let w;return t[25]!==d||t[26]!==x?(w=e.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[d,x]}),t[25]=d,t[26]=x,t[27]=w):w=t[27],w}function zt(){const i=k.c(1);let t;return i[0]===Symbol.for("react.memo_cache_sentinel")?(t=e.jsx(q,{bindingName:"WORKFLOW",collectionName:"workflow",title:"Workflows",emptyState:{title:"Create Workflows",description:"Install MCP Studio to create and manage automated workflows with multiple steps and integrations."},wellKnownMcp:_()}),i[0]=t):t=i[0],t}export{zt as default};
|
package/dist/client/index.html
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<title>MCP Mesh</title>
|
|
5
5
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
6
|
-
<script type="module" crossorigin src="/assets/index-
|
|
6
|
+
<script type="module" crossorigin src="/assets/index-C0cxXUhv.js"></script>
|
|
7
7
|
<link rel="stylesheet" crossorigin href="/assets/index-I-Aus2DH.css">
|
|
8
8
|
</head>
|
|
9
9
|
<body>
|
package/dist/server/cli.js
CHANGED
|
@@ -1141,7 +1141,7 @@ ${Y.stack}`;return Q}try{let G=JSON.stringify(Y,null,2);if(G!=="{}"&&G.length<10
|
|
|
1141
1141
|
Stack trace:
|
|
1142
1142
|
${Y.stack}`;return G}}catch{}if(typeof Y.toString==="function")try{let G=Y.toString();if(G!=="[object Object]")return G}catch{}let J=Object.keys(Y);if(J.length>0)return`Object with keys: ${J.join(", ")}`;return"[object Object]"}if(typeof X==="string")return X;if(typeof X==="number"||typeof X==="boolean")return String(X);if(typeof X==="function")return`[Function: ${X.name||"anon"}]`;if(typeof X==="symbol")return X.toString();if(typeof X==="bigint")return X.toString();try{return String(X)}catch{return"Unknown value (could not convert to string)"}}function jB(X,Y){switch(typeof Y){case"string":return X.newString(Y);case"number":return X.newNumber(Y);case"boolean":return Y?X.true:X.false;case"undefined":return X.undefined;case"object":{if(Y===null)return X.null;if(Array.isArray(Y)){let J=X.newArray();return Y.forEach((G,W)=>{let Z=jB(X,G);try{X.setProp(J,String(W),Z)}finally{Z.dispose?.()}}),J}let Q=X.newObject();for(let[J,G]of Object.entries(Y)){let W=jB(X,G);try{X.setProp(Q,J,W)}finally{W.dispose?.()}}return Q}case"function":{let Q=`__hostFn_${Date.now()}_${Math.random().toString(36).substr(2,9)}`;return X.newFunction(Q,(...G)=>{try{let W=G.map(($)=>X.dump($)),Z=Y(...W);if(Z&&typeof Z.then==="function"){let $=X.newPromise();return Z.then((K)=>{try{let H=jB(X,K);$.resolve(H),H.dispose(),X.runtime.executePendingJobs()}catch(H){let F=EB(H),V=X.newString(`Promise resolution error: ${F}`);$.reject(V),V.dispose(),X.runtime.executePendingJobs()}}).catch((K)=>{let H=EB(K),F=X.newString(`Promise rejection: ${H}`);$.reject(F),F.dispose(),X.runtime.executePendingJobs()}),$.handle}return jB(X,Z)}catch(W){let Z=EB(W);return X.newString(`HostFunctionError: ${Z}`)}finally{G.forEach((W)=>W.dispose())}})}case"bigint":return X.newString(Y.toString());case"symbol":return X.newString(Y.toString());default:try{return X.newString(String(Y))}catch{return X.undefined}}}var yG1=()=>{};function fG1(X){let Y=X.runtime.executePendingJobs(100);try{if("unwrap"in Y&&typeof Y.unwrap==="function")Y.unwrap()}finally{if("dispose"in Y&&typeof Y.dispose==="function")Y.dispose()}}async function bG1(X,Y,Q){let J=Date.now(),G=X.resolvePromise(Y);while(!0){fG1(X);let W=await Promise.race([G,af6(0).then(()=>null)]);if(W!==null)return W;if(Date.now()-J>Q)throw Error(`Timed out after ${Q}ms while awaiting a QuickJS promise`)}}async function ZY0({tools:X,code:Y,timeoutMs:Q}){let Z=[];try{let J=await vG1({memoryLimitBytes:33554432,stackSizeBytes:524288});const G=$h(Z,J.newContext({interruptAfterMs:Q}),0);const W=$h(Z,WG1(G),0);try{let F=G.evalCode(Y,"index.mjs",{strip:!0,strict:!0,type:"module"}),V=G.unwrapResult(F),q=jB(G,X);G.setProp(G.global,"tools",q);let z=G.runtime.hasPendingJob()?G.unwrapResult(await bG1(G,V,Q)):V;if(z!==V)V.dispose();let D=G.getProp(z,"default"),N=G.typeof(D);if(N!=="function")return{error:`Code must export default a function (tools). Got ${N}. Example: export default async (tools) => { /* ... */ }`,consoleLogs:W.logs};let L=G.callFunction(D,G.undefined,q),w=G.unwrapResult(L),C=await bG1(G,w,Q),A=G.unwrapResult(C);if(G.runtime.hasPendingJob())fG1(G);return{returnValue:G.dump(A),consoleLogs:W.logs}}catch(F){return console.log(F),{error:EB(F),consoleLogs:W.logs}}}catch($){var K=$,H=1}finally{oQ0(Z,K,H)}}var af6=(X)=>new Promise((Y)=>setTimeout(Y,X));var hG1=k(()=>{_G1();yG1()});var xG1=k(()=>{hG1()});async function rf6(X,Y){let Q;if(X.tool_selection_mode==="exclusion"){let G=(await Y.storage.connections.list(X.organization_id)).filter((Z)=>Z.status==="active"),W=new Map;for(let Z of X.connections)W.set(Z.connection_id,{selectedTools:Z.selected_tools,selectedResources:Z.selected_resources,selectedPrompts:Z.selected_prompts});Q=[];for(let Z of G){let $=W.get(Z.id);if($===void 0)Q.push({connection:Z,selectedTools:null,selectedResources:null,selectedPrompts:null});else if(($.selectedTools===null||$.selectedTools.length===0)&&($.selectedResources===null||$.selectedResources.length===0)&&($.selectedPrompts===null||$.selectedPrompts.length===0));else Q.push({connection:Z,selectedTools:$.selectedTools,selectedResources:$.selectedResources,selectedPrompts:$.selectedPrompts})}}else{let J=X.connections.map((W)=>W.connection_id),G=[];for(let W of J){let Z=await Y.storage.connections.findById(W);if(Z&&Z.status==="active")G.push(Z)}Q=G.map((W)=>{let Z=X.connections.find(($)=>$.connection_id===W.id);return{connection:W,selectedTools:Z?.selected_tools??null,selectedResources:Z?.selected_resources??null,selectedPrompts:Z?.selected_prompts??null}})}return Q}async function gG1(X,Y){return(await Y.storage.connections.list(X)).filter((J)=>J.status==="active").map((J)=>({connection:J,selectedTools:null,selectedResources:null,selectedPrompts:null}))}async function of6(X,Y,Q){let J=await TB.create(X,Q),G=await J.mapSettled(async(F,V)=>{try{let z=(await F.proxy.client.listTools()).tools;if(Y==="exclusion"){if(F.selectedTools&&F.selectedTools.length>0){let D=new Set(F.selectedTools);z=z.filter((N)=>!D.has(N.name))}}else if(F.selectedTools&&F.selectedTools.length>0){let D=new Set(F.selectedTools);z=z.filter((N)=>D.has(N.name))}return{connectionId:V,connectionTitle:F.connection.title,tools:z}}catch(q){return console.error(`[code-execution] Failed to list tools for connection ${V}:`,q),null}}),W=new Set,Z=[],$=new Map,K=new Set;for(let F of G){if(F.status!=="fulfilled"||!F.value)continue;let{connectionId:V,connectionTitle:q,tools:z}=F.value;K.add(q);for(let D of z){if(W.has(D.name))continue;W.add(D.name),Z.push({...D,_meta:{connectionId:V,connectionTitle:q}}),$.set(D.name,{connectionId:V,originalName:D.name})}}return{tools:Z,callTool:async(F,V)=>{let q=$.get(F);if(!q)return{content:[{type:"text",text:`Tool not found: ${F}`}],isError:!0};let z=J.get(q.connectionId);if(!z)return{content:[{type:"text",text:`Connection not found for tool: ${F}`}],isError:!0};return await z.proxy.client.callTool({name:q.originalName,arguments:V})},categories:Array.from(K).sort()}}async function CB(X){let Y=_1(X),Q,J="inclusion";if(X.connectionId){let G=await X.storage.virtualMcps.findById(X.connectionId);if(G)Q=await rf6(G,X),J=G.tool_selection_mode;else Q=await gG1(Y.id,X)}else Q=await gG1(Y.id,X);return of6(Q,J,X)}function sf6(X){return X.toLowerCase().split(/[\s_\-./]+/).filter((Y)=>Y.length>=2)}function tf6(X,Y){let Q=0,J=Y.name.toLowerCase(),G=(Y.description??"").toLowerCase(),W=Y._meta.connectionTitle.toLowerCase();for(let Z of X){if(J===Z)Q+=10;else if(J.includes(Z))Q+=3;if(G.includes(Z))Q+=2;if(W.includes(Z))Q+=1}return Q}function ob(X,Y,Q){let J=sf6(X);if(J.length===0)return Y.slice(0,Q);return Y.map((G)=>({tool:G,score:tf6(J,G)})).filter((G)=>G.score>0).sort((G,W)=>W.score-G.score).slice(0,Q).map((G)=>G.tool)}function sb(X,Y){let Q=new Map(Y.map((G)=>[G.name,G]));return{tools:X.map((G)=>Q.get(G)).filter((G)=>G!==void 0).map((G)=>({name:G.name,description:G.description,connection:G._meta.connectionTitle,inputSchema:G.inputSchema,outputSchema:G.outputSchema})),notFound:X.filter((G)=>!Q.has(G))}}async function tb(X,Y,Q){let J=Object.fromEntries(Y.tools.map((G)=>[G.name,async(W)=>Y.callTool(G.name,W??{})]));return ZY0({code:X,tools:J,timeoutMs:Q})}function eb(X){return{content:[{type:"text",text:JSON.stringify(X,null,2)}]}}function IB(X){return{content:[{type:"text",text:JSON.stringify(X,null,2)}],isError:!0}}function JT(X){let Y=new Set(ef6);return X.filter((Q)=>!Y.has(Q.name))}var ef6;var GT=k(()=>{xG1();ef6=["CODE_EXECUTION_SEARCH_TOOLS","CODE_EXECUTION_DESCRIBE_TOOLS","CODE_EXECUTION_RUN_CODE"]});var $Y0;var uG1=k(()=>{$6();YT();GT();$Y0=e0({name:"CODE_EXECUTION_SEARCH_TOOLS",description:"Search for available tools by name or description. Returns tool names and brief descriptions without full schemas. Use this to discover tools before calling CODE_EXECUTION_DESCRIBE_TOOLS for detailed schemas.",inputSchema:e51,outputSchema:XG1,handler:async(X,Y)=>{z1(Y),_1(Y),await Y.access.check();let Q=await CB(Y),J=ob(X.query,Q.tools,X.limit);return{query:X.query,results:J.map((G)=>({name:G.name,description:G.description,connection:G._meta.connectionTitle})),totalAvailable:Q.tools.length}}})});var KY0;var mG1=k(()=>{$6();YT();GT();KY0=e0({name:"CODE_EXECUTION_DESCRIBE_TOOLS",description:"Get detailed schemas for specific tools. Call after CODE_EXECUTION_SEARCH_TOOLS to get full input/output schemas before executing code.",inputSchema:YG1,outputSchema:QG1,handler:async(X,Y)=>{z1(Y),_1(Y),await Y.access.check();let Q=await CB(Y);return sb(X.tools,Q.tools)}})});var HY0;var lG1=k(()=>{$6();YT();GT();HY0=e0({name:"CODE_EXECUTION_RUN_CODE",description:'Run JavaScript code in a sandbox. Code must be an ES module that `export default`s an async function that receives (tools) as its first parameter. Use CODE_EXECUTION_DESCRIBE_TOOLS to understand the input/output schemas for a tool before calling it. Use `await tools.toolName(args)` or `await tools["tool-name"](args)` to call tools.',inputSchema:JG1,outputSchema:GG1,handler:async(X,Y)=>{z1(Y),_1(Y),await Y.access.check();let Q=await CB(Y);return await tb(X.code,Q,X.timeoutMs)}})});var dG1=k(()=>{uG1();mG1();lG1();YT()});var Yh6,Qh6,FY0;var pG1=k(()=>{qK();t0();$6();db();E7();Yh6=U.object({data:U41.describe("Data for the new connection (id is auto-generated if not provided)")}),Qh6=U.object({item:Q5.describe("The created connection entity")}),FY0=e0({name:"COLLECTION_CONNECTIONS_CREATE",description:"Create a new MCP connection in the organization",inputSchema:Yh6,outputSchema:Qh6,handler:async(X,Y)=>{z1(Y);let Q=_1(Y);await Y.access.check();let J=l8(Y);if(!J)throw Error("User ID required to create connection");let G={...X.data,organization_id:Q.id,created_by:J};if(G.connection_type==="VIRTUAL"){let K=UK(G.connection_url);if(!K)throw Error("VIRTUAL connection requires connection_url in format: virtual://$virtual_mcp_id");let H=await Y.storage.virtualMcps.findById(K);if(!H)throw Error(`Virtual MCP not found: ${K}`);if(H.organization_id!==Q.id)throw Error("Virtual MCP does not belong to the current organization");G.connection_url=s_(K)}let W=await MB({id:`pending-${Date.now()}`,title:G.title,connection_type:G.connection_type,connection_url:G.connection_url,connection_token:G.connection_token,connection_headers:G.connection_headers}).catch(()=>null),Z=W?.length?W:null,$=await Y.storage.connections.create({...G,tools:Z});return await Y.eventBus.publish(Q.id,VK.SELF(Q.id),{type:"connection.created",data:$}),{item:$}}})});function WT(X,Y){if(X===Y)return!0;if(X==null||Y==null)return X===Y;if(typeof X!==typeof Y)return!1;if(Array.isArray(X)&&Array.isArray(Y)){if(X.length!==Y.length)return!1;return X.every((Q,J)=>WT(Q,Y[J]))}if(typeof X==="object"&&typeof Y==="object"){let Q=Object.keys(X),J=Object.keys(Y);if(Q.length!==J.length)return!1;return Q.every((G)=>J.includes(G)&&WT(X[G],Y[G]))}return!1}function Eh6(){return(X)=>{if(!Array.isArray(X))return!0;let Y=[];return X.every((Q)=>{if(Y.some((G)=>WT(Q,G)))return!1;return Y.push(Q),!0})}}function Xf(X,Y){return X.safeParse(Y).success}function yY(X){if(typeof X==="boolean")return X?U.any():U.never();let Y={};for(let G of gh6)G.apply(Y,X);let Q=[];if(Y.string!==!1)Q.push(Y.string||U.string());if(Y.number!==!1)Q.push(Y.number||U.number());if(Y.boolean!==!1)Q.push(Y.boolean||U.boolean());if(Y.null!==!1)Q.push(Y.null||U.null());if(Y.array!==!1)Q.push(Y.array||U.array(U.any()));if(Y.tuple!==!1&&Y.tuple!==void 0)Q.push(Y.tuple);if(Y.object!==!1)if(Y.object)Q.push(Y.object);else{let G=U.custom((W)=>{return typeof W==="object"&&W!==null&&!Array.isArray(W)},"Must be an object, not an array");Q.push(G)}if(Y.file!==!1&&Y.file!==void 0)Q.push(Y.file);let J;if(Q.length===0)J=U.never();else if(Q.length===1)J=Q[0];else if(!Object.keys(X).some((W)=>W!=="$schema"&&W!=="title"&&W!=="description"))J=U.any();else J=U.union(Q);for(let G of uh6)J=G.apply(J,X);return J}var Jh6=class{apply(X,Y){if(!Y.type)return;let Q=Array.isArray(Y.type)?Y.type:[Y.type],J=new Set(Q);if(!J.has("string"))X.string=!1;if(!J.has("number")&&!J.has("integer"))X.number=!1;if(!J.has("boolean"))X.boolean=!1;if(!J.has("null"))X.null=!1;if(!J.has("array"))X.array=!1;if(!J.has("object"))X.object=!1;if(J.has("integer")&&X.number!==!1){let G=X.number||U.number();if(G instanceof U.ZodNumber)X.number=G.int()}}},Gh6=class{apply(X,Y){if(Y.const===void 0)return;let Q=Y.const;if(X.string=!1,X.number=!1,X.boolean=!1,X.null=!1,X.array=!1,X.object=!1,typeof Q==="string")X.string=U.literal(Q);else if(typeof Q==="number")X.number=U.literal(Q);else if(typeof Q==="boolean")X.boolean=U.literal(Q);else if(Q===null)X.null=U.null();else if(Array.isArray(Q))X.array=void 0;else if(typeof Q==="object")X.object=void 0}},Wh6=class{apply(X,Y){if(!Y.enum)return;if(Y.enum.length===0){if(!Y.type)X.string=!1,X.number=!1,X.boolean=!1,X.null=!1,X.array=!1,X.object=!1;return}let Q={string:Y.enum.filter((J)=>typeof J==="string"),number:Y.enum.filter((J)=>typeof J==="number"),boolean:Y.enum.filter((J)=>typeof J==="boolean"),null:Y.enum.filter((J)=>J===null),array:Y.enum.filter((J)=>Array.isArray(J)),object:Y.enum.filter((J)=>typeof J==="object"&&J!==null&&!Array.isArray(J))};X.string=this.createTypeSchema(Q.string,"string"),X.number=this.createTypeSchema(Q.number,"number"),X.boolean=this.createTypeSchema(Q.boolean,"boolean"),X.null=Q.null.length>0?U.null():!1,X.array=Q.array.length>0?void 0:!1,X.object=Q.object.length>0?void 0:!1}createTypeSchema(X,Y){if(X.length===0)return!1;if(X.length===1)return U.literal(X[0]);if(Y==="string")return U.enum(X);if(Y==="number"){let[Q,J,...G]=X;return U.union([U.literal(Q),U.literal(J),...G.map((W)=>U.literal(W))])}if(Y==="boolean")return U.union([U.literal(!0),U.literal(!1)]);return!1}},Zh6=class{apply(X,Y){let Q=Y;if(Q.type==="string"&&Q.format==="binary"&&Q.contentEncoding==="binary"){let J=U.file();if(Q.minLength!==void 0)J=J.min(Q.minLength);if(Q.maxLength!==void 0)J=J.max(Q.maxLength);if(Q.contentMediaType!==void 0)J=J.mime(Q.contentMediaType);X.file=J,X.string=!1}}},$h6=class{apply(X,Y){let Q=Y;if(Y.type===void 0&&(Q.minLength!==void 0||Q.maxLength!==void 0||Q.pattern!==void 0)){if(X.string===void 0)X.string=U.string()}}},Kh6=class{apply(X,Y){let Q=Y;if(Q.minLength===void 0)return;if(X.string!==!1){let J=X.string||U.string();if(J instanceof U.ZodString)X.string=J.refine((G)=>{return Array.from(G).length>=Q.minLength},{message:`String must be at least ${Q.minLength} characters long`})}}},Hh6=class{apply(X,Y){let Q=Y;if(Q.maxLength===void 0)return;if(X.string!==!1){let J=X.string||U.string();if(J instanceof U.ZodString)X.string=J.refine((G)=>{return Array.from(G).length<=Q.maxLength},{message:`String must be at most ${Q.maxLength} characters long`})}}},Fh6=class{apply(X,Y){let Q=Y;if(!Q.pattern)return;if(X.string!==!1){let J=X.string||U.string();if(J instanceof U.ZodString){let G=new RegExp(Q.pattern);X.string=J.regex(G)}}}},Vh6=class{apply(X,Y){let Q=Y;if(Q.minimum===void 0)return;if(X.number!==!1){let J=X.number||U.number();if(J instanceof U.ZodNumber)X.number=J.min(Q.minimum)}}},qh6=class{apply(X,Y){let Q=Y;if(Q.maximum===void 0)return;if(X.number!==!1){let J=X.number||U.number();if(J instanceof U.ZodNumber)X.number=J.max(Q.maximum)}}},Uh6=class{apply(X,Y){let Q=Y;if(Q.exclusiveMinimum===void 0)return;if(X.number!==!1){let J=X.number||U.number();if(J instanceof U.ZodNumber)if(typeof Q.exclusiveMinimum==="number")X.number=J.gt(Q.exclusiveMinimum);else X.number=!1}}},zh6=class{apply(X,Y){let Q=Y;if(Q.exclusiveMaximum===void 0)return;if(X.number!==!1){let J=X.number||U.number();if(J instanceof U.ZodNumber)if(typeof Q.exclusiveMaximum==="number")X.number=J.lt(Q.exclusiveMaximum);else X.number=!1}}},Bh6=class{apply(X,Y){let Q=Y;if(Q.multipleOf===void 0)return;if(X.number!==!1){let J=X.number||U.number();if(J instanceof U.ZodNumber)X.number=J.refine((G)=>{if(Q.multipleOf===0)return!1;let W=G/Q.multipleOf,Z=Math.round(W),$=Math.min(Math.abs(G)*Number.EPSILON*10,Math.abs(Q.multipleOf)*Number.EPSILON*10);return Math.abs(W-Z)<=$/Math.abs(Q.multipleOf)},{message:`Must be a multiple of ${Q.multipleOf}`})}}},Dh6=class{apply(X,Y){let Q=Y;if(Y.type===void 0&&(Q.minItems!==void 0||Q.maxItems!==void 0||Q.items!==void 0||Q.prefixItems!==void 0)){if(X.array===void 0)X.array=U.array(U.any())}}},Nh6=class{apply(X,Y){let Q=Y;if(Q.minItems===void 0)return;if(X.array!==!1)X.array=(X.array||U.array(U.any())).min(Q.minItems)}},Oh6=class{apply(X,Y){let Q=Y;if(Q.maxItems===void 0)return;if(X.array!==!1)X.array=(X.array||U.array(U.any())).max(Q.maxItems)}},Lh6=class{apply(X,Y){let Q=Y;if(X.array===!1)return;if(Array.isArray(Q.items))X.array=X.array||U.array(U.any());else if(Q.items&&typeof Q.items!=="boolean"&&!Q.prefixItems){let J=yY(Q.items),G=U.array(J);if(X.array&&X.array instanceof U.ZodArray){let W=X.array._def;if(W.checks)W.checks.forEach((Z)=>{if(Z._zod&&Z._zod.def){let $=Z._zod.def;if($.check==="min_length"&&$.minimum!==void 0)G=G.min($.minimum);else if($.check==="max_length"&&$.maximum!==void 0)G=G.max($.maximum)}})}X.array=G}else if(typeof Q.items==="boolean"&&Q.items===!1)if(!Q.prefixItems)X.array=U.array(U.any()).max(0);else X.array=X.array||U.array(U.any());else if(typeof Q.items==="boolean"&&Q.items===!0)X.array=X.array||U.array(U.any());else if(Q.prefixItems)X.array=X.array||U.array(U.any())}},wh6=class{apply(X,Y){if(Y.type!=="array")return;let Q=Y;if(!Array.isArray(Q.items))return;if(X.array===!1)return;let J=Q.items.map((W)=>yY(W)),G;if(J.length===0)G=U.tuple([]);else G=U.tuple(J);if(Q.minItems!==void 0&&Q.minItems>J.length)G=!1;if(Q.maxItems!==void 0&&Q.maxItems<J.length)G=!1;X.tuple=G,X.array=!1}},Mh6=class{apply(X,Y){let Q=Y;if(X.object===!1)return;if(Q.properties||Q.required||Q.additionalProperties!==void 0)X.object=X.object||U.object({}).passthrough()}},Ph6=class{apply(X,Y){let Q=Y;if(Y.type===void 0&&(Q.maxProperties!==void 0||Q.minProperties!==void 0)){if(X.object===void 0)X.object=U.object({}).passthrough()}}},Th6=class{apply(X,Y){let Q=Y;if(Q.maxProperties===void 0)return;if(X.object!==!1){let J=X.object||U.object({}).passthrough();X.object=J.refine((G)=>Object.keys(G).length<=Q.maxProperties,{message:`Object must have at most ${Q.maxProperties} properties`})}}},Ah6=class{apply(X,Y){let Q=Y;if(Q.minProperties===void 0)return;if(X.object!==!1){let J=X.object||U.object({}).passthrough();X.object=J.refine((G)=>Object.keys(G).length>=Q.minProperties,{message:`Object must have at least ${Q.minProperties} properties`})}}},jh6=class{apply(X,Y){if(!Y.not)return X;let Q=yY(Y.not);return X.refine((J)=>!Xf(Q,J),{message:"Value must not match the 'not' schema"})}},Ch6=class{apply(X,Y){if(Y.uniqueItems!==!0)return X;return X.refine(Eh6(),{message:"Array items must be unique"})}},Ih6=class{apply(X,Y){if(!Y.allOf||Y.allOf.length===0)return X;return Y.allOf.map((J)=>yY(J)).reduce((J,G)=>U.intersection(J,G),X)}},Rh6=class{apply(X,Y){if(!Y.anyOf||Y.anyOf.length===0)return X;let Q=Y.anyOf.length===1?yY(Y.anyOf[0]):U.union([yY(Y.anyOf[0]),yY(Y.anyOf[1]),...Y.anyOf.slice(2).map((J)=>yY(J))]);return U.intersection(X,Q)}},Sh6=class{apply(X,Y){if(!Y.oneOf||Y.oneOf.length===0)return X;let Q=Y.oneOf.map((J)=>yY(J));return X.refine((J)=>{let G=0;for(let W of Q)if(W.safeParse(J).success){if(G++,G>1)return!1}return G===1},{message:"Value must match exactly one of the oneOf schemas"})}},kh6=class{apply(X,Y){let Q=Y;if(Q.prefixItems&&Array.isArray(Q.prefixItems)){let G=Q.prefixItems.map((W)=>yY(W));return X.refine((W)=>{if(!Array.isArray(W))return!0;for(let Z=0;Z<Math.min(W.length,G.length);Z++)if(!Xf(G[Z],W[Z]))return!1;if(W.length>G.length){if(typeof Q.items==="boolean"&&Q.items===!1)return!1;else if(Q.items&&typeof Q.items==="object"&&!Array.isArray(Q.items)){let Z=yY(Q.items);for(let $=G.length;$<W.length;$++)if(!Xf(Z,W[$]))return!1}}return!0},{message:"Array does not match prefixItems schema"})}return X}},vh6=class{apply(X,Y){let Q=Y;if(!Q.properties&&!Q.required&&Q.additionalProperties!==!1)return X;if(X instanceof U.ZodObject||X instanceof U.ZodRecord){let J={};if(Q.properties){for(let[G,W]of Object.entries(Q.properties))if(W!==void 0)J[G]=yY(W)}if(Q.required&&Array.isArray(Q.required)){let G=new Set(Q.required);for(let W of Object.keys(J))if(!G.has(W))J[W]=J[W].optional()}else for(let G of Object.keys(J))J[G]=J[G].optional();if(Q.additionalProperties===!1)return U.object(J);else return U.object(J).passthrough()}return X.refine((J)=>{if(typeof J!=="object"||J===null||Array.isArray(J))return!0;if(Q.properties){for(let[G,W]of Object.entries(Q.properties))if(W!==void 0){if(Object.getOwnPropertyDescriptor(J,G)!==void 0){if(!yY(W).safeParse(J[G]).success)return!1}}}if(Q.required&&Array.isArray(Q.required)){for(let G of Q.required)if(Object.getOwnPropertyDescriptor(J,G)===void 0)return!1}if(Q.additionalProperties===!1&&Q.properties){let G=new Set(Object.keys(Q.properties));for(let W in J)if(!G.has(W))return!1}return!0},{message:"Object constraints validation failed"})}},_h6=class{apply(X,Y){if(!Y.enum||Y.enum.length===0)return X;let Q=Y.enum.filter((J)=>Array.isArray(J)||typeof J==="object"&&J!==null);if(Q.length===0)return X;return X.refine((J)=>{if(typeof J!=="object"||J===null)return!0;return Q.some((G)=>WT(J,G))},{message:"Value must match one of the enum values"})}},yh6=class{apply(X,Y){if(Y.const===void 0)return X;let Q=Y.const;if(typeof Q!=="object"||Q===null)return X;return X.refine((J)=>WT(J,Q),{message:"Value must equal the const value"})}},bh6=class{apply(X,Y){if(Y.description)X=X.describe(Y.description);return X}},fh6=class{apply(X,Y){var Q;let J=Y;if(!((Q=J.required)==null?void 0:Q.includes("__proto__"))||Y.type!==void 0)return X;return U.any().refine((G)=>this.validateRequired(G,J.required),{message:"Missing required properties"})}validateRequired(X,Y){if(typeof X!=="object"||X===null||Array.isArray(X))return!0;return Y.every((Q)=>Object.prototype.hasOwnProperty.call(X,Q))}},hh6=class{apply(X,Y){var Q;let J=Y;if(J.contains===void 0)return X;let G=yY(J.contains),W=(Q=J.minContains)!=null?Q:1,Z=J.maxContains;return X.refine(($)=>{if(!Array.isArray($))return!0;let K=0;for(let H of $)if(Xf(G,H))K++;if(K<W)return!1;if(Z!==void 0&&K>Z)return!1;return!0},{message:"Array must contain required items matching the schema"})}},xh6=class{apply(X,Y){let{default:Q}=Y;if(Q===void 0)return X;if(!X.safeParse(Q).success)return X;return X.default(Q)}},gh6,uh6;var cG1=k(()=>{r6();r6();r6();r6();r6();r6();r6();r6();r6();r6();r6();r6();r6();r6();gh6=[new Gh6,new Wh6,new Jh6,new Zh6,new $h6,new Dh6,new Ph6,new Kh6,new Hh6,new Fh6,new Vh6,new qh6,new Uh6,new zh6,new Bh6,new wh6,new Nh6,new Oh6,new Lh6,new Th6,new Ah6,new Mh6],uh6=[new fh6,new _h6,new yh6,new Ih6,new Rh6,new Sh6,new kh6,new vh6,new hh6,new jh6,new Ch6,new xh6,new bh6]});class VY0{constructor(X){this._url=X}start(){if(this._socket)throw Error("WebSocketClientTransport already started! If using Client class, note that connect() calls start() automatically.");return new Promise((X,Y)=>{this._socket=new WebSocket(this._url,mh6),this._socket.onerror=(Q)=>{let J="error"in Q?Q.error:Error(`WebSocket error: ${JSON.stringify(Q)}`);Y(J),this.onerror?.(J)},this._socket.onopen=()=>{X()},this._socket.onclose=()=>{this.onclose?.()},this._socket.onmessage=(Q)=>{let J;try{J=GJ.parse(JSON.parse(Q.data))}catch(G){this.onerror?.(G);return}this.onmessage?.(J)}})}async close(){this._socket?.close()}send(X){return new Promise((Y,Q)=>{if(!this._socket){Q(Error("Not connected"));return}this._socket?.send(JSON.stringify(X)),Y()})}}var mh6="mcp";var nG1=k(()=>{IX()});function lh6(X){let Y=X;if(!Y||typeof Y!=="object"||!("method"in Y))return null;switch(Y.method){case"initialize":{let Q=Y?.params?.protocolVersion;if(!Q)return null;return{type:"emit",message:{result:{protocolVersion:Q,capabilities:{tools:{}},serverInfo:{name:"deco-chat-server",version:"1.0.0"}},jsonrpc:Y.jsonrpc??"2.0",id:Y.id}}}case"notifications/roots/list_changed":case"notifications/initialized":case"notifications/cancelled":case"notifications/progress":return{type:"suppress"};default:return null}}var qY0;var iG1=k(()=>{tP();qY0=class qY0 extends NZ{constructor(X,Y){super(X,Y)}send(X,Y){let Q=lh6(X);if(Q?.type==="emit")return this.onmessage?.(Q.message),Promise.resolve();if(Q?.type==="suppress")return Promise.resolve();return super.send(X,Y)}}});var aG1,rG1=async(X,Y,Q)=>{let J=dh6(X.connection,Y,Q);if(!J)throw Error("Unknown MCP connection type");let G=new aG1({name:X?.name??"MCP Client",version:"1.0.0"});return await G.connect(J),{client:G,callStreamableTool:(W,Z)=>{if(X.connection.type!=="HTTP")throw Error("HTTP connection required");let $=new Headers(Q);if(!$.has("Authorization"))$.set("Authorization",`Bearer ${X.connection.token}`);for(let[F,V]of Object.entries(X.connection.headers??{}))$.set(F,V);let K=new URL(X.connection.url),H=K.pathname.replace(/\/+$/,"")||"/";return K.pathname=`${H}/call-tool/${encodeURIComponent(W)}`,fetch(K.href,{method:"POST",redirect:"manual",body:JSON.stringify(Z),headers:$})}}},dh6=(X,Y,Q)=>{if(X.type==="Websocket")return new VY0(new URL(X.url));if(X.type!=="SSE"&&X.type!=="HTTP")return null;let G={...X.token?{authorization:`Bearer ${X.token}`}:{},...Q??{},..."headers"in X?X.headers||{}:{}};if(X.type==="SSE"){let W={requestInit:{headers:G,signal:Y}};if(X.token)W.eventSourceInit={fetch:(Z,$)=>{return fetch(Z,{...$,headers:{...G,Accept:"text/event-stream"},signal:Y})}};return new vF(new URL(X.url),W)}return new qY0(new URL(X.url),{requestInit:{headers:G,signal:Y,credentials:"include"}})};var oG1=k(()=>{ZB();ub();nG1();IX();iG1();aG1=class aG1 extends wQ{constructor(X,Y){super(X,Y)}async listTools(X,Y){return await this.request({method:"tools/list",params:X},NP,Y)}}});function tG1(X){let Y=(Q)=>{if("connection"in X)return rG1({connection:X.connection},void 0,Q);return X.client};return new Proxy({},{get(Q,J){if(J==="toJSON")return null;if(typeof J!=="string")throw Error("Name must be a string");if(J==="listTools")return $;async function G(K,H=J){let F=X?.debugId?.(),V=F?{"x-trace-debug-id":F}:void 0,{client:q,callStreamableTool:z}=await Y(V);if(X?.streamable?.[String(H)])return z(String(H),K);let{structuredContent:D,isError:N,content:L}=await q.callTool({name:String(H),arguments:K});if(N){let w=L?.[0]?.text,C=typeof w==="string"?ph6(w):null,A=C?.code&&typeof X?.getErrorByStatusCode==="function"?X.getErrorByStatusCode(C.code,C.message,C.traceId):null;if(A)throw A;throw Error(`Tool ${String(H)} returned an error: ${JSON.stringify(D??L)}`)}return D}async function W(){let{client:K}=await Y(),{tools:H}=await K.listTools();return H}async function Z(){if(!("connection"in X))return W();let K=X.connection,H=JSON.stringify(K);try{if(!Yf.has(H))Yf.set(H,W());return await Yf.get(H)}catch(F){console.error("Failed to list tools",F),Yf.delete(H);return}}async function $(){return(await Z()??[]).map((H)=>sG1(H,G))}return G.asTool=async()=>{let H=(await Z()??[]).find((F)=>F.name===J);if(!H)throw Error(`Tool ${J} not found`);return sG1(H,G)},G}})}var ph6=(X)=>{try{return JSON.parse(X)}catch{return X}},Yf,sG1=(X,Y)=>{return{...X,id:X.name,inputSchema:X.inputSchema?yY(X.inputSchema):void 0,outputSchema:X.outputSchema?yY(X.outputSchema):void 0,execute:(Q)=>{return Y(Q.context,X.name)}}};var eG1=k(()=>{cG1();oG1();Yf=new Map});function Qf(X){return tG1(X)}var id4;var X71=k(()=>{eG1();id4=new Proxy({},{get(X,Y){if(Y==="toJSON")return null;if(Y==="forConnection")return(Q)=>Qf({connection:Q});return global[Y]}})});function Jf(X){return{isImplementedBy:(Y)=>{for(let Q of X){let J=typeof Q.name==="string"?new RegExp(`^${Q.name}$`):Q.name,G=Y.find((W)=>J.test(W.name));if(!G&&Q.opt)continue;if(!G)return!1}return!0}}}var gF=(X)=>{return{...Jf(X),forClient:(Y)=>{return Qf({client:Y,streamable:X.reduce((Q,J)=>{return Q[J.name]=J.streamable===!0,Q},{})})},forConnection:(Y)=>{return Qf({connection:Y,streamable:X.reduce((Q,J)=>{return Q[J.name]=J.streamable===!0,Q},{})})}}};var ZT=k(()=>{X71()});function $T(X,Y,Q){this.props=X,this.context=Y,this.refs=Q71,this.updater=Q||Y71}function J71(){}function G71(X,Y,Q){this.props=X,this.context=Y,this.refs=Q71,this.updater=Q||Y71}var ch6,nh6,Y71,ih6,Q71,UY0,zY0=function(X){return X={$$typeof:nh6,_currentValue:X,_currentValue2:X,_threadCount:0,Provider:null,Consumer:null},X.Provider=X,X.Consumer={$$typeof:ch6,_context:X},X};var W71=k(()=>{ch6=Symbol.for("react.consumer"),nh6=Symbol.for("react.context"),Y71={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},ih6=Object.assign,Q71={};$T.prototype.isReactComponent={};$T.prototype.setState=function(X,Y){if(typeof X!=="object"&&typeof X!=="function"&&X!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,X,Y,"setState")};$T.prototype.forceUpdate=function(X){this.updater.enqueueForceUpdate(this,X,"forceUpdate")};J71.prototype=$T.prototype;UY0=G71.prototype=new J71;UY0.constructor=G71;ih6(UY0,$T.prototype);UY0.isPureReactComponent=!0});var BY0=()=>{};var Jp4;var Z71=k(()=>{W71();BY0();Jp4=zY0(null)});function mF(X){return U.object({items:U.array(X).describe("Array of collection items"),totalCount:U.number().int().min(0).optional().describe("Total number of matching items (if available)"),hasMore:U.boolean().optional().describe("Whether there are more items available")})}function HT(X){return U.object({item:X.nullable().describe("The retrieved item, or null if not found")})}function oh6(X){return U.object({data:X.partial().describe("Data for the new entity (id may be auto-generated)")})}function sh6(X){return U.object({item:X.describe("The created entity with generated id")})}function th6(X){return U.object({id:U.string().describe("ID of the entity to update"),data:X.partial().describe("Partial entity data to update")})}function eh6(X){return U.object({item:X.describe("The updated entity")})}function VT(X){return U.object({item:X.describe("The deleted entity")})}function SB(X,Y,Q){let J=X.toUpperCase(),G=Q?.readOnly??!1,W=[{name:`COLLECTION_${J}_LIST`,inputSchema:uF,outputSchema:mF(Y)},{name:`COLLECTION_${J}_GET`,inputSchema:KT,outputSchema:HT(Y)}];if(!G)W.push({name:`COLLECTION_${J}_CREATE`,inputSchema:oh6(Y),outputSchema:sh6(Y),opt:!0},{name:`COLLECTION_${J}_UPDATE`,inputSchema:th6(Y),outputSchema:eh6(Y),opt:!0},{name:`COLLECTION_${J}_DELETE`,inputSchema:FT,outputSchema:VT(Y),opt:!0});return W}var RB,ah6,$71,rh6,uF,KT,FT;var QG=k(()=>{t0();RB=U.object({id:U.string().describe("Unique identifier for the entity"),title:U.string().describe("Human-readable title for the entity"),description:U.string().nullish().describe("Description of the entity"),created_at:U.string().datetime(),updated_at:U.string().datetime(),created_by:U.string().optional(),updated_by:U.string().optional()}),ah6=U.object({field:U.array(U.string()),operator:U.enum(["eq","gt","gte","lt","lte","in","like","contains"]),value:U.unknown()}),$71=U.lazy(()=>U.union([ah6,U.object({operator:U.enum(["and","or","not"]),conditions:U.array($71)})])),rh6=U.object({field:U.array(U.string()),direction:U.enum(["asc","desc"]),nulls:U.enum(["first","last"]).optional()}),uF=U.object({where:$71.optional().describe("Filter expression"),orderBy:U.array(rh6).optional().describe("Sort expressions"),limit:U.number().int().min(1).max(1000).optional().describe("Maximum number of items to return"),offset:U.number().int().min(0).optional().describe("Number of items to skip")});KT=U.object({id:U.string().describe("ID of the entity to retrieve")});FT=U.object({id:U.string().describe("ID of the entity to delete")})});var Xx6,K71,Fp4;var H71=k(()=>{t0();QG();Xx6=U.object({id:U.string(),name:U.string(),description:U.string().optional(),inputSchema:U.record(U.string(),U.unknown()),outputSchema:U.record(U.string(),U.unknown()).optional()}),K71=RB.extend({_meta:U.object({"io.decocms":U.object({id:U.string(),verified:U.boolean(),scopeName:U.string(),appName:U.string(),friendlyName:U.string().nullable().optional(),metadata:U.record(U.string(),U.unknown()).nullable().optional(),publishedAt:U.string().datetime().optional(),updatedAt:U.string().datetime().optional(),tools:U.array(Xx6).nullable().optional().describe("Available tools exposed by this app")}).optional()}).optional(),server:U.object({$schema:U.string().optional(),_meta:U.record(U.string(),U.unknown()).optional(),name:U.string().describe("The server name (scope/app)"),title:U.string().optional().describe("User-friendly title"),description:U.string().optional().describe("Server description"),icons:U.array(U.object({src:U.string(),mimeType:U.string().optional(),sizes:U.array(U.string()).optional(),theme:U.enum(["light","dark"]).optional()})).optional(),remotes:U.array(U.object({type:U.enum(["http","stdio","sse"]),url:U.string().optional(),headers:U.array(U.unknown()).optional()})).optional(),packages:U.array(U.unknown()).optional(),repository:U.object({url:U.string(),source:U.string().optional(),subfolder:U.string().optional()}).optional(),version:U.string().optional(),websiteUrl:U.string().optional()})}),Fp4=SB("registry_app",K71,{readOnly:!0})});var F71,V71,q71,U71,z71,DY0;var B71=k(()=>{t0();ZT();F71=U.object({specversion:U.literal("1.0").describe("CloudEvents specification version"),id:U.string().describe("Unique identifier for this event (UUID recommended)"),source:U.string().describe("Connection ID of the event publisher"),type:U.string().describe("Event type (e.g., 'order.created', 'user.signup')"),time:U.string().datetime().optional().describe("Timestamp of when the event occurred (ISO 8601)"),subject:U.string().optional().describe("Subject/resource identifier (e.g., order ID, user ID)"),datacontenttype:U.string().optional().default("application/json").describe("Content type of the data attribute"),dataschema:U.string().url().optional().describe("URI to the schema for the data attribute"),data:U.unknown().optional().describe("Event payload (any JSON value)")}),V71=U.object({events:U.array(F71).min(1).describe("Batch of CloudEvents to process")}),q71=U.object({success:U.boolean().optional().describe("Whether this event was processed successfully"),error:U.string().optional().describe("Error message for this event"),retryAfter:U.number().int().positive().optional().describe("Re-deliver this event after this many ms")}),U71=U.object({success:U.boolean().optional().describe("Batch success - applies to events not in results"),error:U.string().optional().describe("Batch error message - applies to events not in results"),processedCount:U.number().int().min(0).optional().describe("Number of events successfully processed"),retryAfter:U.number().int().positive().optional().describe("Batch retryAfter - applies to events not in results"),results:U.record(U.string(),q71).optional().describe("Per-event results keyed by event ID")}),z71=[{name:"ON_EVENTS",inputSchema:V71,outputSchema:U71}],DY0=gF(z71)});var qT,UT,zT,BT,D71,N71,DT,NT,OT,LT,wT,MT,PT,TT,O71,Yx6;var L71=k(()=>{t0();ZT();qT=U.object({type:U.string().min(1).max(255).describe("Event type identifier"),subject:U.string().max(255).optional().describe("Subject/resource identifier (e.g., order ID)"),data:U.unknown().optional().describe("Event payload"),deliverAt:U.string().datetime().optional().describe("Scheduled delivery time (ISO 8601). Omit for immediate delivery."),cron:U.string().max(100).optional().describe("Cron expression for recurring delivery. Use EVENT_CANCEL to stop.")}),UT=U.object({id:U.string().describe("Unique event ID"),type:U.string().describe("Event type"),source:U.string().describe("Source connection ID"),time:U.string().describe("Event timestamp")}),zT=U.object({eventType:U.string().min(1).max(255).describe("Event type to subscribe to"),publisher:U.string().optional().describe("Filter events by publisher connection ID"),filter:U.string().max(1000).optional().describe("JSONPath filter expression on event data")}),BT=U.object({subscription:U.object({id:U.string().describe("Subscription ID"),connectionId:U.string().describe("Subscriber connection ID"),eventType:U.string().describe("Event type pattern"),publisher:U.string().nullable().describe("Publisher connection filter"),filter:U.string().nullable().describe("JSONPath filter expression"),enabled:U.boolean().describe("Whether subscription is enabled"),createdAt:U.string().datetime().describe("Created timestamp (ISO 8601)"),updatedAt:U.string().datetime().describe("Updated timestamp (ISO 8601)")})}),D71=U.object({eventType:U.string().min(1).max(255).describe("Event type to subscribe to"),publisher:U.string().optional().describe("Filter events by publisher connection ID"),filter:U.string().max(1000).optional().describe("JSONPath filter expression on event data")}),N71=U.object({id:U.string().describe("Subscription ID"),connectionId:U.string().describe("Subscriber connection ID"),eventType:U.string().describe("Event type pattern"),publisher:U.string().nullable().describe("Publisher connection filter"),filter:U.string().nullable().describe("JSONPath filter expression"),enabled:U.boolean().describe("Whether subscription is enabled"),createdAt:U.string().datetime().describe("Created timestamp (ISO 8601)"),updatedAt:U.string().datetime().describe("Updated timestamp (ISO 8601)")}),DT=U.object({subscriptions:U.array(D71).describe("Desired subscriptions - system will create/update/delete to match")}),NT=U.object({created:U.number().int().min(0).describe("Number of subscriptions created"),updated:U.number().int().min(0).describe("Number of subscriptions with filter updated"),deleted:U.number().int().min(0).describe("Number of subscriptions removed"),unchanged:U.number().int().min(0).describe("Number of subscriptions unchanged"),subscriptions:U.array(N71).describe("Current subscriptions after sync")}),OT=U.object({subscriptionId:U.string().describe("Subscription ID to remove")}),LT=U.object({success:U.boolean().describe("Whether unsubscribe was successful"),subscriptionId:U.string().describe("Subscription ID that was removed")}),wT=U.object({eventId:U.string().describe("Event ID to cancel")}),MT=U.object({success:U.boolean().describe("Whether cancellation was successful"),eventId:U.string().describe("Event ID that was cancelled")}),PT=U.object({eventId:U.string().describe("Event ID to acknowledge")}),TT=U.object({success:U.boolean().describe("Whether ACK was successful"),eventId:U.string().describe("Event ID that was acknowledged")}),O71=[{name:"EVENT_PUBLISH",inputSchema:qT,outputSchema:UT},{name:"EVENT_SUBSCRIBE",inputSchema:zT,outputSchema:BT},{name:"EVENT_UNSUBSCRIBE",inputSchema:OT,outputSchema:LT},{name:"EVENT_CANCEL",inputSchema:wT,outputSchema:MT},{name:"EVENT_ACK",inputSchema:PT,outputSchema:TT},{name:"EVENT_SYNC_SUBSCRIPTIONS",inputSchema:DT,outputSchema:NT}],Yx6=gF(O71)});var Lp4,wp4,Mp4,Pp4,Tp4,Ap4,Ep4,jp4,Cp4,Ip4,Rp4,Sp4;var w71=k(()=>{t0();Lp4=U.object({prefix:U.string().optional().describe("Filter objects by prefix (e.g., 'folder/' for folder contents)"),maxKeys:U.number().optional().default(1000).describe("Maximum number of keys to return (default: 1000)"),continuationToken:U.string().optional().describe("Token for pagination from previous response"),delimiter:U.string().optional().describe("Delimiter for grouping keys (typically '/'). When set, commonPrefixes returns folder paths.")}),wp4=U.object({objects:U.array(U.object({key:U.string().describe("Object key/path"),size:U.number().describe("Object size in bytes"),lastModified:U.string().describe("Last modified timestamp"),etag:U.string().describe("Entity tag for the object")})),nextContinuationToken:U.string().optional().describe("Token for fetching next page of results"),isTruncated:U.boolean().describe("Whether there are more results available"),commonPrefixes:U.array(U.string()).optional().describe("Folder paths when delimiter is used (e.g., ['photos/2024/', 'photos/2025/'])")}),Mp4=U.object({key:U.string().describe("Object key/path to get metadata for")}),Pp4=U.object({contentType:U.string().optional().describe("MIME type of the object"),contentLength:U.number().describe("Size of the object in bytes"),lastModified:U.string().describe("Last modified timestamp"),etag:U.string().describe("Entity tag for the object"),metadata:U.record(U.string(),U.string()).optional().describe("Custom metadata key-value pairs")}),Tp4=U.object({key:U.string().describe("Object key/path to generate URL for"),expiresIn:U.number().optional().describe("URL expiration time in seconds (default: from state config or 3600)")}),Ap4=U.object({url:U.string().describe("Presigned URL for downloading the object"),expiresIn:U.number().describe("Expiration time in seconds that was used")}),Ep4=U.object({key:U.string().describe("Object key/path for the upload"),expiresIn:U.number().optional().describe("URL expiration time in seconds (default: from state config or 3600)"),contentType:U.string().optional().describe("MIME type for the object being uploaded")}),jp4=U.object({url:U.string().describe("Presigned URL for uploading the object"),expiresIn:U.number().describe("Expiration time in seconds that was used")}),Cp4=U.object({key:U.string().describe("Object key/path to delete")}),Ip4=U.object({success:U.boolean().describe("Whether the deletion was successful"),key:U.string().describe("The key that was deleted")}),Rp4=U.object({keys:U.array(U.string()).max(1000).describe("Array of object keys/paths to delete (max 1000)")}),Sp4=U.object({deleted:U.array(U.string()).describe("Array of successfully deleted keys"),errors:U.array(U.object({key:U.string(),message:U.string()})).describe("Array of errors for failed deletions")})});var Gf=k(()=>{ZT();Z71();H71();B71();L71();w71()});var Qx6,Jx6,M71;var P71=k(()=>{t0();QG();Qx6=RB.extend({avatar:U.string().describe("URL or data URI to the assistant's avatar image"),system_prompt:U.string().describe("System prompt that defines the assistant's behavior"),virtual_mcp_id:U.string().describe("Virtual MCP ID to use for this assistant"),model:U.object({id:U.string().describe("Model ID"),connectionId:U.string().describe("Connection ID that provides the model")}).describe("Selected model reference for this assistant")}),Jx6=SB("assistant",Qx6),M71=[...Jx6]});var AT,LZ,A71,Gx6,Wx6,E71,Zx6,$x6,Kx6,Hx6,Fx6,Vx6,j71,qx6,Ux6,zx6,Bx6,Dx6,Nx6,Ox6,Lx6,wx6,Mx6,op4,Px6,sp4,T71,Tx6,Ax6,NY0,Wf;var Zf=k(()=>{t0();ZT();QG();AT=U.lazy(()=>U.union([U.null(),U.string(),U.number(),U.boolean(),U.record(U.string(),AT),U.array(AT)])),LZ=U.record(U.string(),U.record(U.string(),AT)).optional().describe("Additional provider-specific options. Outer record keyed by provider name, inner by option key"),A71=U.object({type:U.literal("text"),text:U.string().describe("The text content"),providerOptions:LZ}),Gx6=U.object({type:U.literal("text"),text:U.string().describe("The text content"),providerMetadata:U.any().optional().describe("Additional provider-specific metadata")}),Wx6=U.string().describe("File data as URL string"),E71=U.object({type:U.literal("file"),filename:U.string().optional().describe("Optional filename of the file"),data:Wx6,mediaType:U.string().describe("IANA media type of the file (e.g., image/png, audio/mp3)"),providerOptions:LZ}),Zx6=U.object({type:U.literal("file"),mediaType:U.string().describe("IANA media type of the file (e.g., image/png, audio/mp3)"),data:U.string().describe("Generated file data as base64 encoded string")}),$x6=U.object({type:U.literal("reasoning"),text:U.string().describe("The reasoning text"),providerOptions:LZ}),Kx6=U.object({type:U.literal("reasoning"),text:U.string().describe("The reasoning text"),providerMetadata:U.any().optional().describe("Additional provider-specific metadata")}),Hx6=U.object({type:U.literal("tool-call"),toolCallId:U.string().describe("ID of the tool call, used to match with tool result"),toolName:U.string().describe("Name of the tool being called"),input:U.string().describe("Arguments of the tool call (JSON-serializable object matching tool input schema)"),providerExecuted:U.boolean().optional().describe("Whether the tool call will be executed by the provider"),providerOptions:LZ}),Fx6=U.object({type:U.literal("tool-call"),toolCallId:U.string().describe("ID of the tool call"),toolName:U.string().describe("Name of the tool being called"),input:U.string().describe("Stringified JSON object with the tool call arguments"),providerExecuted:U.boolean().optional().describe("Whether the tool call will be executed by the provider"),providerMetadata:U.any().optional().describe("Additional provider-specific metadata")}),Vx6=U.union([U.object({type:U.literal("text"),value:U.string()}),U.object({type:U.literal("json"),value:AT}),U.object({type:U.literal("error-text"),value:U.string()}),U.object({type:U.literal("error-json"),value:AT}),U.object({type:U.literal("content"),value:U.array(U.union([U.object({type:U.literal("text"),text:U.string().describe("Text content")}),U.object({type:U.literal("media"),data:U.string().describe("Base-64 encoded media data"),mediaType:U.string().describe("IANA media type")})]))})]),j71=U.object({type:U.literal("tool-result"),toolCallId:U.string().describe("ID of the tool call that this result is associated with"),toolName:U.string().describe("Name of the tool that generated this result"),output:Vx6.describe("Result of the tool call"),result:U.unknown().describe("Unknown result of the tool call"),providerOptions:LZ}),qx6=U.object({type:U.literal("tool-result"),toolCallId:U.string().describe("ID of the tool call that this result is associated with"),toolName:U.string().describe("Name of the tool that generated this result"),result:U.any().describe("Result of the tool call (JSON-serializable)"),isError:U.boolean().optional().describe("Whether the result is an error or error message"),providerExecuted:U.boolean().optional().describe("Whether the tool result was generated by the provider"),providerMetadata:U.any().optional().describe("Additional provider-specific metadata")}),Ux6=U.union([U.object({type:U.literal("source"),sourceType:U.literal("url"),id:U.string().describe("The ID of the source"),url:U.string().describe("The URL of the source"),title:U.string().optional().describe("The title of the source"),providerMetadata:U.any().optional().describe("Additional provider-specific metadata")}),U.object({type:U.literal("source"),sourceType:U.literal("document"),id:U.string().describe("The ID of the source"),mediaType:U.string().describe("IANA media type of the document (e.g., application/pdf)"),title:U.string().describe("The title of the document"),filename:U.string().optional().describe("Optional filename of the document"),providerMetadata:U.any().optional().describe("Additional provider-specific metadata")})]),zx6=U.object({role:U.literal("system"),content:U.string().describe("System message content"),providerOptions:LZ}),Bx6=U.object({role:U.literal("user"),content:U.array(U.union([A71,E71])).describe("User message content parts (text or file)"),providerOptions:LZ}),Dx6=U.object({role:U.literal("assistant"),content:U.array(U.union([A71,E71,$x6,Hx6,j71])).describe("Assistant message content parts (text, file, reasoning, tool-call, or tool-result)"),providerOptions:LZ}),Nx6=U.object({role:U.literal("tool"),content:U.array(j71).describe("Tool message content (tool results)"),providerOptions:LZ}),Ox6=U.union([zx6,Bx6,Dx6,Nx6]),Lx6=U.array(Ox6).describe("A list of messages forming the prompt"),wx6=U.object({prompt:Lx6.describe("A language model prompt is a standardized prompt type (array of messages with roles: system, user, assistant, tool)"),maxOutputTokens:U.number().optional().describe("Maximum number of tokens to generate"),temperature:U.number().optional().describe("Temperature setting. The range depends on the provider and model"),topP:U.number().optional().describe("Nucleus sampling parameter"),topK:U.number().optional().describe("Only sample from the top K options for each subsequent token. Used to remove long tail low probability responses"),presencePenalty:U.number().optional().describe("Presence penalty setting. It affects the likelihood of the model to repeat information that is already in the prompt"),frequencyPenalty:U.number().optional().describe("Frequency penalty setting. It affects the likelihood of the model to repeatedly use the same words or phrases"),seed:U.number().optional().describe("The seed (integer) to use for random sampling. If set and supported by the model, calls will generate deterministic results"),stopSequences:U.array(U.string()).optional().describe("Stop sequences. If set, the model will stop generating text when one of the stop sequences is generated"),responseFormat:U.union([U.object({type:U.literal("text")}),U.object({type:U.literal("json"),schema:U.any().optional().describe("JSON schema that the generated output should conform to"),name:U.string().optional().describe("Name of output that should be generated"),description:U.string().optional().describe("Description of the output that should be generated")})]).optional().describe("Response format. The output can either be text or JSON. Default is text"),tools:U.array(U.any()).optional().describe("The tools that are available for the model"),toolChoice:U.any().optional().describe("Specifies how the tool should be selected. Defaults to 'auto'"),includeRawChunks:U.boolean().optional().describe("Include raw chunks in the stream. Only applicable for streaming calls"),abortSignal:U.any().optional().describe("Abort signal for cancelling the operation"),providerOptions:U.any().optional().describe("Additional provider-specific options")}),Mx6=U.object({content:U.array(U.union([Gx6,Zx6,Kx6,Fx6,qx6,Ux6])).describe("Ordered content that the model has generated (text, tool-calls, reasoning, files, sources)"),finishReason:U.enum(["stop","length","content-filter","tool-calls","error","other","unknown"]).describe("Reason why generation stopped"),usage:U.looseObject({inputTokens:U.number().optional(),outputTokens:U.number().optional(),totalTokens:U.number().optional(),reasoningTokens:U.number().optional()}).describe("Usage information for the language model call"),providerMetadata:U.any().optional().describe("Additional provider-specific metadata"),request:U.object({body:U.any().optional().describe("Request HTTP body sent to the provider API")}).optional().describe("Optional request information for telemetry and debugging"),response:U.object({id:U.string().optional().describe("ID for the generated response"),timestamp:U.iso.datetime().optional().describe("Timestamp for the start of the generated response"),modelId:U.string().optional().describe("The ID of the response model that was used"),headers:U.record(U.string(),U.string()).optional().describe("Response headers"),body:U.any().optional().describe("Response HTTP body")}).optional().describe("Optional response information for telemetry and debugging"),warnings:U.array(U.any()).describe("Warnings for the call, e.g. unsupported settings")}),op4=U.object({stream:U.any().describe("ReadableStream of LanguageModelV2StreamPart"),request:U.object({body:U.any().optional().describe("Request HTTP body sent to the provider API")}).optional().describe("Optional request information for telemetry and debugging"),response:U.object({headers:U.record(U.string(),U.string()).optional().describe("Response headers")}).optional().describe("Optional response data")}),Px6=U.object({supportedUrls:U.record(U.string(),U.array(U.string())).describe("Supported URL patterns by media type for the provider")}),sp4=U.object({modelId:U.string().describe("The ID of the model"),logo:U.string().nullable(),description:U.string().nullable(),capabilities:U.array(U.string()),limits:U.object({contextWindow:U.number(),maxOutputTokens:U.number()}).nullable(),costs:U.object({input:U.number(),output:U.number()}).nullable(),provider:U.enum(["openai","anthropic","google","x-ai","deepseek","openai-compatible","openrouter"]).nullable()}),T71=U.object({modelId:U.string().describe("The ID of the model"),callOptions:wx6}),Tx6=RB.extend({logo:U.string().nullable(),description:U.string().nullable(),capabilities:U.array(U.string()),limits:U.object({contextWindow:U.number(),maxOutputTokens:U.number()}).nullable(),costs:U.object({input:U.number(),output:U.number()}).nullable(),provider:U.enum(["openai","anthropic","google","xai","deepseek","openai-compatible","openrouter"]).nullable()}),Ax6=SB("llm",Tx6,{readOnly:!0}),NY0=[{name:"LLM_METADATA",inputSchema:U.object({modelId:U.string().describe("The ID of the model")}),outputSchema:Px6},{name:"LLM_DO_STREAM",inputSchema:T71,streamable:!0},{name:"LLM_DO_GENERATE",inputSchema:T71,outputSchema:Mx6},...Ax6],Wf=gF(NY0)});function jx6(X){let Y=[],Q=0;while(Q<X.length){let J=X[Q];if(J==="%")Y.push(".*");else if(J==="_")Y.push(".");else if(/[.*+?^${}()|[\]\\]/.test(J))Y.push("\\"+J);else Y.push(J);Q++}return Y.join("")}function hK(X){return typeof X==="string"||typeof X==="number"}function $f(X,Y){if("conditions"in Y){let{operator:$,conditions:K}=Y;switch($){case"and":return K.every((H)=>$f(X,H));case"or":return K.some((H)=>$f(X,H));case"not":return!K.every((H)=>$f(X,H));default:return!0}}let{field:Q,operator:J,value:G}=Y,W=Q.join("."),Z=OY0(X,W);switch(J){case"eq":return Z===G;case"gt":return hK(Z)&&hK(G)&&Z>G;case"gte":return hK(Z)&&hK(G)&&Z>=G;case"lt":return hK(Z)&&hK(G)&&Z<G;case"lte":return hK(Z)&&hK(G)&&Z<=G;case"in":return Array.isArray(G)&&G.includes(Z);case"like":if(typeof Z!=="string"||typeof G!=="string")return!1;if(G.length>100)return!1;let $=jx6(G);return new RegExp(`^${$}$`,"i").test(Z);case"contains":if(typeof Z!=="string"||typeof G!=="string")return!1;return Z.toLowerCase().includes(G.toLowerCase());default:return!0}}function OY0(X,Y){let Q=Y.split("."),J=X;for(let G of Q){if(J==null||typeof J!=="object")return;J=J[G]}return J}function Cx6(X,Y){return[...X].sort((Q,J)=>{for(let G of Y){let W=G.field.join("."),Z=OY0(Q,W),$=OY0(J,W),K=0;if(Z==null&&$==null)continue;if(Z==null)K=G.nulls==="first"?-1:1;else if($==null)K=G.nulls==="first"?1:-1;else if(typeof Z==="string"&&typeof $==="string")K=Z.localeCompare($);else if(typeof Z==="number"&&typeof $==="number")K=Z-$;else K=String(Z).localeCompare(String($));if(K!==0)return G.direction==="desc"?-K:K}return 0})}var Ex6,Ix6,Rx6,LY0;var C71=k(()=>{Gf();P71();QG();Zf();t0();$6();E7();Ex6={LLM:NY0,ASSISTANTS:M71};Ix6=uF.extend({binding:U.union([U.object({}).passthrough(),U.string()]).optional()}),Rx6=mF(Q5),LY0=e0({name:"COLLECTION_CONNECTIONS_LIST",description:"List all connections in the organization with filtering, sorting, and pagination",inputSchema:Ix6,outputSchema:Rx6,handler:async(X,Y)=>{await Y.access.check();let Q=_1(Y),J=X.binding?typeof X.binding==="string"?(()=>{let z=Ex6[X.binding.toUpperCase()];if(!z)throw Error(`Unknown binding: ${X.binding}`);return z})():X.binding:void 0,G=J?Jf(J):void 0,Z=(await Y.storage.connections.list(Q.id)).filter((z)=>z.connection_type!=="VIRTUAL"),$=G?await Promise.all(Z.map(async(z)=>{if(!z.tools||z.tools.length===0)return null;return G.isImplementedBy(z.tools.map((N)=>({name:N.name,inputSchema:N.inputSchema,outputSchema:N.outputSchema})))?z:null})).then((z)=>z.filter((D)=>D!==null)):Z;if(X.where)$=$.filter((z)=>$f(z,X.where));if(X.orderBy&&X.orderBy.length>0)$=Cx6($,X.orderBy);let K=$.length,H=X.offset??0,F=X.limit??100,V=$.slice(H,H+F),q=H+F<K;return{items:V,totalCount:K,hasMore:q}}})});var Sx6,wY0;var I71=k(()=>{QG();$6();E7();Sx6=HT(Q5),wY0=e0({name:"COLLECTION_CONNECTIONS_GET",description:"Get connection details by ID",inputSchema:KT,outputSchema:Sx6,handler:async(X,Y)=>{let Q=_1(Y);await Y.access.check();let J=await Y.storage.connections.findById(X.id);if(!J||J.organization_id!==Q.id)return{item:null};return{item:J}}})});var Kf=(X,Y)=>{if(Y===null||Y===void 0)return;let Q=X.replace(/\[(\w+)\]/g,".$1").split(".").filter(Boolean),J=Y;for(let G of Q){if(J===null||J===void 0||typeof J!=="object")return;J=J[G]}return J};function R71(X){let Y=X.split("::");if(Y.length!==2||!Y[0]||!Y[1])throw Error(`Invalid scope format: ${X}. Expected format: "KEY::SCOPE"`);return Y}function kx6(X){let Y=X.split("::");if(Y.length!==2||!Y[0]||!Y[1])return null;return Y}function vx6(X){if(typeof X==="object"&&X!==null&&"value"in X){let Y=X.value;if(typeof Y==="string")return Y}return null}function MY0(X,Y){let Q={};if(!X||!Y)return Q;for(let J of Y){if(J==="*"){Q["*"]=["*"];continue}let G=kx6(J);if(!G)continue;let[W,Z]=G,$=Kf(W,X),K=vx6($);if(K){if(!Q[K])Q[K]=[];Q[K].push(Z)}}return Q}function S71(X,Y){let Q=MY0(X,Y);return new Set(Object.keys(Q).filter((J)=>J!=="*"))}var PY0=()=>{};class wZ{db;vault;constructor(X,Y){this.db=X;this.vault=Y}async get(X){let Y=await this.db.selectFrom("downstream_tokens").selectAll().where("connectionId","=",X).executeTakeFirst();if(!Y)return null;return this.decryptToken(Y)}async upsert(X){let Y=new Date().toISOString(),Q=await this.vault.encrypt(X.accessToken),J=X.refreshToken?await this.vault.encrypt(X.refreshToken):null,G=X.clientSecret?await this.vault.encrypt(X.clientSecret):null;return await this.db.transaction().execute(async(W)=>{let Z=await W.selectFrom("downstream_tokens").select(["id","createdAt"]).where("connectionId","=",X.connectionId).executeTakeFirst();if(Z)return await W.updateTable("downstream_tokens").set({accessToken:Q,refreshToken:J,scope:X.scope,expiresAt:X.expiresAt?.toISOString()??null,clientId:X.clientId,clientSecret:G,tokenEndpoint:X.tokenEndpoint,updatedAt:Y}).where("id","=",Z.id).execute(),{id:Z.id,connectionId:X.connectionId,accessToken:X.accessToken,refreshToken:X.refreshToken,scope:X.scope,expiresAt:X.expiresAt,createdAt:Z.createdAt,updatedAt:Y,clientId:X.clientId,clientSecret:X.clientSecret,tokenEndpoint:X.tokenEndpoint};let $=QX("dtok");return await W.insertInto("downstream_tokens").values({id:$,connectionId:X.connectionId,accessToken:Q,refreshToken:J,scope:X.scope,expiresAt:X.expiresAt?.toISOString()??null,clientId:X.clientId,clientSecret:G,tokenEndpoint:X.tokenEndpoint,createdAt:Y,updatedAt:Y}).execute(),{id:$,connectionId:X.connectionId,accessToken:X.accessToken,refreshToken:X.refreshToken,scope:X.scope,expiresAt:X.expiresAt,createdAt:Y,updatedAt:Y,clientId:X.clientId,clientSecret:X.clientSecret,tokenEndpoint:X.tokenEndpoint}})}async delete(X){await this.db.deleteFrom("downstream_tokens").where("connectionId","=",X).execute()}isExpired(X,Y=0){if(!X.expiresAt)return!1;let J=(X.expiresAt instanceof Date?X.expiresAt:new Date(X.expiresAt)).getTime();if(Number.isNaN(J))return!0;return J-Y<Date.now()}async decryptToken(X){let Y=await this.vault.decrypt(X.accessToken),Q=X.refreshToken?await this.vault.decrypt(X.refreshToken):null,J=X.clientSecret?await this.vault.decrypt(X.clientSecret):null;return{id:X.id,connectionId:X.connectionId,accessToken:Y,refreshToken:Q,scope:X.scope,expiresAt:X.expiresAt,createdAt:X.createdAt,updatedAt:X.updatedAt,clientId:X.clientId,clientSecret:J,tokenEndpoint:X.tokenEndpoint}}}var Hf=k(()=>{QZ()});async function bx6(X,Y,Q,J){for(let W of Y){if(W==="*")continue;let[Z]=R71(W),$=Kf(Z,X);if($===void 0||$===null)throw Error(`Scope references key "${Z}" but it's not present in state`)}let G=S71(X,Y);for(let W of G){if(W===d5.SELF)continue;let Z=await J.storage.connections.findById(W);if(!Z||Z.organization_id!==Q)throw Error(`Referenced connection not found: ${W}`);try{await J.access.check(W)}catch($){throw Error(`Access denied to referenced connection: ${W}. ${$.message}`)}}}var _x6,yx6,TY0;var k71=k(()=>{PY0();qK();Hf();t0();$6();db();E7();_x6=U.object({id:U.string().describe("ID of the connection to update"),data:z41.describe("Partial connection data to update")}),yx6=U.object({item:Q5.describe("The updated connection entity")});TY0=e0({name:"COLLECTION_CONNECTIONS_UPDATE",description:"Update an existing MCP connection in the organization",inputSchema:_x6,outputSchema:yx6,handler:async(X,Y)=>{z1(Y);let Q=_1(Y);if(await Y.access.check(),!l8(Y))throw Error("User ID required to update connection");let{id:G,data:W}=X,Z=await Y.storage.connections.findById(G);if(!Z||Z.organization_id!==Q.id)throw Error("Connection not found in organization");let $=W.connection_type??Z.connection_type,K=W.connection_url??Z.connection_url;if($==="VIRTUAL"){let L=UK(K);if(!L)throw Error("VIRTUAL connection requires connection_url in format: virtual://$virtual_mcp_id");let w=await Y.storage.virtualMcps.findById(L);if(!w)throw Error(`Virtual MCP not found: ${L}`);if(w.organization_id!==Q.id)throw Error("Virtual MCP does not belong to the current organization");K=s_(L)}let H=W.configuration_state??Z.configuration_state,F=W.configuration_scopes??Z.configuration_scopes??[];if(W.configuration_state!==void 0||W.configuration_scopes!==void 0){if(W.configuration_state!==void 0)H=W.configuration_state;else if(H===null)H={};if(W.configuration_scopes!==void 0)F=W.configuration_scopes??[];if(F.length>0&&H)await bx6(H,F,Q.id,Y)}let V=W.connection_token??Z.connection_token;if(!V)try{let w=await new wZ(Y.db,Y.vault).get(G);if(w?.accessToken)V=w.accessToken}catch{}let q=await MB({id:Z.id,title:W.title??Z.title,connection_type:$,connection_url:K,connection_token:V,connection_headers:W.connection_headers??Z.connection_headers}).catch(()=>null),z=q?.length?q:null,D={...W,connection_url:K,tools:z,configuration_state:H,configuration_scopes:F},N=await Y.storage.connections.update(G,D);if((W.configuration_state!==void 0||W.configuration_scopes!==void 0)&&H&&F.length>0)try{await(await Y.createMCPProxy(G)).client.callTool({name:"ON_MCP_CONFIGURATION",arguments:{state:H,scopes:F}})}catch(L){console.error("Failed to invoke ON_MCP_CONFIGURATION callback",L)}return{item:N}}})});var AY0;var v71=k(()=>{QG();$6();E7();AY0=e0({name:"COLLECTION_CONNECTIONS_DELETE",description:"Delete a connection",inputSchema:FT,outputSchema:VT(Q5),handler:async(X,Y)=>{z1(Y);let Q=_1(Y);await Y.access.check();let J=await Y.storage.connections.findById(X.id);if(!J)throw Error(`Connection not found: ${X.id}`);if(J.organization_id!==Q.id)throw Error("Connection not found in organization");return await Y.storage.connections.delete(X.id),{item:J}}})});var EY0;var _71=k(()=>{t0();$6();EY0=e0({name:"CONNECTION_TEST",description:"Test connection health and latency",inputSchema:U.object({id:U.string()}),outputSchema:U.object({id:U.string(),healthy:U.boolean(),latencyMs:U.number()}),handler:async(X,Y)=>{let Q=_1(Y);await Y.access.check();let J=await Y.storage.connections.findById(X.id);if(!J||J.organization_id!==Q.id)throw Error("Connection not found");let G=await Y.storage.connections.testConnection(X.id);return{id:X.id,...G}}})});var y71=k(()=>{pG1();C71();I71();k71();v71();_71()});import{sql as X4}from"kysely";function b71(X){if(X===null||X===void 0)return"NULL";if(typeof X==="number")return String(X);if(typeof X==="boolean")return X?"TRUE":"FALSE";if(typeof X==="string")return`'${X.replace(/'/g,"''")}'`;if(X instanceof Date)return`'${X.toISOString()}'`;return`'${JSON.stringify(X).replace(/'/g,"''")}'`}function xx6(X,Y){let Q=X;for(let G=Y.length;G>=1;G--){let W=`$${G}`;if(Q.includes(W))Q=Q.replaceAll(W,b71(Y[G-1]))}let J=[];for(let G=0;G<Q.length;G++)if(Q[G]==="?")J.push(G);for(let G=Math.min(J.length,Y.length)-1;G>=0;G--){let W=J[G],Z=b71(Y[G]);Q=Q.slice(0,W)+Z+Q.slice(W+1)}return Q}function f71(X){return X.replace(/-/g,"_")}function ux6(X){return`app_${f71(X)}`}function mx6(X){return`app_role_${f71(X)}`}function lx6(X){if(X instanceof Error){let Y=X.message.toLowerCase(),Q=X.code;return Q==="3F000"||Q==="42704"||Y.includes("schema")&&Y.includes("does not exist")||Y.includes("role")&&Y.includes("does not exist")}return!1}async function dx6(X,Y,Q){if(await X4`CREATE SCHEMA IF NOT EXISTS ${X4.id(Y)}`.execute(X),!(await X4`
|
|
1143
1143
|
SELECT EXISTS (SELECT 1 FROM pg_roles WHERE rolname = ${Q}) as exists
|
|
1144
|
-
`.execute(X)).rows[0]?.exists)await X4`CREATE ROLE ${X4.id(Q)} NOLOGIN`.execute(X);await X4`GRANT ${X4.id(Q)} TO CURRENT_USER`.execute(X),await X4`GRANT USAGE, CREATE ON SCHEMA ${X4.id(Y)} TO ${X4.id(Q)}`.execute(X),await X4`GRANT ALL ON ALL TABLES IN SCHEMA ${X4.id(Y)} TO ${X4.id(Q)}`.execute(X),await X4`GRANT ALL ON ALL SEQUENCES IN SCHEMA ${X4.id(Y)} TO ${X4.id(Q)}`.execute(X),await X4`ALTER DEFAULT PRIVILEGES IN SCHEMA ${X4.id(Y)} GRANT ALL ON TABLES TO ${X4.id(Q)}`.execute(X),await X4`ALTER DEFAULT PRIVILEGES IN SCHEMA ${X4.id(Y)} GRANT ALL ON SEQUENCES TO ${X4.id(Q)}`.execute(X),await X4`REVOKE ALL ON SCHEMA public FROM ${X4.id(Q)}`.execute(X)}async function px6(X,Y,Q,J){try{return await X.transaction().execute(async(G)=>{return await X4`SET LOCAL ROLE ${X4.id(Q)}`.execute(G),await X4`SET LOCAL search_path TO ${X4.id(Y)}`.execute(G),await X4.raw(J).execute(G)})}catch(G){if(lx6(G))return await dx6(X,Y,Q),await X.transaction().execute(async(W)=>{return await X4`SET LOCAL ROLE ${X4.id(Q)}`.execute(W),await X4`SET LOCAL search_path TO ${X4.id(Y)}`.execute(W),await X4.raw(J).execute(W)});throw G}}var hx6,gx6,h71;var x71=k(()=>{t0();$6();hx6=U.object({results:U.array(U.unknown()).optional(),success:U.boolean().optional()});gx6=U.object({sql:U.string().describe("The SQL query to run"),params:U.array(U.any()).describe("The parameters to pass to the SQL query").optional()});h71=e0({name:"DATABASES_RUN_SQL",description:"Run a SQL query against the database",inputSchema:gx6,outputSchema:U.object({result:U.array(hx6)}),handler:async(X,Y)=>{z1(Y),await Y.access.check();let Q=xx6(X.sql,X.params||[]);if(!Y.connectionId)throw Error("Connection context required for database access");let J=ux6(Y.connectionId),G=mx6(Y.connectionId);return{result:[{results:(await px6(Y.db,J,G,Q)).rows,success:!0}]}}})});var g71,nx6,u71;var MZ=k(()=>{t0();Gf();g71=U.object({connectionId:U.string().optional().describe("Filter subscriptions by connection ID (optional)")}),nx6=U.object({id:U.string().describe("Subscription ID"),connectionId:U.string().describe("Subscriber connection ID"),eventType:U.string().describe("Event type pattern"),publisher:U.string().nullable().describe("Publisher connection filter (null = all publishers)"),filter:U.string().nullable().describe("JSONPath filter expression"),enabled:U.boolean().describe("Whether subscription is enabled"),createdAt:U.string().datetime().describe("Created timestamp (ISO 8601)"),updatedAt:U.string().datetime().describe("Updated timestamp (ISO 8601)")}),u71=U.object({subscriptions:U.array(nx6).describe("List of subscriptions")})});var jY0;var m71=k(()=>{$6();MZ();jY0=e0({name:"EVENT_PUBLISH",description:"Publish an event to the event bus. Supports immediate, scheduled (deliverAt), and recurring (cron) delivery. The source is automatically set to the caller's connection ID.",inputSchema:qT,outputSchema:UT,handler:async(X,Y)=>{z1(Y);let Q=_1(Y);await Y.access.check();let J=Y.connectionId;if(!J)throw Error("Connection ID required to publish events. Use a connection-scoped token.");let G=await Y.eventBus.publish(Q.id,J,{type:X.type,subject:X.subject,data:X.data,deliverAt:X.deliverAt,cron:X.cron});return{id:G.id,type:G.type,source:G.source,time:G.time}}})});var CY0;var l71=k(()=>{$6();MZ();CY0=e0({name:"EVENT_SUBSCRIBE",description:"Subscribe to events of a specific type. The subscriber is automatically set to the caller's connection.",inputSchema:zT,outputSchema:BT,handler:async(X,Y)=>{z1(Y);let Q=_1(Y);await Y.access.check();let J=Y.connectionId;if(!J)throw Error("Connection ID required to subscribe. Use a connection-scoped token.");let G=await Y.eventBus.subscribe(Q.id,{connectionId:J,eventType:X.eventType,publisher:X.publisher,filter:X.filter});return{subscription:{id:G.id,connectionId:G.connectionId,eventType:G.eventType,publisher:G.publisher,filter:G.filter,enabled:G.enabled,createdAt:G.createdAt instanceof Date?G.createdAt.toISOString():G.createdAt,updatedAt:G.updatedAt instanceof Date?G.updatedAt.toISOString():G.updatedAt}}}})});var IY0;var d71=k(()=>{$6();MZ();IY0=e0({name:"EVENT_UNSUBSCRIBE",description:"Unsubscribe from events by removing a subscription.",inputSchema:OT,outputSchema:LT,handler:async(X,Y)=>{z1(Y);let Q=_1(Y);await Y.access.check();let J=Y.connectionId;if(!J)throw Error("Connection ID required to unsubscribe. Use a connection-scoped token.");let G=await Y.eventBus.getSubscription(Q.id,X.subscriptionId);if(!G)throw Error(`Subscription not found: ${X.subscriptionId}`);if(G.connectionId!==J)throw Error("Cannot unsubscribe from a subscription owned by another connection");return{success:(await Y.eventBus.unsubscribe(Q.id,X.subscriptionId)).success,subscriptionId:X.subscriptionId}}})});var RY0;var p71=k(()=>{$6();MZ();RY0=e0({name:"EVENT_CANCEL",description:"Cancel a recurring event to stop future deliveries. Only the publisher can cancel their own events.",inputSchema:wT,outputSchema:MT,handler:async(X,Y)=>{z1(Y);let Q=_1(Y);await Y.access.check();let J=Y.connectionId;if(!J)throw Error("Connection ID required to cancel events. Use a connection-scoped token.");if(!await Y.eventBus.getEvent(Q.id,X.eventId))throw Error(`Event not found: ${X.eventId}`);if(!(await Y.eventBus.cancelEvent(Q.id,X.eventId,J)).success)throw Error("Failed to cancel event. Either the event is already completed/failed, or you are not the publisher.");return{success:!0,eventId:X.eventId}}})});var SY0;var c71=k(()=>{$6();MZ();SY0=e0({name:"EVENT_ACK",description:"Acknowledge delivery of an event. Call after successfully processing an event received via ON_EVENTS with retryAfter.",inputSchema:PT,outputSchema:TT,handler:async(X,Y)=>{z1(Y);let Q=_1(Y);await Y.access.check();let J=Y.connectionId;if(!J)throw Error("Connection ID required to acknowledge events. Use a connection-scoped token.");if(!(await Y.eventBus.ackEvent(Q.id,X.eventId,J)).success)throw Error("Failed to acknowledge event. Either the event was not found, already delivered, or you are not a subscriber.");return{success:!0,eventId:X.eventId}}})});var kY0;var n71=k(()=>{$6();MZ();kY0=e0({name:"EVENT_SUBSCRIPTION_LIST",description:"List event subscriptions, optionally filtered by connection ID.",inputSchema:g71,outputSchema:u71,handler:async(X,Y)=>{z1(Y);let Q=_1(Y);return await Y.access.check(),{subscriptions:(await Y.eventBus.listSubscriptions(Q.id,X.connectionId)).map((G)=>({id:G.id,connectionId:G.connectionId,eventType:G.eventType,publisher:G.publisher,filter:G.filter,enabled:G.enabled,createdAt:G.createdAt instanceof Date?G.createdAt.toISOString():G.createdAt,updatedAt:G.updatedAt instanceof Date?G.updatedAt.toISOString():G.updatedAt}))}}})});var vY0;var i71=k(()=>{$6();MZ();vY0=e0({name:"EVENT_SYNC_SUBSCRIPTIONS",description:"Sync subscriptions to desired state. Creates new, deletes removed, updates changed filters. Subscriptions are identified by (eventType, publisher).",inputSchema:DT,outputSchema:NT,handler:async(X,Y)=>{z1(Y);let Q=_1(Y);await Y.access.check();let J=Y.connectionId;if(!J)throw Error("Connection ID required to sync subscriptions. Use a connection-scoped token.");let G=await Y.eventBus.syncSubscriptions(Q.id,{connectionId:J,subscriptions:X.subscriptions});return{created:G.created,updated:G.updated,deleted:G.deleted,unchanged:G.unchanged,subscriptions:G.subscriptions.map((W)=>({id:W.id,connectionId:W.connectionId,eventType:W.eventType,publisher:W.publisher,filter:W.filter,enabled:W.enabled,createdAt:W.createdAt instanceof Date?W.createdAt.toISOString():W.createdAt,updatedAt:W.updatedAt instanceof Date?W.updatedAt.toISOString():W.updatedAt}))}}})});var a71=k(()=>{m71();l71();d71();p71();c71();n71();i71();MZ()});var _Y0,ax6,f7,r71,o71;var kB=k(()=>{t0();_Y0=U.enum(["inclusion","exclusion"]).describe("Tool selection mode: 'inclusion' = include selected (default), 'exclusion' = exclude selected"),ax6=U.object({connection_id:U.string().describe("Connection ID"),selected_tools:U.array(U.string()).nullable().describe("Selected tool names. With 'inclusion' mode: null = all tools included. With 'exclusion' mode: null = entire connection excluded"),selected_resources:U.array(U.string()).nullable().describe("Selected resource URIs or patterns. Supports * and ** wildcards for pattern matching. With 'inclusion' mode: null = all resources included."),selected_prompts:U.array(U.string()).nullable().describe("Selected prompt names. With 'inclusion' mode: null = all prompts included. With 'exclusion' mode: null = entire connection excluded.")}),f7=U.object({id:U.string().describe("Unique identifier for the virtual MCP"),title:U.string().describe("Human-readable name for the virtual MCP"),description:U.string().nullable().describe("Description of the virtual MCP"),icon:U.string().nullable().optional().describe("Icon URL for the virtual MCP"),created_at:U.string().describe("When the virtual MCP was created"),updated_at:U.string().describe("When the virtual MCP was last updated"),created_by:U.string().describe("User ID who created the virtual MCP"),updated_by:U.string().optional().describe("User ID who last updated the virtual MCP"),organization_id:U.string().describe("Organization ID this virtual MCP belongs to"),tool_selection_mode:_Y0.describe("Tool selection mode: 'inclusion' = include selected, 'exclusion' = exclude selected"),status:U.enum(["active","inactive"]).describe("Current status"),connections:U.array(ax6).describe("Connections with their selected tools (behavior depends on tool_selection_mode)")}),r71=U.object({title:U.string().min(1).max(255).describe("Name for the virtual MCP"),description:U.string().nullable().optional().describe("Optional description"),tool_selection_mode:_Y0.optional().default("inclusion").describe("Tool selection mode (defaults to 'inclusion')"),icon:U.string().nullable().optional().describe("Optional icon URL"),status:U.enum(["active","inactive"]).optional().default("active").describe("Initial status"),connections:U.array(U.object({connection_id:U.string().describe("Connection ID"),selected_tools:U.array(U.string()).nullable().optional().describe("Selected tool names (null/undefined = all tools or full exclusion)"),selected_resources:U.array(U.string()).nullable().optional().describe("Selected resource URIs or patterns with * and ** wildcards (null/undefined = all resources)"),selected_prompts:U.array(U.string()).nullable().optional().describe("Selected prompt names (null/undefined = all prompts or full exclusion)")})).describe("Connections to include/exclude (can be empty for exclusion mode)")}),o71=U.object({title:U.string().min(1).max(255).optional().describe("New name"),description:U.string().nullable().optional().describe("New description (null to clear)"),tool_selection_mode:_Y0.optional().describe("New tool selection mode"),icon:U.string().nullable().optional().describe("New icon URL (null to clear)"),status:U.enum(["active","inactive"]).optional().describe("New status"),connections:U.array(U.object({connection_id:U.string().describe("Connection ID"),selected_tools:U.array(U.string()).nullable().optional().describe("Selected tool names (null/undefined = all tools or full exclusion)"),selected_resources:U.array(U.string()).nullable().optional().describe("Selected resource URIs or patterns with * and ** wildcards (null/undefined = all resources)"),selected_prompts:U.array(U.string()).nullable().optional().describe("Selected prompt names (null/undefined = all prompts or full exclusion)")})).optional().describe("New connections (replaces existing)")})});var rx6,ox6,yY0;var s71=k(()=>{t0();$6();kB();rx6=U.object({data:r71.describe("Data for the new virtual MCP")}),ox6=U.object({item:f7.describe("The created virtual MCP entity")}),yY0=e0({name:"COLLECTION_VIRTUAL_MCP_CREATE",description:"Create a new MCP virtual MCP in the organization",inputSchema:rx6,outputSchema:ox6,handler:async(X,Y)=>{z1(Y);let Q=_1(Y);await Y.access.check();let J=l8(Y);if(!J)throw Error("User ID required to create virtual MCP");return{item:await Y.storage.virtualMcps.create(Q.id,J,X.data)}}})});function sx6(X){let Y=[],Q=0;while(Q<X.length){let J=X[Q];if(J==="%")Y.push(".*");else if(J==="_")Y.push(".");else if(/[.*+?^${}()|[\]\\]/.test(J))Y.push("\\"+J);else Y.push(J);Q++}return Y.join("")}function xK(X){return typeof X==="string"||typeof X==="number"}function bY0(X,Y){let Q=Y.split("."),J=X;for(let G of Q){if(J==null||typeof J!=="object")return;J=J[G]}return J}function tx6(X,Y){return X.connections.some((Q)=>Q.connection_id===Y)}function Ff(X,Y){if("conditions"in Y){let{operator:$,conditions:K}=Y;switch($){case"and":return K.every((H)=>Ff(X,H));case"or":return K.some((H)=>Ff(X,H));case"not":return!K.every((H)=>Ff(X,H));default:return!0}}let{field:Q,operator:J,value:G}=Y,W=Q.join(".");if(W==="connection_id"){if(J!=="eq"||typeof G!=="string")return!1;return tx6(X,G)}let Z=bY0(X,W);switch(J){case"eq":return Z===G;case"gt":return xK(Z)&&xK(G)&&Z>G;case"gte":return xK(Z)&&xK(G)&&Z>=G;case"lt":return xK(Z)&&xK(G)&&Z<G;case"lte":return xK(Z)&&xK(G)&&Z<=G;case"in":return Array.isArray(G)&&G.includes(Z);case"like":if(typeof Z!=="string"||typeof G!=="string")return!1;if(G.length>100)return!1;let $=sx6(G);return new RegExp(`^${$}$`,"i").test(Z);case"contains":if(typeof Z!=="string"||typeof G!=="string")return!1;return Z.toLowerCase().includes(G.toLowerCase());default:return!0}}function ex6(X,Y){return[...X].sort((Q,J)=>{for(let G of Y){let W=G.field.join("."),Z=bY0(Q,W),$=bY0(J,W),K=0;if(Z==null&&$==null)continue;if(Z==null)K=G.nulls==="first"?-1:1;else if($==null)K=G.nulls==="first"?1:-1;else if(typeof Z==="string"&&typeof $==="string")K=Z.localeCompare($);else if(typeof Z==="number"&&typeof $==="number")K=Z-$;else K=String(Z).localeCompare(String($));if(K!==0)return G.direction==="desc"?-K:K}return 0})}var Xg6,Yg6,fY0;var t71=k(()=>{QG();$6();kB();Xg6=uF,Yg6=mF(f7),fY0=e0({name:"COLLECTION_VIRTUAL_MCP_LIST",description:"List all MCP virtual MCPs in the organization",inputSchema:Xg6,outputSchema:Yg6,handler:async(X,Y)=>{await Y.access.check();let Q=_1(Y),J=X.where&&!("conditions"in X.where)&&X.where.field.join(".")==="connection_id"&&X.where.operator==="eq"&&typeof X.where.value==="string"?X.where.value:void 0,W=J?await Y.storage.virtualMcps.listByConnectionId(Q.id,J):await Y.storage.virtualMcps.list(Q.id);if(X.where)W=W.filter((V)=>Ff(V,X.where));if(X.orderBy&&X.orderBy.length>0)W=ex6(W,X.orderBy);let Z=W.length,$=X.offset??0,K=X.limit??100,H=W.slice($,$+K),F=$+K<Z;return{items:H,totalCount:Z,hasMore:F}}})});var Qg6,Jg6,hY0;var e71=k(()=>{t0();$6();kB();Qg6=U.object({id:U.string().describe("ID of the virtual MCP to retrieve")}),Jg6=U.object({item:f7.nullable().describe("The retrieved virtual MCP, or null if not found")}),hY0=e0({name:"COLLECTION_VIRTUAL_MCP_GET",description:"Get an MCP virtual MCP by ID",inputSchema:Qg6,outputSchema:Jg6,handler:async(X,Y)=>{z1(Y);let Q=_1(Y);await Y.access.check();let J=await Y.storage.virtualMcps.findById(X.id);if(J&&J.organization_id!==Q.id)return{item:null};if(!J)return{item:null};return{item:J}}})});var Gg6,Wg6,xY0;var XW1=k(()=>{t0();$6();kB();Gg6=U.object({id:U.string().describe("ID of the virtual MCP to update"),data:o71.describe("Partial virtual MCP data to update")}),Wg6=U.object({item:f7.describe("The updated virtual MCP entity")}),xY0=e0({name:"COLLECTION_VIRTUAL_MCP_UPDATE",description:"Update an MCP virtual MCP",inputSchema:Gg6,outputSchema:Wg6,handler:async(X,Y)=>{z1(Y);let Q=_1(Y);await Y.access.check();let J=l8(Y);if(!J)throw Error("User ID required to update virtual MCP");let G=await Y.storage.virtualMcps.findById(X.id);if(!G)throw Error(`Virtual MCP not found: ${X.id}`);if(G.organization_id!==Q.id)throw Error(`Virtual MCP not found: ${X.id}`);return{item:await Y.storage.virtualMcps.update(X.id,J,X.data)}}})});var Zg6,$g6,gY0;var YW1=k(()=>{t0();$6();kB();Zg6=U.object({id:U.string().describe("ID of the virtual MCP to delete")}),$g6=U.object({item:f7.describe("The deleted virtual MCP entity")}),gY0=e0({name:"COLLECTION_VIRTUAL_MCP_DELETE",description:"Delete an MCP virtual MCP",inputSchema:Zg6,outputSchema:$g6,handler:async(X,Y)=>{z1(Y);let Q=_1(Y);await Y.access.check();let J=await Y.storage.virtualMcps.findById(X.id);if(!J)throw Error(`Virtual MCP not found: ${X.id}`);if(J.organization_id!==Q.id)throw Error(`Virtual MCP not found: ${X.id}`);return await Y.storage.virtualMcps.delete(X.id),{item:J}}})});var QW1=k(()=>{s71();t71();e71();XW1();YW1()});var Hg6,uY0;var JW1=k(()=>{$6();t0();Hg6=U.object({id:U.string().optional().describe("Unique log identifier"),organizationId:U.string().describe("Organization ID"),connectionId:U.string().describe("Connection ID"),connectionTitle:U.string().describe("Connection display name"),toolName:U.string().describe("Name of the tool that was called"),input:U.record(U.string(),U.unknown()).describe("Redacted tool input"),output:U.record(U.string(),U.unknown()).describe("Redacted tool output"),isError:U.boolean().describe("Whether the call resulted in an error"),errorMessage:U.string().nullish().describe("Error message if applicable"),durationMs:U.number().describe("Call duration in milliseconds"),timestamp:U.string().describe("ISO 8601 timestamp of the call"),userId:U.string().nullish().describe("User who triggered the call"),requestId:U.string().describe("Unique request identifier"),userAgent:U.string().nullish().describe("Client identifier (x-mesh-client header)"),virtualMcpId:U.string().nullish().describe("Virtual MCP (Agent) ID if routed through an agent"),properties:U.record(U.string(),U.string()).nullish().describe("Custom key-value metadata attached to the log")}),uY0=e0({name:"MONITORING_LOGS_LIST",description:"List monitoring logs for tool calls in the organization",inputSchema:U.object({connectionId:U.string().optional().describe("Filter by connection ID"),virtualMcpId:U.string().optional().describe("Filter by Virtual MCP (Agent) ID"),toolName:U.string().optional().describe("Filter by tool name"),isError:U.boolean().optional().describe("Filter by error status"),startDate:U.string().datetime().optional().describe("Filter by start date (ISO 8601 datetime string)"),endDate:U.string().datetime().optional().describe("Filter by end date (ISO 8601 datetime string)"),limit:U.number().default(100).describe("Maximum number of results"),offset:U.number().default(0).describe("Offset for pagination"),properties:U.record(U.string(),U.string()).optional().describe("Filter by exact property key=value matches"),propertyKeys:U.array(U.string()).optional().describe("Filter by logs that have these property keys"),propertyPatterns:U.record(U.string(),U.string()).optional().describe("Filter by property value patterns (SQL LIKE, use % as wildcard)")}),outputSchema:U.object({logs:U.array(Hg6).describe("Array of monitoring logs"),total:U.number().describe("Total number of logs matching filters"),offset:U.number().describe("Current offset for pagination"),limit:U.number().describe("Current limit for pagination")}),handler:async(X,Y)=>{let Q=_1(Y),G=X.properties||X.propertyKeys||X.propertyPatterns?{properties:X.properties,propertyKeys:X.propertyKeys,propertyPatterns:X.propertyPatterns}:void 0,W={organizationId:Q.id,connectionId:X.connectionId,virtualMcpId:X.virtualMcpId,toolName:X.toolName,isError:X.isError,startDate:X.startDate?new Date(X.startDate):void 0,endDate:X.endDate?new Date(X.endDate):void 0,limit:X.limit,offset:X.offset,propertyFilters:G},Z=await Y.storage.monitoring.query(W);return{logs:Z.logs.map(($)=>({...$,timestamp:$.timestamp instanceof Date?$.timestamp.toISOString():$.timestamp})),total:Z.total,offset:X.offset,limit:X.limit}}})});var mY0;var GW1=k(()=>{$6();t0();mY0=e0({name:"MONITORING_STATS",description:"Get aggregated statistics for tool call monitoring",inputSchema:U.object({startDate:U.string().datetime().optional().describe("Filter by start date (ISO 8601 datetime string)"),endDate:U.string().datetime().optional().describe("Filter by end date (ISO 8601 datetime string)")}),outputSchema:U.object({totalCalls:U.number().describe("Total number of tool calls"),errorRate:U.number().describe("Error rate as a decimal (0 to 1)"),avgDurationMs:U.number().describe("Average call duration in milliseconds"),errorRatePercent:U.string().describe("Error rate as a percentage string")}),handler:async(X,Y)=>{let J={organizationId:_1(Y).id,startDate:X.startDate?new Date(X.startDate):void 0,endDate:X.endDate?new Date(X.endDate):void 0},G=await Y.storage.monitoring.getStats(J);return{...G,errorRatePercent:(G.errorRate*100).toFixed(2)}}})});var WW1=k(()=>{JW1();GW1()});var lY0;var ZW1=k(()=>{t0();$6();lY0=e0({name:"ORGANIZATION_CREATE",description:"Create a new organization",inputSchema:U.object({slug:U.string().min(1).max(50).regex(/^[a-z0-9-]+$/,"Slug must be lowercase alphanumeric with hyphens"),name:U.string().min(1).max(255),description:U.string().optional()}),outputSchema:U.object({id:U.string(),name:U.string(),slug:U.string(),logo:U.string().nullable().optional(),metadata:U.any().optional(),createdAt:U.string().datetime().describe("ISO 8601 timestamp"),members:U.array(U.any()).optional()}),handler:async(X,Y)=>{z1(Y),await Y.access.check();let Q=l8(Y);if(!Q)throw Error("User ID required to create organization");let J=await Y.boundAuth.organization.create({name:X.name,slug:X.slug,metadata:X.description?{description:X.description}:void 0,userId:Q});if(!J)throw Error("Failed to create organization");return{...J,createdAt:J.createdAt instanceof Date?J.createdAt.toISOString():J.createdAt}}})});var dY0;var $W1=k(()=>{t0();$6();dY0=e0({name:"ORGANIZATION_LIST",description:"List all organizations user has access to",inputSchema:U.object({userId:U.string().optional()}),outputSchema:U.object({organizations:U.array(U.object({id:U.string(),name:U.string(),slug:U.string(),logo:U.string().nullable().optional(),metadata:U.any().optional(),createdAt:U.string().datetime().describe("ISO 8601 timestamp")}))}),handler:async(X,Y)=>{z1(Y),await Y.access.check();let Q=l8(Y),J=X.userId||Q;if(!J)throw Error("User ID required to list organizations");return{organizations:(await Y.boundAuth.organization.list(J)).map((W)=>({...W,createdAt:W.createdAt instanceof Date?W.createdAt.toISOString():W.createdAt}))}}})});var pY0;var KW1=k(()=>{t0();$6();pY0=e0({name:"ORGANIZATION_GET",description:"Get organization details by slug or ID",inputSchema:U.object({}),outputSchema:U.object({id:U.string(),name:U.string(),slug:U.string(),logo:U.string().nullable().optional(),metadata:U.any().optional(),createdAt:U.string().datetime().describe("ISO 8601 timestamp"),members:U.array(U.any()).optional(),invitations:U.array(U.any()).optional()}),handler:async(X,Y)=>{z1(Y),await Y.access.check();let Q=await Y.boundAuth.organization.get();if(!Q)throw Error("No active organization found");return{...Q,createdAt:Q.createdAt instanceof Date?Q.createdAt.toISOString():Q.createdAt}}})});var cY0;var HW1=k(()=>{t0();$6();cY0=e0({name:"ORGANIZATION_UPDATE",description:"Update an existing organization",inputSchema:U.object({id:U.string(),slug:U.string().min(1).max(50).regex(/^[a-z0-9-]+$/).optional(),name:U.string().min(1).max(255).optional(),description:U.string().optional()}),outputSchema:U.object({id:U.string(),name:U.string(),slug:U.string(),logo:U.string().nullable().optional(),metadata:U.any().optional(),createdAt:U.string().datetime().describe("ISO 8601 timestamp")}),handler:async(X,Y)=>{z1(Y),await Y.access.check();let Q={};if(X.name)Q.name=X.name;if(X.slug)Q.slug=X.slug;if(X.description)Q.metadata={description:X.description};let J=await Y.boundAuth.organization.update({organizationId:X.id,data:Q});if(!J)throw Error("Failed to update organization");return{...J,createdAt:J.createdAt instanceof Date?J.createdAt.toISOString():J.createdAt}}})});var nY0;var FW1=k(()=>{t0();$6();nY0=e0({name:"ORGANIZATION_DELETE",description:"Delete an organization",inputSchema:U.object({id:U.string()}),outputSchema:U.object({success:U.boolean(),id:U.string()}),handler:async(X,Y)=>{return z1(Y),await Y.access.check(),await Y.boundAuth.organization.delete(X.id),{success:!0,id:X.id}}})});var ET;var iY0=k(()=>{t0();ET=U.object({title:U.string(),url:U.string(),icon:U.string()})});var aY0;var VW1=k(()=>{t0();$6();iY0();aY0=e0({name:"ORGANIZATION_SETTINGS_GET",description:"Get organization-level settings",inputSchema:U.object({}),outputSchema:U.object({organizationId:U.string(),sidebar_items:U.array(ET).nullable().optional(),enabled_plugins:U.array(U.string()).nullable().optional(),createdAt:U.string().datetime().optional().describe("ISO 8601 timestamp"),updatedAt:U.string().datetime().optional().describe("ISO 8601 timestamp")}),handler:async(X,Y)=>{z1(Y),await Y.access.check();let Q=Y.organization?.id;if(!Q)throw Error("Organization ID required (no active organization in context)");let J=await Y.storage.organizationSettings.get(Q);if(!J)return{organizationId:Q};return{...J,createdAt:J.createdAt instanceof Date?J.createdAt.toISOString():J.createdAt,updatedAt:J.updatedAt instanceof Date?J.updatedAt.toISOString():J.updatedAt}}})});var rY0;var qW1=k(()=>{t0();$6();iY0();rY0=e0({name:"ORGANIZATION_SETTINGS_UPDATE",description:"Update organization-level settings",inputSchema:U.object({organizationId:U.string(),sidebar_items:U.array(ET).optional(),enabled_plugins:U.array(U.string()).optional()}),outputSchema:U.object({organizationId:U.string(),sidebar_items:U.array(ET).nullable().optional(),enabled_plugins:U.array(U.string()).nullable().optional(),createdAt:U.string().datetime().describe("ISO 8601 timestamp"),updatedAt:U.string().datetime().describe("ISO 8601 timestamp")}),handler:async(X,Y)=>{if(z1(Y),await Y.access.check(),Y.organization&&Y.organization.id!==X.organizationId)throw Error("Cannot update settings for a different organization");let Q=await Y.storage.organizationSettings.upsert(X.organizationId,{sidebar_items:X.sidebar_items,enabled_plugins:X.enabled_plugins});return{...Q,createdAt:Q.createdAt instanceof Date?Q.createdAt.toISOString():Q.createdAt,updatedAt:Q.updatedAt instanceof Date?Q.updatedAt.toISOString():Q.updatedAt}}})});var oY0;var UW1=k(()=>{t0();$6();oY0=e0({name:"ORGANIZATION_MEMBER_ADD",description:"Add a member to an organization",inputSchema:U.object({organizationId:U.string().optional(),userId:U.string(),role:U.array(U.string())}),outputSchema:U.object({id:U.string(),organizationId:U.string(),userId:U.string(),role:U.union([U.string(),U.array(U.string())]),createdAt:U.string().datetime().describe("ISO 8601 timestamp")}),handler:async(X,Y)=>{z1(Y),await Y.access.check();let Q=X.organizationId||Y.organization?.id;if(!Q)throw Error("Organization ID required (no active organization in context)");let J=await Y.boundAuth.organization.addMember({organizationId:Q,userId:X.userId,role:X.role});if(!J)throw Error("Failed to add member");return{...J,role:J.role,createdAt:J.createdAt instanceof Date?J.createdAt.toISOString():J.createdAt}}})});var sY0;var zW1=k(()=>{t0();$6();sY0=e0({name:"ORGANIZATION_MEMBER_REMOVE",description:"Remove a member from an organization",inputSchema:U.object({organizationId:U.string().optional(),memberIdOrEmail:U.string()}),outputSchema:U.object({success:U.boolean(),memberIdOrEmail:U.string()}),handler:async(X,Y)=>{z1(Y),await Y.access.check();let Q=X.organizationId||Y.organization?.id;if(!Q)throw Error("Organization ID required (no active organization in context)");return await Y.boundAuth.organization.removeMember({organizationId:Q,memberIdOrEmail:X.memberIdOrEmail}),{success:!0,memberIdOrEmail:X.memberIdOrEmail}}})});var tY0;var BW1=k(()=>{t0();$6();tY0=e0({name:"ORGANIZATION_MEMBER_LIST",description:"List all members in an organization",inputSchema:U.object({limit:U.number().optional(),offset:U.number().optional()}),outputSchema:U.object({members:U.array(U.object({id:U.string(),organizationId:U.string(),userId:U.string(),role:U.string(),createdAt:U.string().datetime().describe("ISO 8601 timestamp"),user:U.object({id:U.string(),name:U.string(),email:U.string(),image:U.string().optional()}).optional()}))}),handler:async(X,Y)=>{z1(Y),await Y.access.check();let Q=Y.organization?.id;if(!Q)throw Error("Organization ID required (no active organization in context)");let J=await Y.boundAuth.organization.listMembers({organizationId:Q,limit:X.limit,offset:X.offset});return{members:(Array.isArray(J)?J:[]).map((W)=>({...W,createdAt:W.createdAt instanceof Date?W.createdAt.toISOString():W.createdAt}))}}})});var eY0;var DW1=k(()=>{t0();$6();eY0=e0({name:"ORGANIZATION_MEMBER_UPDATE_ROLE",description:"Update a member's role in an organization",inputSchema:U.object({organizationId:U.string().optional(),memberId:U.string(),role:U.array(U.string())}),outputSchema:U.object({id:U.string(),organizationId:U.string(),userId:U.string(),role:U.union([U.literal("admin"),U.literal("member"),U.literal("owner")]),createdAt:U.string().datetime().describe("ISO 8601 timestamp"),user:U.object({email:U.string(),name:U.string(),image:U.string().optional()})}),handler:async(X,Y)=>{z1(Y),await Y.access.check();let Q=X.organizationId||Y.organization?.id;if(!Q)throw Error("Organization ID required (no active organization in context)");let J=await Y.boundAuth.organization.updateMemberRole({organizationId:Q,memberId:X.memberId,role:X.role});if(!J)throw Error("Failed to update member role");return{...J,createdAt:J.createdAt instanceof Date?J.createdAt.toISOString():J.createdAt}}})});var NW1=k(()=>{ZW1();$W1();KW1();HW1();FW1();VW1();qW1();UW1();zW1();BW1();DW1()});var OW1,h7,LW1,wW1;var lF=k(()=>{t0();OW1=U.object({id:U.string().describe("Unique message ID"),threadId:U.string().describe("ID of the parent thread"),metadata:U.unknown().optional().describe("Optional message metadata"),parts:U.array(U.record(U.string(),U.unknown())).describe("Message content parts (AI SDK UIMessagePart format)"),role:U.enum(["user","assistant","system"]).describe("Message role"),createdAt:U.string().datetime().describe("Timestamp of creation"),updatedAt:U.string().datetime().describe("Timestamp of last update")}),h7=U.object({id:U.string().describe("Unique thread ID"),organizationId:U.string().describe("Organization this thread belongs to"),title:U.string().describe("Thread title"),description:U.string().nullable().describe("Thread description"),createdAt:U.string().datetime().describe("Timestamp of creation"),updatedAt:U.string().datetime().describe("Timestamp of last update"),hidden:U.boolean().optional().describe("Whether the thread is hidden"),createdBy:U.string().describe("User ID who created the thread"),updatedBy:U.string().nullable().describe("User ID who last updated the thread")}),LW1=U.object({id:U.string().optional().describe("Optional custom ID for the thread"),title:U.string().describe("Thread title"),description:U.string().nullish().describe("Thread description")}),wW1=U.object({title:U.string().optional().describe("New thread title"),description:U.string().nullish().describe("New thread description"),hidden:U.boolean().optional().describe("Whether the thread is hidden")})});var qg6,Ug6,X90;var MW1=k(()=>{t0();$6();lF();QZ();qg6=U.object({data:LW1.describe("Data for the new thread (id is auto-generated if not provided)")}),Ug6=U.object({item:h7.describe("The created thread entity")}),X90=e0({name:"COLLECTION_THREADS_CREATE",description:"Create a new thread in the organization",inputSchema:qg6,outputSchema:Ug6,handler:async(X,Y)=>{z1(Y);let Q=_1(Y);await Y.access.check();let J=l8(Y);if(!J)throw Error("User ID required to create thread");let G=X.data.id??QX("thrd"),W=await Y.storage.threads.create({id:G,organizationId:Q.id,title:X.data.title,description:X.data.description,createdBy:J});return{item:{...W,hidden:W.hidden??!1}}}})});var zg6,Bg6,Y90;var PW1=k(()=>{QG();$6();lF();t0();zg6=uF.extend({where:U.object({created_by:U.string().optional()}).optional()}),Bg6=mF(h7),Y90=e0({name:"COLLECTION_THREADS_LIST",description:"List all threads in the organization with filtering, sorting, and pagination",inputSchema:zg6,outputSchema:Bg6,handler:async(X,Y)=>{await Y.access.check();let Q=Y.auth.user?.id;if(!Q)throw Error("User ID required to list threads");let J=_1(Y),G=X.offset??0,W=X.limit??100,{threads:Z,total:$}=await Y.storage.threads.list(J.id,Q,{limit:W,offset:G}),K=G+W<$;return{items:Z.map((H)=>({...H,hidden:H.hidden??!1})),totalCount:$,hasMore:K}}})});var Dg6,Q90;var TW1=k(()=>{QG();$6();lF();Dg6=HT(h7),Q90=e0({name:"COLLECTION_THREADS_GET",description:"Get thread details by ID",inputSchema:KT,outputSchema:Dg6,handler:async(X,Y)=>{z1(Y);let Q=_1(Y);await Y.access.check();let J=await Y.storage.threads.get(X.id);if(!J||J.organizationId!==Q.id)return{item:null};return{item:{...J,hidden:J.hidden??!1}}}})});var Ng6,Og6,J90;var AW1=k(()=>{t0();$6();lF();Ng6=U.object({id:U.string().describe("ID of the thread to update"),data:wW1.describe("Partial thread data to update")}),Og6=U.object({item:h7.describe("The updated thread entity")}),J90=e0({name:"COLLECTION_THREADS_UPDATE",description:"Update an existing thread in the organization",inputSchema:Ng6,outputSchema:Og6,handler:async(X,Y)=>{z1(Y);let Q=_1(Y);await Y.access.check();let J=l8(Y);if(!J)throw Error("User ID required to update thread");let{id:G,data:W}=X,Z=await Y.storage.threads.get(G);if(!Z||Z.organizationId!==Q.id)throw Error("Thread not found in organization");let $=await Y.storage.threads.update(G,{title:W.title,description:W.description,hidden:W.hidden,updatedBy:J});return{item:{...$,hidden:$.hidden??!1}}}})});var G90;var EW1=k(()=>{QG();$6();lF();G90=e0({name:"COLLECTION_THREADS_DELETE",description:"Delete a thread",inputSchema:FT,outputSchema:VT(h7),handler:async(X,Y)=>{z1(Y);let Q=_1(Y);await Y.access.check();let J=await Y.storage.threads.get(X.id);if(!J)throw Error(`Thread not found: ${X.id}`);if(J.organizationId!==Q.id)throw Error(`Thread not found: ${X.id}`);return await Y.storage.threads.delete(X.id),{item:{...J,hidden:J.hidden??!1}}}})});var Lg6,wg6,W90;var jW1=k(()=>{t0();$6();lF();Lg6=U.object({threadId:U.string().describe("ID of the thread to list messages for"),limit:U.number().optional().describe("Maximum number of messages to return"),offset:U.number().optional().describe("Number of messages to skip")}),wg6=U.object({items:U.array(OW1).describe("List of thread messages"),totalCount:U.number().describe("Total number of messages in the thread"),hasMore:U.boolean().describe("Whether there are more messages available")}),W90=e0({name:"COLLECTION_THREAD_MESSAGES_LIST",description:"List all messages for a specific thread",inputSchema:Lg6,outputSchema:wg6,handler:async(X,Y)=>{let Q=_1(Y);await Y.access.check();let J=await Y.storage.threads.get(X.threadId);if(!J||J.organizationId!==Q.id)throw Error("Thread not found in organization");let G=X.offset??0,W=X.limit??100,{messages:Z,total:$}=await Y.storage.threads.listMessages(X.threadId,{limit:W,offset:G}),K=G+W<$;return{items:Z,totalCount:$,hasMore:K}}})});var CW1=k(()=>{MW1();PW1();TW1();AW1();EW1();jW1()});var Pg6,Tg6,Z90;var IW1=k(()=>{t0();$6();Pg6=U.object({id:U.string().min(1)}),Tg6=U.object({user:U.object({id:U.string(),name:U.string(),email:U.string(),image:U.string().nullable()}).nullable()}),Z90=e0({name:"USER_GET",description:"Get a user by id (restricted to shared organizations)",inputSchema:Pg6,outputSchema:Tg6,handler:async(X,Y)=>{await Y.access.check(),z1(Y);let Q=l8(Y);if(!Q)throw Error("Authentication required");let J=await Y.storage.users.findById(X.id,Q);if(!J)return{user:null};return{user:{id:J.id,name:J.name,email:J.email,image:J.image??null}}}})});var RW1=k(()=>{IW1()});var kW1={};s1(kW1,{managementMCP:()=>$90,ALL_TOOLS:()=>SW1});var SW1,$90=(X)=>{let Y=SW1.map((J)=>({name:J.name,description:J.description,inputSchema:J.inputSchema,outputSchema:J.outputSchema,handler:async(G)=>{return X.access.setToolName(J.name),await J.execute(G,X)}}));return h51({name:"mcp-mesh-management",version:"1.0.0"}).withTools(Y).build()};var K90=k(()=>{x51();t51();dG1();y71();x71();a71();QW1();WW1();NW1();CW1();RW1();SW1=[lY0,dY0,pY0,cY0,nY0,aY0,rY0,oY0,sY0,tY0,eY0,FY0,LY0,wY0,TY0,AY0,EY0,yY0,fY0,hY0,xY0,gY0,h71,uY0,mY0,xX0,uX0,mX0,gX0,jY0,CY0,IY0,RY0,SY0,kY0,vY0,Z90,$Y0,KY0,HY0,X90,Y90,Q90,J90,G90,W90]});function Eg6(X){return[{permissions:{self:["*"]},getTools:async()=>{let{ALL_TOOLS:Y}=await Promise.resolve().then(() => (K90(),kW1));return Y.map((Q)=>{return{name:Q.name,inputSchema:U.toJSONSchema(Q.inputSchema,{unrepresentable:"any"}),outputSchema:Q.outputSchema?U.toJSONSchema(Q.outputSchema,{unrepresentable:"any"}):void 0,description:Q.description}})},data:$41(process.env.BASE_URL||"http://localhost:3000")},{data:Z41()},{data:W41(X)}]}async function vW1(X,Y){try{let Q=NF(),J=new iM(process.env.ENCRYPTION_KEY||""),G=new aM(Q.db,J),W=Eg6(X);await Promise.all(W.map(async(Z)=>{let $=null;if(Z.permissions)$=(await JG.api.createApiKey({body:{name:`${Z.data.app_name??crypto.randomUUID()}-mcp`,userId:Y,permissions:Z.permissions,rateLimitEnabled:!1,metadata:{organization:{id:X},purpose:"default-org-connections"}}}))?.key;let K=await Z.getTools?.()??await MB({id:"pending",title:Z.data.title,connection_type:Z.data.connection_type,connection_url:Z.data.connection_url,connection_token:Z.data.connection_token,connection_headers:Z.data.connection_headers}).catch(()=>null),H=Z.data.id?Z.data.id.startsWith(`${X}_`)?Z.data.id:`${X}_${Z.data.id}`:void 0;await G.create({...Z.data,id:H,tools:K,organization_id:X,created_by:Y,connection_token:Z.data.connection_token??$})}))}catch(Q){console.error("Error creating default MCP connections:",Q)}}var _W1=k(()=>{qK();cM();I60();R60();db();t0();vB()});var H90,yW1;var F90=k(()=>{H90=["owner","admin","user"],yW1=["owner","admin"]});var jg6=(X)=>{return{defaultSSO:[{domain:X.domain,providerId:X.providerId,oidcConfig:{issuer:`https://login.microsoftonline.com/${X.MS_TENANT_ID}/v2.0`,pkce:!0,clientId:X.MS_CLIENT_ID,clientSecret:X.MS_CLIENT_SECRET,discoveryEndpoint:`https://login.microsoftonline.com/${X.MS_TENANT_ID}/v2.0/.well-known/openid-configuration`,authorizationEndpoint:`https://login.microsoftonline.com/${X.MS_TENANT_ID}/oauth2/v2.0/authorize`,tokenEndpoint:`https://login.microsoftonline.com/${X.MS_TENANT_ID}/oauth2/v2.0/token`,jwksEndpoint:`https://login.microsoftonline.com/${X.MS_TENANT_ID}/discovery/v2.0/keys`,userInfoEndpoint:"https://graph.microsoft.com/oidc/userinfo",tokenEndpointAuthentication:"client_secret_post",scopes:X.scopes,mapping:{id:"sub",email:"email",emailVerified:"email_verified",name:"name",image:"picture",extraFields:{emailVerified:"email_verified"}}}}]}},bW1=(X)=>{if(X.providerId==="microsoft")return jg6(X);throw Error(`Unsupported provider: ${X.providerId}`)};function Cg6(X){return X.toLowerCase().trim().replace(/[^a-z0-9\s_-]+/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}function Ig6(){let X=Math.floor(Math.random()*hW1.length),Y=Math.floor(Math.random()*fW1.length),Q=hW1[X]??"deco",J=fW1[Y]??"studio";return`${Q}-${J}`}var fW1,hW1,Rg6,Sg6,Vf,kg6,vg6,_g6,xW1,GX,gW1=void 0,yg6,bg6,fg6,JG;var vB=k(()=>{Ld();AB0();FN0();Ki();ka();QO0();ES();FO0();cM();C60();Q41();_W1();F90();fW1=["labs","agent","studio","workspace","systems","core","cloud","works"],hW1=["capybara","guarana","deco","samba","feijoada","capoeira","carnival"];Rg6=Object.values(QO()).map((X)=>X.map((Y)=>Y.name)).flat(),Sg6={...HS,self:["*",...Rg6]},Vf=J7(Sg6),kg6=Vf.newRole({self:["*"],...yL.statements}),vg6=Vf.newRole({self:["*"],...yL.statements}),_g6=Vf.newRole({self:["*"],...yL.statements}),xW1=Object.values(QO()).map((X)=>X.map((Y)=>`self:${Y.name}`)).flat(),GX=dL.auth;if(GX.inviteEmailProviderId&&GX.emailProviders&&GX.emailProviders.length>0){let X=o_(GX.emailProviders,GX.inviteEmailProviderId);if(X){let Y=r_(X);gW1=async(Q)=>{let J=Q.inviter.user?.name||Q.inviter.user?.email,G=`${process.env.BASE_URL||"http://localhost:3000"}/auth/accept-invitation?invitationId=${Q.invitation.id}`;await Y({to:Q.email,subject:`Invitation to join ${Q.organization.name}`,html:`
|
|
1144
|
+
`.execute(X)).rows[0]?.exists)await X4`CREATE ROLE ${X4.id(Q)} NOLOGIN`.execute(X);await X4`GRANT ${X4.id(Q)} TO CURRENT_USER`.execute(X),await X4`GRANT USAGE, CREATE ON SCHEMA ${X4.id(Y)} TO ${X4.id(Q)}`.execute(X),await X4`GRANT ALL ON ALL TABLES IN SCHEMA ${X4.id(Y)} TO ${X4.id(Q)}`.execute(X),await X4`GRANT ALL ON ALL SEQUENCES IN SCHEMA ${X4.id(Y)} TO ${X4.id(Q)}`.execute(X),await X4`ALTER DEFAULT PRIVILEGES IN SCHEMA ${X4.id(Y)} GRANT ALL ON TABLES TO ${X4.id(Q)}`.execute(X),await X4`ALTER DEFAULT PRIVILEGES IN SCHEMA ${X4.id(Y)} GRANT ALL ON SEQUENCES TO ${X4.id(Q)}`.execute(X),await X4`REVOKE ALL ON SCHEMA public FROM ${X4.id(Q)}`.execute(X)}async function px6(X,Y,Q,J){try{return await X.transaction().execute(async(G)=>{return await X4`SET LOCAL ROLE ${X4.id(Q)}`.execute(G),await X4`SET LOCAL search_path TO ${X4.id(Y)}`.execute(G),await X4.raw(J).execute(G)})}catch(G){if(lx6(G))return await dx6(X,Y,Q),await X.transaction().execute(async(W)=>{return await X4`SET LOCAL ROLE ${X4.id(Q)}`.execute(W),await X4`SET LOCAL search_path TO ${X4.id(Y)}`.execute(W),await X4.raw(J).execute(W)});throw G}}var hx6,gx6,h71;var x71=k(()=>{t0();$6();hx6=U.object({results:U.array(U.unknown()).optional(),success:U.boolean().optional()});gx6=U.object({sql:U.string().describe("The SQL query to run"),params:U.array(U.any()).describe("The parameters to pass to the SQL query").optional()});h71=e0({name:"DATABASES_RUN_SQL",description:"Run a SQL query against the database",inputSchema:gx6,outputSchema:U.object({result:U.array(hx6)}),handler:async(X,Y)=>{z1(Y),await Y.access.check();let Q=xx6(X.sql,X.params||[]);if(!Y.connectionId)throw Error("Connection context required for database access");let J=ux6(Y.connectionId),G=mx6(Y.connectionId);return{result:[{results:(await px6(Y.db,J,G,Q)).rows,success:!0}]}}})});var g71,nx6,u71;var MZ=k(()=>{t0();Gf();g71=U.object({connectionId:U.string().optional().describe("Filter subscriptions by connection ID (optional)")}),nx6=U.object({id:U.string().describe("Subscription ID"),connectionId:U.string().describe("Subscriber connection ID"),eventType:U.string().describe("Event type pattern"),publisher:U.string().nullable().describe("Publisher connection filter (null = all publishers)"),filter:U.string().nullable().describe("JSONPath filter expression"),enabled:U.boolean().describe("Whether subscription is enabled"),createdAt:U.string().datetime().describe("Created timestamp (ISO 8601)"),updatedAt:U.string().datetime().describe("Updated timestamp (ISO 8601)")}),u71=U.object({subscriptions:U.array(nx6).describe("List of subscriptions")})});var jY0;var m71=k(()=>{$6();MZ();jY0=e0({name:"EVENT_PUBLISH",description:"Publish an event to the event bus. Supports immediate, scheduled (deliverAt), and recurring (cron) delivery. The source is automatically set to the caller's connection ID.",inputSchema:qT,outputSchema:UT,handler:async(X,Y)=>{z1(Y);let Q=_1(Y);await Y.access.check();let J=Y.connectionId;if(!J)throw Error("Connection ID required to publish events. Use a connection-scoped token.");let G=await Y.eventBus.publish(Q.id,J,{type:X.type,subject:X.subject,data:X.data,deliverAt:X.deliverAt,cron:X.cron});return{id:G.id,type:G.type,source:G.source,time:G.time}}})});var CY0;var l71=k(()=>{$6();MZ();CY0=e0({name:"EVENT_SUBSCRIBE",description:"Subscribe to events of a specific type. The subscriber is automatically set to the caller's connection.",inputSchema:zT,outputSchema:BT,handler:async(X,Y)=>{z1(Y);let Q=_1(Y);await Y.access.check();let J=Y.connectionId;if(!J)throw Error("Connection ID required to subscribe. Use a connection-scoped token.");let G=await Y.eventBus.subscribe(Q.id,{connectionId:J,eventType:X.eventType,publisher:X.publisher,filter:X.filter});return{subscription:{id:G.id,connectionId:G.connectionId,eventType:G.eventType,publisher:G.publisher,filter:G.filter,enabled:G.enabled,createdAt:G.createdAt instanceof Date?G.createdAt.toISOString():G.createdAt,updatedAt:G.updatedAt instanceof Date?G.updatedAt.toISOString():G.updatedAt}}}})});var IY0;var d71=k(()=>{$6();MZ();IY0=e0({name:"EVENT_UNSUBSCRIBE",description:"Unsubscribe from events by removing a subscription.",inputSchema:OT,outputSchema:LT,handler:async(X,Y)=>{z1(Y);let Q=_1(Y);await Y.access.check();let J=Y.connectionId;if(!J)throw Error("Connection ID required to unsubscribe. Use a connection-scoped token.");let G=await Y.eventBus.getSubscription(Q.id,X.subscriptionId);if(!G)throw Error(`Subscription not found: ${X.subscriptionId}`);if(G.connectionId!==J)throw Error("Cannot unsubscribe from a subscription owned by another connection");return{success:(await Y.eventBus.unsubscribe(Q.id,X.subscriptionId)).success,subscriptionId:X.subscriptionId}}})});var RY0;var p71=k(()=>{$6();MZ();RY0=e0({name:"EVENT_CANCEL",description:"Cancel a recurring event to stop future deliveries. Only the publisher can cancel their own events.",inputSchema:wT,outputSchema:MT,handler:async(X,Y)=>{z1(Y);let Q=_1(Y);await Y.access.check();let J=Y.connectionId;if(!J)throw Error("Connection ID required to cancel events. Use a connection-scoped token.");if(!await Y.eventBus.getEvent(Q.id,X.eventId))throw Error(`Event not found: ${X.eventId}`);if(!(await Y.eventBus.cancelEvent(Q.id,X.eventId,J)).success)throw Error("Failed to cancel event. Either the event is already completed/failed, or you are not the publisher.");return{success:!0,eventId:X.eventId}}})});var SY0;var c71=k(()=>{$6();MZ();SY0=e0({name:"EVENT_ACK",description:"Acknowledge delivery of an event. Call after successfully processing an event received via ON_EVENTS with retryAfter.",inputSchema:PT,outputSchema:TT,handler:async(X,Y)=>{z1(Y);let Q=_1(Y);await Y.access.check();let J=Y.connectionId;if(!J)throw Error("Connection ID required to acknowledge events. Use a connection-scoped token.");if(!(await Y.eventBus.ackEvent(Q.id,X.eventId,J)).success)throw Error("Failed to acknowledge event. Either the event was not found, already delivered, or you are not a subscriber.");return{success:!0,eventId:X.eventId}}})});var kY0;var n71=k(()=>{$6();MZ();kY0=e0({name:"EVENT_SUBSCRIPTION_LIST",description:"List event subscriptions, optionally filtered by connection ID.",inputSchema:g71,outputSchema:u71,handler:async(X,Y)=>{z1(Y);let Q=_1(Y);return await Y.access.check(),{subscriptions:(await Y.eventBus.listSubscriptions(Q.id,X.connectionId)).map((G)=>({id:G.id,connectionId:G.connectionId,eventType:G.eventType,publisher:G.publisher,filter:G.filter,enabled:G.enabled,createdAt:G.createdAt instanceof Date?G.createdAt.toISOString():G.createdAt,updatedAt:G.updatedAt instanceof Date?G.updatedAt.toISOString():G.updatedAt}))}}})});var vY0;var i71=k(()=>{$6();MZ();vY0=e0({name:"EVENT_SYNC_SUBSCRIPTIONS",description:"Sync subscriptions to desired state. Creates new, deletes removed, updates changed filters. Subscriptions are identified by (eventType, publisher).",inputSchema:DT,outputSchema:NT,handler:async(X,Y)=>{z1(Y);let Q=_1(Y);await Y.access.check();let J=Y.connectionId;if(!J)throw Error("Connection ID required to sync subscriptions. Use a connection-scoped token.");let G=await Y.eventBus.syncSubscriptions(Q.id,{connectionId:J,subscriptions:X.subscriptions});return{created:G.created,updated:G.updated,deleted:G.deleted,unchanged:G.unchanged,subscriptions:G.subscriptions.map((W)=>({id:W.id,connectionId:W.connectionId,eventType:W.eventType,publisher:W.publisher,filter:W.filter,enabled:W.enabled,createdAt:W.createdAt instanceof Date?W.createdAt.toISOString():W.createdAt,updatedAt:W.updatedAt instanceof Date?W.updatedAt.toISOString():W.updatedAt}))}}})});var a71=k(()=>{m71();l71();d71();p71();c71();n71();i71();MZ()});var _Y0,ax6,f7,r71,o71;var kB=k(()=>{t0();_Y0=U.enum(["inclusion","exclusion"]).describe("Tool selection mode: 'inclusion' = include selected (default), 'exclusion' = exclude selected"),ax6=U.object({connection_id:U.string().describe("Connection ID"),selected_tools:U.array(U.string()).nullable().describe("Selected tool names. With 'inclusion' mode: null = all tools included. With 'exclusion' mode: null = entire connection excluded"),selected_resources:U.array(U.string()).nullable().describe("Selected resource URIs or patterns. Supports * and ** wildcards for pattern matching. With 'inclusion' mode: null = all resources included."),selected_prompts:U.array(U.string()).nullable().describe("Selected prompt names. With 'inclusion' mode: null = all prompts included. With 'exclusion' mode: null = entire connection excluded.")}),f7=U.object({id:U.string().describe("Unique identifier for the virtual MCP"),title:U.string().describe("Human-readable name for the virtual MCP"),description:U.string().nullable().describe("Description of the virtual MCP"),icon:U.string().nullable().optional().describe("Icon URL for the virtual MCP"),created_at:U.string().describe("When the virtual MCP was created"),updated_at:U.string().describe("When the virtual MCP was last updated"),created_by:U.string().describe("User ID who created the virtual MCP"),updated_by:U.string().optional().describe("User ID who last updated the virtual MCP"),organization_id:U.string().describe("Organization ID this virtual MCP belongs to"),tool_selection_mode:_Y0.describe("Tool selection mode: 'inclusion' = include selected, 'exclusion' = exclude selected"),status:U.enum(["active","inactive"]).describe("Current status"),connections:U.array(ax6).describe("Connections with their selected tools (behavior depends on tool_selection_mode)")}),r71=U.object({title:U.string().min(1).max(255).describe("Name for the virtual MCP"),description:U.string().nullable().optional().describe("Optional description"),tool_selection_mode:_Y0.optional().default("inclusion").describe("Tool selection mode (defaults to 'inclusion')"),icon:U.string().nullable().optional().describe("Optional icon URL"),status:U.enum(["active","inactive"]).optional().default("active").describe("Initial status"),connections:U.array(U.object({connection_id:U.string().describe("Connection ID"),selected_tools:U.array(U.string()).nullable().optional().describe("Selected tool names (null/undefined = all tools or full exclusion)"),selected_resources:U.array(U.string()).nullable().optional().describe("Selected resource URIs or patterns with * and ** wildcards (null/undefined = all resources)"),selected_prompts:U.array(U.string()).nullable().optional().describe("Selected prompt names (null/undefined = all prompts or full exclusion)")})).describe("Connections to include/exclude (can be empty for exclusion mode)")}),o71=U.object({title:U.string().min(1).max(255).optional().describe("New name"),description:U.string().nullable().optional().describe("New description (null to clear)"),tool_selection_mode:_Y0.optional().describe("New tool selection mode"),icon:U.string().nullable().optional().describe("New icon URL (null to clear)"),status:U.enum(["active","inactive"]).optional().describe("New status"),connections:U.array(U.object({connection_id:U.string().describe("Connection ID"),selected_tools:U.array(U.string()).nullable().optional().describe("Selected tool names (null/undefined = all tools or full exclusion)"),selected_resources:U.array(U.string()).nullable().optional().describe("Selected resource URIs or patterns with * and ** wildcards (null/undefined = all resources)"),selected_prompts:U.array(U.string()).nullable().optional().describe("Selected prompt names (null/undefined = all prompts or full exclusion)")})).optional().describe("New connections (replaces existing)")})});var rx6,ox6,yY0;var s71=k(()=>{t0();$6();kB();rx6=U.object({data:r71.describe("Data for the new virtual MCP")}),ox6=U.object({item:f7.describe("The created virtual MCP entity")}),yY0=e0({name:"COLLECTION_VIRTUAL_MCP_CREATE",description:"Create a new MCP virtual MCP in the organization",inputSchema:rx6,outputSchema:ox6,handler:async(X,Y)=>{z1(Y);let Q=_1(Y);await Y.access.check();let J=l8(Y);if(!J)throw Error("User ID required to create virtual MCP");return{item:await Y.storage.virtualMcps.create(Q.id,J,X.data)}}})});function sx6(X){let Y=[],Q=0;while(Q<X.length){let J=X[Q];if(J==="%")Y.push(".*");else if(J==="_")Y.push(".");else if(/[.*+?^${}()|[\]\\]/.test(J))Y.push("\\"+J);else Y.push(J);Q++}return Y.join("")}function xK(X){return typeof X==="string"||typeof X==="number"}function bY0(X,Y){let Q=Y.split("."),J=X;for(let G of Q){if(J==null||typeof J!=="object")return;J=J[G]}return J}function tx6(X,Y){return X.connections.some((Q)=>Q.connection_id===Y)}function Ff(X,Y){if("conditions"in Y){let{operator:$,conditions:K}=Y;switch($){case"and":return K.every((H)=>Ff(X,H));case"or":return K.some((H)=>Ff(X,H));case"not":return!K.every((H)=>Ff(X,H));default:return!0}}let{field:Q,operator:J,value:G}=Y,W=Q.join(".");if(W==="connection_id"){if(J!=="eq"||typeof G!=="string")return!1;return tx6(X,G)}let Z=bY0(X,W);switch(J){case"eq":return Z===G;case"gt":return xK(Z)&&xK(G)&&Z>G;case"gte":return xK(Z)&&xK(G)&&Z>=G;case"lt":return xK(Z)&&xK(G)&&Z<G;case"lte":return xK(Z)&&xK(G)&&Z<=G;case"in":return Array.isArray(G)&&G.includes(Z);case"like":if(typeof Z!=="string"||typeof G!=="string")return!1;if(G.length>100)return!1;let $=sx6(G);return new RegExp(`^${$}$`,"i").test(Z);case"contains":if(typeof Z!=="string"||typeof G!=="string")return!1;return Z.toLowerCase().includes(G.toLowerCase());default:return!0}}function ex6(X,Y){return[...X].sort((Q,J)=>{for(let G of Y){let W=G.field.join("."),Z=bY0(Q,W),$=bY0(J,W),K=0;if(Z==null&&$==null)continue;if(Z==null)K=G.nulls==="first"?-1:1;else if($==null)K=G.nulls==="first"?1:-1;else if(typeof Z==="string"&&typeof $==="string")K=Z.localeCompare($);else if(typeof Z==="number"&&typeof $==="number")K=Z-$;else K=String(Z).localeCompare(String($));if(K!==0)return G.direction==="desc"?-K:K}return 0})}var Xg6,Yg6,fY0;var t71=k(()=>{QG();$6();kB();Xg6=uF,Yg6=mF(f7),fY0=e0({name:"COLLECTION_VIRTUAL_MCP_LIST",description:"List all MCP virtual MCPs in the organization",inputSchema:Xg6,outputSchema:Yg6,handler:async(X,Y)=>{await Y.access.check();let Q=_1(Y),J=X.where&&!("conditions"in X.where)&&X.where.field.join(".")==="connection_id"&&X.where.operator==="eq"&&typeof X.where.value==="string"?X.where.value:void 0,W=J?await Y.storage.virtualMcps.listByConnectionId(Q.id,J):await Y.storage.virtualMcps.list(Q.id);if(X.where)W=W.filter((V)=>Ff(V,X.where));if(X.orderBy&&X.orderBy.length>0)W=ex6(W,X.orderBy);let Z=W.length,$=X.offset??0,K=X.limit??100,H=W.slice($,$+K),F=$+K<Z;return{items:H,totalCount:Z,hasMore:F}}})});var Qg6,Jg6,hY0;var e71=k(()=>{t0();$6();kB();Qg6=U.object({id:U.string().describe("ID of the virtual MCP to retrieve")}),Jg6=U.object({item:f7.nullable().describe("The retrieved virtual MCP, or null if not found")}),hY0=e0({name:"COLLECTION_VIRTUAL_MCP_GET",description:"Get an MCP virtual MCP by ID",inputSchema:Qg6,outputSchema:Jg6,handler:async(X,Y)=>{z1(Y);let Q=_1(Y);await Y.access.check();let J=await Y.storage.virtualMcps.findById(X.id);if(J&&J.organization_id!==Q.id)return{item:null};if(!J)return{item:null};return{item:J}}})});var Gg6,Wg6,xY0;var XW1=k(()=>{t0();$6();kB();Gg6=U.object({id:U.string().describe("ID of the virtual MCP to update"),data:o71.describe("Partial virtual MCP data to update")}),Wg6=U.object({item:f7.describe("The updated virtual MCP entity")}),xY0=e0({name:"COLLECTION_VIRTUAL_MCP_UPDATE",description:"Update an MCP virtual MCP",inputSchema:Gg6,outputSchema:Wg6,handler:async(X,Y)=>{z1(Y);let Q=_1(Y);await Y.access.check();let J=l8(Y);if(!J)throw Error("User ID required to update virtual MCP");let G=await Y.storage.virtualMcps.findById(X.id);if(!G)throw Error(`Virtual MCP not found: ${X.id}`);if(G.organization_id!==Q.id)throw Error(`Virtual MCP not found: ${X.id}`);return{item:await Y.storage.virtualMcps.update(X.id,J,X.data)}}})});var Zg6,$g6,gY0;var YW1=k(()=>{t0();$6();kB();Zg6=U.object({id:U.string().describe("ID of the virtual MCP to delete")}),$g6=U.object({item:f7.describe("The deleted virtual MCP entity")}),gY0=e0({name:"COLLECTION_VIRTUAL_MCP_DELETE",description:"Delete an MCP virtual MCP",inputSchema:Zg6,outputSchema:$g6,handler:async(X,Y)=>{z1(Y);let Q=_1(Y);await Y.access.check();let J=await Y.storage.virtualMcps.findById(X.id);if(!J)throw Error(`Virtual MCP not found: ${X.id}`);if(J.organization_id!==Q.id)throw Error(`Virtual MCP not found: ${X.id}`);return await Y.storage.virtualMcps.delete(X.id),{item:J}}})});var QW1=k(()=>{s71();t71();e71();XW1();YW1()});var Hg6,uY0;var JW1=k(()=>{$6();t0();Hg6=U.object({id:U.string().optional().describe("Unique log identifier"),organizationId:U.string().describe("Organization ID"),connectionId:U.string().describe("Connection ID"),connectionTitle:U.string().describe("Connection display name"),toolName:U.string().describe("Name of the tool that was called"),input:U.record(U.string(),U.unknown()).describe("Redacted tool input"),output:U.record(U.string(),U.unknown()).describe("Redacted tool output"),isError:U.boolean().describe("Whether the call resulted in an error"),errorMessage:U.string().nullish().describe("Error message if applicable"),durationMs:U.number().describe("Call duration in milliseconds"),timestamp:U.string().describe("ISO 8601 timestamp of the call"),userId:U.string().nullish().describe("User who triggered the call"),requestId:U.string().describe("Unique request identifier"),userAgent:U.string().nullish().describe("Client identifier (x-mesh-client header)"),virtualMcpId:U.string().nullish().describe("Virtual MCP (Agent) ID if routed through an agent"),properties:U.record(U.string(),U.string()).nullish().describe("Custom key-value metadata attached to the log")}),uY0=e0({name:"MONITORING_LOGS_LIST",description:"List monitoring logs for tool calls in the organization",inputSchema:U.object({connectionId:U.string().optional().describe("Filter by connection ID"),virtualMcpId:U.string().optional().describe("Filter by Virtual MCP (Agent) ID"),toolName:U.string().optional().describe("Filter by tool name"),isError:U.boolean().optional().describe("Filter by error status"),startDate:U.string().datetime().optional().describe("Filter by start date (ISO 8601 datetime string)"),endDate:U.string().datetime().optional().describe("Filter by end date (ISO 8601 datetime string)"),limit:U.number().default(100).describe("Maximum number of results"),offset:U.number().default(0).describe("Offset for pagination"),properties:U.record(U.string(),U.string()).optional().describe("Filter by exact property key=value matches"),propertyKeys:U.array(U.string()).optional().describe("Filter by logs that have these property keys"),propertyPatterns:U.record(U.string(),U.string()).optional().describe("Filter by property value patterns (SQL LIKE, use % as wildcard)")}),outputSchema:U.object({logs:U.array(Hg6).describe("Array of monitoring logs"),total:U.number().describe("Total number of logs matching filters"),offset:U.number().describe("Current offset for pagination"),limit:U.number().describe("Current limit for pagination")}),handler:async(X,Y)=>{let Q=_1(Y),G=X.properties||X.propertyKeys||X.propertyPatterns?{properties:X.properties,propertyKeys:X.propertyKeys,propertyPatterns:X.propertyPatterns}:void 0,W={organizationId:Q.id,connectionId:X.connectionId,virtualMcpId:X.virtualMcpId,toolName:X.toolName,isError:X.isError,startDate:X.startDate?new Date(X.startDate):void 0,endDate:X.endDate?new Date(X.endDate):void 0,limit:X.limit,offset:X.offset,propertyFilters:G},Z=await Y.storage.monitoring.query(W);return{logs:Z.logs.map(($)=>({...$,timestamp:$.timestamp instanceof Date?$.timestamp.toISOString():$.timestamp})),total:Z.total,offset:X.offset,limit:X.limit}}})});var mY0;var GW1=k(()=>{$6();t0();mY0=e0({name:"MONITORING_STATS",description:"Get aggregated statistics for tool call monitoring",inputSchema:U.object({startDate:U.string().datetime().optional().describe("Filter by start date (ISO 8601 datetime string)"),endDate:U.string().datetime().optional().describe("Filter by end date (ISO 8601 datetime string)")}),outputSchema:U.object({totalCalls:U.number().describe("Total number of tool calls"),errorRate:U.number().describe("Error rate as a decimal (0 to 1)"),avgDurationMs:U.number().describe("Average call duration in milliseconds"),errorRatePercent:U.string().describe("Error rate as a percentage string")}),handler:async(X,Y)=>{let J={organizationId:_1(Y).id,startDate:X.startDate?new Date(X.startDate):void 0,endDate:X.endDate?new Date(X.endDate):void 0},G=await Y.storage.monitoring.getStats(J);return{...G,errorRatePercent:(G.errorRate*100).toFixed(2)}}})});var WW1=k(()=>{JW1();GW1()});var lY0;var ZW1=k(()=>{t0();$6();lY0=e0({name:"ORGANIZATION_CREATE",description:"Create a new organization",inputSchema:U.object({slug:U.string().min(1).max(50).regex(/^[a-z0-9-]+$/,"Slug must be lowercase alphanumeric with hyphens"),name:U.string().min(1).max(255),description:U.string().optional()}),outputSchema:U.object({id:U.string(),name:U.string(),slug:U.string(),logo:U.string().nullable().optional(),metadata:U.any().optional(),createdAt:U.string().datetime().describe("ISO 8601 timestamp"),members:U.array(U.any()).optional()}),handler:async(X,Y)=>{z1(Y),await Y.access.check();let Q=l8(Y);if(!Q)throw Error("User ID required to create organization");let J=await Y.boundAuth.organization.create({name:X.name,slug:X.slug,metadata:X.description?{description:X.description}:void 0,userId:Q});if(!J)throw Error("Failed to create organization");return{...J,createdAt:J.createdAt instanceof Date?J.createdAt.toISOString():J.createdAt}}})});var dY0;var $W1=k(()=>{t0();$6();dY0=e0({name:"ORGANIZATION_LIST",description:"List all organizations user has access to",inputSchema:U.object({userId:U.string().optional()}),outputSchema:U.object({organizations:U.array(U.object({id:U.string(),name:U.string(),slug:U.string(),logo:U.string().nullable().optional(),metadata:U.any().optional(),createdAt:U.string().datetime().describe("ISO 8601 timestamp")}))}),handler:async(X,Y)=>{z1(Y),await Y.access.check();let Q=l8(Y),J=X.userId||Q;if(!J)throw Error("User ID required to list organizations");return{organizations:(await Y.boundAuth.organization.list(J)).map((W)=>({...W,createdAt:W.createdAt instanceof Date?W.createdAt.toISOString():W.createdAt}))}}})});var pY0;var KW1=k(()=>{t0();$6();pY0=e0({name:"ORGANIZATION_GET",description:"Get organization details by slug or ID",inputSchema:U.object({}),outputSchema:U.object({id:U.string(),name:U.string(),slug:U.string(),logo:U.string().nullable().optional(),metadata:U.any().optional(),createdAt:U.string().datetime().describe("ISO 8601 timestamp"),members:U.array(U.any()).optional(),invitations:U.array(U.any()).optional()}),handler:async(X,Y)=>{z1(Y),await Y.access.check();let Q=await Y.boundAuth.organization.get();if(!Q)throw Error("No active organization found");let J=new Date,G=Q.invitations?.filter((W)=>new Date(W.expiresAt)>J);return{...Q,invitations:G,createdAt:Q.createdAt instanceof Date?Q.createdAt.toISOString():Q.createdAt}}})});var cY0;var HW1=k(()=>{t0();$6();cY0=e0({name:"ORGANIZATION_UPDATE",description:"Update an existing organization",inputSchema:U.object({id:U.string(),slug:U.string().min(1).max(50).regex(/^[a-z0-9-]+$/).optional(),name:U.string().min(1).max(255).optional(),description:U.string().optional()}),outputSchema:U.object({id:U.string(),name:U.string(),slug:U.string(),logo:U.string().nullable().optional(),metadata:U.any().optional(),createdAt:U.string().datetime().describe("ISO 8601 timestamp")}),handler:async(X,Y)=>{z1(Y),await Y.access.check();let Q={};if(X.name)Q.name=X.name;if(X.slug)Q.slug=X.slug;if(X.description)Q.metadata={description:X.description};let J=await Y.boundAuth.organization.update({organizationId:X.id,data:Q});if(!J)throw Error("Failed to update organization");return{...J,createdAt:J.createdAt instanceof Date?J.createdAt.toISOString():J.createdAt}}})});var nY0;var FW1=k(()=>{t0();$6();nY0=e0({name:"ORGANIZATION_DELETE",description:"Delete an organization",inputSchema:U.object({id:U.string()}),outputSchema:U.object({success:U.boolean(),id:U.string()}),handler:async(X,Y)=>{return z1(Y),await Y.access.check(),await Y.boundAuth.organization.delete(X.id),{success:!0,id:X.id}}})});var ET;var iY0=k(()=>{t0();ET=U.object({title:U.string(),url:U.string(),icon:U.string()})});var aY0;var VW1=k(()=>{t0();$6();iY0();aY0=e0({name:"ORGANIZATION_SETTINGS_GET",description:"Get organization-level settings",inputSchema:U.object({}),outputSchema:U.object({organizationId:U.string(),sidebar_items:U.array(ET).nullable().optional(),enabled_plugins:U.array(U.string()).nullable().optional(),createdAt:U.string().datetime().optional().describe("ISO 8601 timestamp"),updatedAt:U.string().datetime().optional().describe("ISO 8601 timestamp")}),handler:async(X,Y)=>{z1(Y),await Y.access.check();let Q=Y.organization?.id;if(!Q)throw Error("Organization ID required (no active organization in context)");let J=await Y.storage.organizationSettings.get(Q);if(!J)return{organizationId:Q};return{...J,createdAt:J.createdAt instanceof Date?J.createdAt.toISOString():J.createdAt,updatedAt:J.updatedAt instanceof Date?J.updatedAt.toISOString():J.updatedAt}}})});var rY0;var qW1=k(()=>{t0();$6();iY0();rY0=e0({name:"ORGANIZATION_SETTINGS_UPDATE",description:"Update organization-level settings",inputSchema:U.object({organizationId:U.string(),sidebar_items:U.array(ET).optional(),enabled_plugins:U.array(U.string()).optional()}),outputSchema:U.object({organizationId:U.string(),sidebar_items:U.array(ET).nullable().optional(),enabled_plugins:U.array(U.string()).nullable().optional(),createdAt:U.string().datetime().describe("ISO 8601 timestamp"),updatedAt:U.string().datetime().describe("ISO 8601 timestamp")}),handler:async(X,Y)=>{if(z1(Y),await Y.access.check(),Y.organization&&Y.organization.id!==X.organizationId)throw Error("Cannot update settings for a different organization");let Q=await Y.storage.organizationSettings.upsert(X.organizationId,{sidebar_items:X.sidebar_items,enabled_plugins:X.enabled_plugins});return{...Q,createdAt:Q.createdAt instanceof Date?Q.createdAt.toISOString():Q.createdAt,updatedAt:Q.updatedAt instanceof Date?Q.updatedAt.toISOString():Q.updatedAt}}})});var oY0;var UW1=k(()=>{t0();$6();oY0=e0({name:"ORGANIZATION_MEMBER_ADD",description:"Add a member to an organization",inputSchema:U.object({organizationId:U.string().optional(),userId:U.string(),role:U.array(U.string())}),outputSchema:U.object({id:U.string(),organizationId:U.string(),userId:U.string(),role:U.union([U.string(),U.array(U.string())]),createdAt:U.string().datetime().describe("ISO 8601 timestamp")}),handler:async(X,Y)=>{z1(Y),await Y.access.check();let Q=X.organizationId||Y.organization?.id;if(!Q)throw Error("Organization ID required (no active organization in context)");let J=await Y.boundAuth.organization.addMember({organizationId:Q,userId:X.userId,role:X.role});if(!J)throw Error("Failed to add member");return{...J,role:J.role,createdAt:J.createdAt instanceof Date?J.createdAt.toISOString():J.createdAt}}})});var sY0;var zW1=k(()=>{t0();$6();sY0=e0({name:"ORGANIZATION_MEMBER_REMOVE",description:"Remove a member from an organization",inputSchema:U.object({organizationId:U.string().optional(),memberIdOrEmail:U.string()}),outputSchema:U.object({success:U.boolean(),memberIdOrEmail:U.string()}),handler:async(X,Y)=>{z1(Y),await Y.access.check();let Q=X.organizationId||Y.organization?.id;if(!Q)throw Error("Organization ID required (no active organization in context)");return await Y.boundAuth.organization.removeMember({organizationId:Q,memberIdOrEmail:X.memberIdOrEmail}),{success:!0,memberIdOrEmail:X.memberIdOrEmail}}})});var tY0;var BW1=k(()=>{t0();$6();tY0=e0({name:"ORGANIZATION_MEMBER_LIST",description:"List all members in an organization",inputSchema:U.object({limit:U.number().optional(),offset:U.number().optional()}),outputSchema:U.object({members:U.array(U.object({id:U.string(),organizationId:U.string(),userId:U.string(),role:U.string(),createdAt:U.string().datetime().describe("ISO 8601 timestamp"),user:U.object({id:U.string(),name:U.string(),email:U.string(),image:U.string().optional()}).optional()}))}),handler:async(X,Y)=>{z1(Y),await Y.access.check();let Q=Y.organization?.id;if(!Q)throw Error("Organization ID required (no active organization in context)");let J=await Y.boundAuth.organization.listMembers({organizationId:Q,limit:X.limit,offset:X.offset});return{members:(Array.isArray(J)?J:[]).map((W)=>({...W,createdAt:W.createdAt instanceof Date?W.createdAt.toISOString():W.createdAt}))}}})});var eY0;var DW1=k(()=>{t0();$6();eY0=e0({name:"ORGANIZATION_MEMBER_UPDATE_ROLE",description:"Update a member's role in an organization",inputSchema:U.object({organizationId:U.string().optional(),memberId:U.string(),role:U.array(U.string())}),outputSchema:U.object({id:U.string(),organizationId:U.string(),userId:U.string(),role:U.union([U.literal("admin"),U.literal("member"),U.literal("owner")]),createdAt:U.string().datetime().describe("ISO 8601 timestamp"),user:U.object({email:U.string(),name:U.string(),image:U.string().optional()})}),handler:async(X,Y)=>{z1(Y),await Y.access.check();let Q=X.organizationId||Y.organization?.id;if(!Q)throw Error("Organization ID required (no active organization in context)");let J=await Y.boundAuth.organization.updateMemberRole({organizationId:Q,memberId:X.memberId,role:X.role});if(!J)throw Error("Failed to update member role");return{...J,createdAt:J.createdAt instanceof Date?J.createdAt.toISOString():J.createdAt}}})});var NW1=k(()=>{ZW1();$W1();KW1();HW1();FW1();VW1();qW1();UW1();zW1();BW1();DW1()});var OW1,h7,LW1,wW1;var lF=k(()=>{t0();OW1=U.object({id:U.string().describe("Unique message ID"),threadId:U.string().describe("ID of the parent thread"),metadata:U.unknown().optional().describe("Optional message metadata"),parts:U.array(U.record(U.string(),U.unknown())).describe("Message content parts (AI SDK UIMessagePart format)"),role:U.enum(["user","assistant","system"]).describe("Message role"),createdAt:U.string().datetime().describe("Timestamp of creation"),updatedAt:U.string().datetime().describe("Timestamp of last update")}),h7=U.object({id:U.string().describe("Unique thread ID"),organizationId:U.string().describe("Organization this thread belongs to"),title:U.string().describe("Thread title"),description:U.string().nullable().describe("Thread description"),createdAt:U.string().datetime().describe("Timestamp of creation"),updatedAt:U.string().datetime().describe("Timestamp of last update"),hidden:U.boolean().optional().describe("Whether the thread is hidden"),createdBy:U.string().describe("User ID who created the thread"),updatedBy:U.string().nullable().describe("User ID who last updated the thread")}),LW1=U.object({id:U.string().optional().describe("Optional custom ID for the thread"),title:U.string().describe("Thread title"),description:U.string().nullish().describe("Thread description")}),wW1=U.object({title:U.string().optional().describe("New thread title"),description:U.string().nullish().describe("New thread description"),hidden:U.boolean().optional().describe("Whether the thread is hidden")})});var qg6,Ug6,X90;var MW1=k(()=>{t0();$6();lF();QZ();qg6=U.object({data:LW1.describe("Data for the new thread (id is auto-generated if not provided)")}),Ug6=U.object({item:h7.describe("The created thread entity")}),X90=e0({name:"COLLECTION_THREADS_CREATE",description:"Create a new thread in the organization",inputSchema:qg6,outputSchema:Ug6,handler:async(X,Y)=>{z1(Y);let Q=_1(Y);await Y.access.check();let J=l8(Y);if(!J)throw Error("User ID required to create thread");let G=X.data.id??QX("thrd"),W=await Y.storage.threads.create({id:G,organizationId:Q.id,title:X.data.title,description:X.data.description,createdBy:J});return{item:{...W,hidden:W.hidden??!1}}}})});var zg6,Bg6,Y90;var PW1=k(()=>{QG();$6();lF();t0();zg6=uF.extend({where:U.object({created_by:U.string().optional()}).optional()}),Bg6=mF(h7),Y90=e0({name:"COLLECTION_THREADS_LIST",description:"List all threads in the organization with filtering, sorting, and pagination",inputSchema:zg6,outputSchema:Bg6,handler:async(X,Y)=>{await Y.access.check();let Q=Y.auth.user?.id;if(!Q)throw Error("User ID required to list threads");let J=_1(Y),G=X.offset??0,W=X.limit??100,{threads:Z,total:$}=await Y.storage.threads.list(J.id,Q,{limit:W,offset:G}),K=G+W<$;return{items:Z.map((H)=>({...H,hidden:H.hidden??!1})),totalCount:$,hasMore:K}}})});var Dg6,Q90;var TW1=k(()=>{QG();$6();lF();Dg6=HT(h7),Q90=e0({name:"COLLECTION_THREADS_GET",description:"Get thread details by ID",inputSchema:KT,outputSchema:Dg6,handler:async(X,Y)=>{z1(Y);let Q=_1(Y);await Y.access.check();let J=await Y.storage.threads.get(X.id);if(!J||J.organizationId!==Q.id)return{item:null};return{item:{...J,hidden:J.hidden??!1}}}})});var Ng6,Og6,J90;var AW1=k(()=>{t0();$6();lF();Ng6=U.object({id:U.string().describe("ID of the thread to update"),data:wW1.describe("Partial thread data to update")}),Og6=U.object({item:h7.describe("The updated thread entity")}),J90=e0({name:"COLLECTION_THREADS_UPDATE",description:"Update an existing thread in the organization",inputSchema:Ng6,outputSchema:Og6,handler:async(X,Y)=>{z1(Y);let Q=_1(Y);await Y.access.check();let J=l8(Y);if(!J)throw Error("User ID required to update thread");let{id:G,data:W}=X,Z=await Y.storage.threads.get(G);if(!Z||Z.organizationId!==Q.id)throw Error("Thread not found in organization");let $=await Y.storage.threads.update(G,{title:W.title,description:W.description,hidden:W.hidden,updatedBy:J});return{item:{...$,hidden:$.hidden??!1}}}})});var G90;var EW1=k(()=>{QG();$6();lF();G90=e0({name:"COLLECTION_THREADS_DELETE",description:"Delete a thread",inputSchema:FT,outputSchema:VT(h7),handler:async(X,Y)=>{z1(Y);let Q=_1(Y);await Y.access.check();let J=await Y.storage.threads.get(X.id);if(!J)throw Error(`Thread not found: ${X.id}`);if(J.organizationId!==Q.id)throw Error(`Thread not found: ${X.id}`);return await Y.storage.threads.delete(X.id),{item:{...J,hidden:J.hidden??!1}}}})});var Lg6,wg6,W90;var jW1=k(()=>{t0();$6();lF();Lg6=U.object({threadId:U.string().describe("ID of the thread to list messages for"),limit:U.number().optional().describe("Maximum number of messages to return"),offset:U.number().optional().describe("Number of messages to skip")}),wg6=U.object({items:U.array(OW1).describe("List of thread messages"),totalCount:U.number().describe("Total number of messages in the thread"),hasMore:U.boolean().describe("Whether there are more messages available")}),W90=e0({name:"COLLECTION_THREAD_MESSAGES_LIST",description:"List all messages for a specific thread",inputSchema:Lg6,outputSchema:wg6,handler:async(X,Y)=>{let Q=_1(Y);await Y.access.check();let J=await Y.storage.threads.get(X.threadId);if(!J||J.organizationId!==Q.id)throw Error("Thread not found in organization");let G=X.offset??0,W=X.limit??100,{messages:Z,total:$}=await Y.storage.threads.listMessages(X.threadId,{limit:W,offset:G}),K=G+W<$;return{items:Z,totalCount:$,hasMore:K}}})});var CW1=k(()=>{MW1();PW1();TW1();AW1();EW1();jW1()});var Pg6,Tg6,Z90;var IW1=k(()=>{t0();$6();Pg6=U.object({id:U.string().min(1)}),Tg6=U.object({user:U.object({id:U.string(),name:U.string(),email:U.string(),image:U.string().nullable()}).nullable()}),Z90=e0({name:"USER_GET",description:"Get a user by id (restricted to shared organizations)",inputSchema:Pg6,outputSchema:Tg6,handler:async(X,Y)=>{await Y.access.check(),z1(Y);let Q=l8(Y);if(!Q)throw Error("Authentication required");let J=await Y.storage.users.findById(X.id,Q);if(!J)return{user:null};return{user:{id:J.id,name:J.name,email:J.email,image:J.image??null}}}})});var RW1=k(()=>{IW1()});var kW1={};s1(kW1,{managementMCP:()=>$90,ALL_TOOLS:()=>SW1});var SW1,$90=(X)=>{let Y=SW1.map((J)=>({name:J.name,description:J.description,inputSchema:J.inputSchema,outputSchema:J.outputSchema,handler:async(G)=>{return X.access.setToolName(J.name),await J.execute(G,X)}}));return h51({name:"mcp-mesh-management",version:"1.0.0"}).withTools(Y).build()};var K90=k(()=>{x51();t51();dG1();y71();x71();a71();QW1();WW1();NW1();CW1();RW1();SW1=[lY0,dY0,pY0,cY0,nY0,aY0,rY0,oY0,sY0,tY0,eY0,FY0,LY0,wY0,TY0,AY0,EY0,yY0,fY0,hY0,xY0,gY0,h71,uY0,mY0,xX0,uX0,mX0,gX0,jY0,CY0,IY0,RY0,SY0,kY0,vY0,Z90,$Y0,KY0,HY0,X90,Y90,Q90,J90,G90,W90]});function Eg6(X){return[{permissions:{self:["*"]},getTools:async()=>{let{ALL_TOOLS:Y}=await Promise.resolve().then(() => (K90(),kW1));return Y.map((Q)=>{return{name:Q.name,inputSchema:U.toJSONSchema(Q.inputSchema,{unrepresentable:"any"}),outputSchema:Q.outputSchema?U.toJSONSchema(Q.outputSchema,{unrepresentable:"any"}):void 0,description:Q.description}})},data:$41(process.env.BASE_URL||"http://localhost:3000")},{data:Z41()},{data:W41(X)}]}async function vW1(X,Y){try{let Q=NF(),J=new iM(process.env.ENCRYPTION_KEY||""),G=new aM(Q.db,J),W=Eg6(X);await Promise.all(W.map(async(Z)=>{let $=null;if(Z.permissions)$=(await JG.api.createApiKey({body:{name:`${Z.data.app_name??crypto.randomUUID()}-mcp`,userId:Y,permissions:Z.permissions,rateLimitEnabled:!1,metadata:{organization:{id:X},purpose:"default-org-connections"}}}))?.key;let K=await Z.getTools?.()??await MB({id:"pending",title:Z.data.title,connection_type:Z.data.connection_type,connection_url:Z.data.connection_url,connection_token:Z.data.connection_token,connection_headers:Z.data.connection_headers}).catch(()=>null),H=Z.data.id?Z.data.id.startsWith(`${X}_`)?Z.data.id:`${X}_${Z.data.id}`:void 0;await G.create({...Z.data,id:H,tools:K,organization_id:X,created_by:Y,connection_token:Z.data.connection_token??$})}))}catch(Q){console.error("Error creating default MCP connections:",Q)}}var _W1=k(()=>{qK();cM();I60();R60();db();t0();vB()});var H90,yW1;var F90=k(()=>{H90=["owner","admin","user"],yW1=["owner","admin"]});var jg6=(X)=>{return{defaultSSO:[{domain:X.domain,providerId:X.providerId,oidcConfig:{issuer:`https://login.microsoftonline.com/${X.MS_TENANT_ID}/v2.0`,pkce:!0,clientId:X.MS_CLIENT_ID,clientSecret:X.MS_CLIENT_SECRET,discoveryEndpoint:`https://login.microsoftonline.com/${X.MS_TENANT_ID}/v2.0/.well-known/openid-configuration`,authorizationEndpoint:`https://login.microsoftonline.com/${X.MS_TENANT_ID}/oauth2/v2.0/authorize`,tokenEndpoint:`https://login.microsoftonline.com/${X.MS_TENANT_ID}/oauth2/v2.0/token`,jwksEndpoint:`https://login.microsoftonline.com/${X.MS_TENANT_ID}/discovery/v2.0/keys`,userInfoEndpoint:"https://graph.microsoft.com/oidc/userinfo",tokenEndpointAuthentication:"client_secret_post",scopes:X.scopes,mapping:{id:"sub",email:"email",emailVerified:"email_verified",name:"name",image:"picture",extraFields:{emailVerified:"email_verified"}}}}]}},bW1=(X)=>{if(X.providerId==="microsoft")return jg6(X);throw Error(`Unsupported provider: ${X.providerId}`)};function Cg6(X){return X.toLowerCase().trim().replace(/[^a-z0-9\s_-]+/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}function Ig6(){let X=Math.floor(Math.random()*hW1.length),Y=Math.floor(Math.random()*fW1.length),Q=hW1[X]??"deco",J=fW1[Y]??"studio";return`${Q}-${J}`}var fW1,hW1,Rg6,Sg6,Vf,kg6,vg6,_g6,xW1,GX,gW1=void 0,yg6,bg6,fg6,JG;var vB=k(()=>{Ld();AB0();FN0();Ki();ka();QO0();ES();FO0();cM();C60();Q41();_W1();F90();fW1=["labs","agent","studio","workspace","systems","core","cloud","works"],hW1=["capybara","guarana","deco","samba","feijoada","capoeira","carnival"];Rg6=Object.values(QO()).map((X)=>X.map((Y)=>Y.name)).flat(),Sg6={...HS,self:["*",...Rg6]},Vf=J7(Sg6),kg6=Vf.newRole({self:["*"],...yL.statements}),vg6=Vf.newRole({self:["*"],...yL.statements}),_g6=Vf.newRole({self:["*"],...yL.statements}),xW1=Object.values(QO()).map((X)=>X.map((Y)=>`self:${Y.name}`)).flat(),GX=dL.auth;if(GX.inviteEmailProviderId&&GX.emailProviders&&GX.emailProviders.length>0){let X=o_(GX.emailProviders,GX.inviteEmailProviderId);if(X){let Y=r_(X);gW1=async(Q)=>{let J=Q.inviter.user?.name||Q.inviter.user?.email,G=`${process.env.BASE_URL||"http://localhost:3000"}/auth/accept-invitation?invitationId=${Q.invitation.id}`;await Y({to:Q.email,subject:`Invitation to join ${Q.organization.name}`,html:`
|
|
1145
1145
|
<h2>You've been invited!</h2>
|
|
1146
1146
|
<p>${J} has invited you to join <strong>${Q.organization.name}</strong>.</p>
|
|
1147
1147
|
<p><a href="${G}">Click here to accept the invitation</a></p>
|