import{n as e}from"./chunk-DR8-3Aex.js";import{Ln as t,Mn as n,Tt as r,un as i,vt as a,wn as o}from"./schemas-BGAvj1T4.js";import{t as s}from"./v4-f1i_CNUT.js";import{cn as c,y as l}from"./state-sIHsFpDu.js";import{S as u,_ as d}from"./paths-Ci1iwL5Y.js";import{E as f,et as p}from"./log-DSV4Ht5l.js";import{n as m,t as h}from"./lazySchema-B0QShMaQ.js";import{i as g,n as _,o as v,p as y,r as b}from"./xml-CVF7dWfi.js";function x(){let e=d(`tengu_harbor_ledger`,[]),t=w().safeParse(e);return t.success?t.data:[]}function S(){return!0}function C(e){if(!e)return!1;let{name:t,marketplace:n}=v(e);return n?n===`builtin`&&t===`weixin`?!0:x().some(e=>e.plugin===t&&e.marketplace===n):!1}var w,T=e((()=>{s(),y(),h(),g(),u(),w=m(()=>r(o({marketplace:t(),plugin:t()})))}));function E(e,t,n){let r=Object.entries(n??{}).filter(([e])=>P.test(e)).map(([e,t])=>` ${e}="${_(t)}"`).join(``);return`<${f} source="${_(e)}"${r}>\n${t}\n</${f}>`}function D(e,t){let n=e.split(`:`);return t.find(t=>t.kind===`server`?e===t.name:n[0]===`plugin`&&n[1]===t.name)}function O(e,t,n){if(!t?.experimental?.[`claude/channel`])return{action:`skip`,kind:`capability`,reason:`server did not declare claude/channel capability`};let r=D(e,l());if(!r)return{action:`skip`,kind:`session`,reason:`server ${e} not in --channels list for this session`};if(r.kind===`plugin`){let e=n?v(n).marketplace:void 0;if(e!==r.marketplace)return{action:`skip`,kind:`marketplace`,reason:`you asked for plugin:${r.name}@${r.marketplace} but the installed ${r.name} plugin is from ${e??`an unknown source`}`}}return{action:`register`}}var k,A,j,M,N,P,F=e((()=>{s(),c(),p(),h(),g(),b(),T(),k=m(()=>o({method:i(`notifications/claude/channel`),params:o({content:t(),meta:n(t(),t()).optional()})})),A=`notifications/claude/channel/permission`,j=m(()=>o({method:i(A),params:o({request_id:t(),behavior:a([`allow`,`deny`])})})),M=`notifications/claude/channel/permission_request`,N=m(()=>o({method:i(M),params:o({request_id:t(),tool_name:t(),description:t(),input_preview:t(),channel_context:o({source_server:t().optional(),chat_id:t().optional()}).optional()})})),P=/^[a-zA-Z_][a-zA-Z0-9_]*$/}));export{N as a,F as c,C as d,S as f,j as i,E as l,M as n,D as o,k as r,O as s,A as t,T as u};