@bkm016/basalt 0.1.10 → 0.1.12

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.
Files changed (230) hide show
  1. package/{chunk-755sy11p.js → chunk-01nve4qy.js} +1 -1
  2. package/{chunk-jtsve11b.js → chunk-0fc9apfn.js} +9 -9
  3. package/{chunk-d5j74pcp.js → chunk-1h34mzh7.js} +4 -4
  4. package/{chunk-fgwda4m0.js → chunk-1xfv4bd7.js} +1 -1
  5. package/{chunk-mbpb5c7w.js → chunk-2fyjph3f.js} +1 -1
  6. package/{chunk-13gvs0ax.js → chunk-2kxnw7vs.js} +1 -1
  7. package/{chunk-95964592.js → chunk-37zystxb.js} +11 -11
  8. package/{chunk-h1kb8b49.js → chunk-3pf1d62g.js} +2 -2
  9. package/{chunk-29qrxygd.js → chunk-5wnmbc1b.js} +2 -2
  10. package/{chunk-c71173py.js → chunk-6mges89p.js} +4 -4
  11. package/{chunk-d0a1jxk5.js → chunk-6sz5q3df.js} +2 -2
  12. package/chunk-7er5pz7s.js +479 -0
  13. package/{chunk-gbjn6d81.js → chunk-7g5smgjj.js} +1 -1
  14. package/chunk-7m3jagqn.js +2 -0
  15. package/{chunk-wnzvnskb.js → chunk-85v69h91.js} +2 -2
  16. package/{chunk-38g3gctw.js → chunk-9c4gdg1q.js} +2 -2
  17. package/{chunk-en218k4y.js → chunk-cbgpymt4.js} +1 -1
  18. package/{chunk-a1rb1a48.js → chunk-cdw03j4t.js} +2 -2
  19. package/chunk-ch1r3ted.js +2 -0
  20. package/{chunk-dfh9m9n7.js → chunk-db7ws33a.js} +2 -2
  21. package/{chunk-1n7dat03.js → chunk-ejjem0tc.js} +3 -3
  22. package/{chunk-c4qr1f41.js → chunk-eq4wqxzt.js} +2 -2
  23. package/{chunk-zc9ar0r4.js → chunk-eyrtbbdd.js} +1 -1
  24. package/{chunk-r4ttdkrz.js → chunk-fhxy6y34.js} +2 -2
  25. package/{chunk-zyyzk5ha.js → chunk-fy82qxa1.js} +1 -1
  26. package/{chunk-xtq1xpq0.js → chunk-hc300148.js} +1 -1
  27. package/{chunk-vtqr7dm8.js → chunk-j64dc767.js} +2 -2
  28. package/{chunk-msm9hmk9.js → chunk-jpnf71q7.js} +2 -2
  29. package/{chunk-q9f4xb0w.js → chunk-kpe7pnhy.js} +4 -4
  30. package/{chunk-a98wma9j.js → chunk-ksk49hv0.js} +1 -1
  31. package/{chunk-bdjr0kfr.js → chunk-m4bg1apa.js} +5 -5
  32. package/{chunk-dq01v5eq.js → chunk-nhm9z3d8.js} +1 -1
  33. package/{chunk-30rjf7my.js → chunk-ntks40jd.js} +2 -2
  34. package/{chunk-a1352w87.js → chunk-nw1xpt3s.js} +1 -1
  35. package/{chunk-xh444pfn.js → chunk-p2pmdbt2.js} +8 -8
  36. package/{chunk-hb4f2v34.js → chunk-qfcr5g35.js} +2 -2
  37. package/{chunk-n2jcx65v.js → chunk-qs8zzg50.js} +2 -2
  38. package/{chunk-qaeyhe65.js → chunk-r4gm8ngh.js} +1 -1
  39. package/{chunk-pz2afna8.js → chunk-rks90mh1.js} +1 -1
  40. package/{chunk-asyr3gnq.js → chunk-rwks9zaw.js} +2 -2
  41. package/{chunk-v3ee9z3f.js → chunk-t7te60m7.js} +1 -1
  42. package/{chunk-4dw43syb.js → chunk-tv52xajf.js} +1 -1
  43. package/{chunk-c0zfefq8.js → chunk-v7wcchy2.js} +1 -1
  44. package/{chunk-tevejprz.js → chunk-vjne04dp.js} +3 -3
  45. package/{chunk-ax04trym.js → chunk-w0rr66z7.js} +1 -1
  46. package/{chunk-gkf5jwvj.js → chunk-w6f2r052.js} +1 -1
  47. package/{chunk-0mjb3sm3.js → chunk-wqqjzsjt.js} +327 -282
  48. package/{chunk-c6q04xrd.js → chunk-xef4642x.js} +1 -1
  49. package/compiled.js +7 -7
  50. package/package.json +1 -1
  51. package/ui-test-worker.js +2 -2
  52. package/web/chunk-04drx71p.js +1 -0
  53. package/web/chunk-0mdf1qja.js +1 -0
  54. package/web/chunk-0rdgt4jb.css +1 -0
  55. package/web/{chunk-nawxgz87.js → chunk-19zd0tye.js} +8 -8
  56. package/web/chunk-1m0kp0g3.js +8 -0
  57. package/web/{chunk-07agqp8h.js → chunk-1zwc09e8.js} +2 -2
  58. package/web/{chunk-fmmrthpa.js → chunk-2cyzaqjy.js} +3 -3
  59. package/web/{chunk-vasppf6b.js → chunk-2jfesv7m.js} +2 -2
  60. package/web/{chunk-mykrm8ba.js → chunk-30aeb767.js} +2 -2
  61. package/web/chunk-3j2tcphs.js +1 -0
  62. package/web/chunk-3k9h7a73.js +1142 -0
  63. package/web/chunk-3m1bb2fw.js +1 -0
  64. package/web/{chunk-88wd49xe.js → chunk-3n9ypydh.js} +2 -2
  65. package/web/{chunk-sd3xat3r.js → chunk-3psgr0q8.js} +13 -13
  66. package/web/{chunk-yppgejg7.js → chunk-3qxxrwsp.js} +10 -10
  67. package/web/{chunk-js6kb05s.js → chunk-3rkkp6ed.js} +6 -6
  68. package/web/{chunk-tqze6d6b.js → chunk-4f6a8dsk.js} +1 -1
  69. package/web/{chunk-eqndhs21.js → chunk-4wwd3pfz.js} +2 -2
  70. package/web/chunk-55nvm2mj.js +1 -0
  71. package/web/chunk-5dkqfnh7.js +2 -0
  72. package/web/{chunk-zms6mrqk.js → chunk-5g8md2wg.js} +5 -5
  73. package/web/{chunk-h5ckjk48.js → chunk-5np514v5.js} +12 -12
  74. package/web/{chunk-z4bp6p32.js → chunk-60mym60n.js} +1 -1
  75. package/web/{chunk-bc3ajvfg.js → chunk-6f2sz84q.js} +2 -2
  76. package/web/{chunk-frnh4zqf.js → chunk-6jb2zyp6.js} +2 -2
  77. package/web/{chunk-g7dc4hrd.js → chunk-7adsmqv6.js} +1 -1
  78. package/web/{chunk-g7kz8f7q.js → chunk-7ksg3ccg.js} +5 -5
  79. package/web/chunk-7ky5nrrr.js +1 -0
  80. package/web/{chunk-sc63488q.js → chunk-7v85yvb2.js} +1 -1
  81. package/web/chunk-7vgh17es.js +1 -0
  82. package/web/chunk-80z8s8zb.js +2 -0
  83. package/web/{chunk-rxvm70w5.js → chunk-81s15c2e.js} +2 -2
  84. package/web/{chunk-knm82fw9.js → chunk-8539865x.js} +1 -1
  85. package/web/{chunk-jccz14ye.js → chunk-885kpj14.js} +2 -2
  86. package/web/{chunk-26ecc2xh.js → chunk-8cnjd0f2.js} +5 -5
  87. package/web/chunk-8sdjgv3k.js +1 -0
  88. package/web/chunk-9bxtzwtc.js +1 -0
  89. package/web/chunk-9jy8nc4r.js +1 -0
  90. package/web/{chunk-c57f714b.js → chunk-aa46mrgh.js} +2 -2
  91. package/web/{chunk-gw8x1g61.js → chunk-act3rr85.js} +1 -1
  92. package/web/chunk-aebrw6cv.js +39 -0
  93. package/web/{chunk-j37p0b13.js → chunk-aeymdtm1.js} +3 -3
  94. package/web/{chunk-8h2x89tw.js → chunk-ar6jnhm5.js} +1 -1
  95. package/web/{chunk-tfqarvdx.js → chunk-b5zf1hs3.js} +59 -59
  96. package/web/{chunk-m4fxd5d9.js → chunk-b99k8q22.js} +8 -8
  97. package/web/chunk-bcjgzwef.js +1 -0
  98. package/web/{chunk-jke2ev6m.js → chunk-bra33pt0.js} +2 -2
  99. package/web/{chunk-myd6sc76.js → chunk-bygwbpvq.js} +1 -1
  100. package/web/{chunk-zse05v6j.js → chunk-c3fty2c2.js} +9 -9
  101. package/web/chunk-cxpnj495.js +2 -0
  102. package/web/{chunk-x850q01z.js → chunk-d1btrqmw.js} +1 -1
  103. package/web/{chunk-qdzy124b.js → chunk-d57fm7k0.js} +2 -2
  104. package/web/{chunk-j89s11x8.js → chunk-d73zkc4q.js} +4 -4
  105. package/web/chunk-d94t9z70.js +1 -0
  106. package/web/chunk-de29pe57.js +1 -0
  107. package/web/{chunk-rag65pfs.js → chunk-dndd757x.js} +3 -3
  108. package/web/chunk-e68jw0bg.js +1 -0
  109. package/web/{chunk-grm2208k.js → chunk-e94pd9rr.js} +13 -13
  110. package/web/{chunk-zz1qkaar.js → chunk-enwfd8d5.js} +2 -2
  111. package/web/{chunk-qq6m2my8.js → chunk-fj753yzt.js} +2 -2
  112. package/web/chunk-fr4fft89.js +1 -0
  113. package/web/{chunk-5svqfj4g.js → chunk-g488hxx0.js} +3 -3
  114. package/web/{chunk-0770q5e1.js → chunk-g4zm0crw.js} +1 -1
  115. package/web/chunk-gckmcef6.js +1 -0
  116. package/web/{chunk-se4h6wx0.js → chunk-gkmaryr4.js} +1 -1
  117. package/web/chunk-gnb09wmx.js +1 -0
  118. package/web/{chunk-6e87m0nm.js → chunk-gten0rpx.js} +2 -2
  119. package/web/chunk-h24ybwp6.js +1 -0
  120. package/web/{chunk-z5qn0xev.js → chunk-h754ntg7.js} +2 -2
  121. package/web/{chunk-tt93zbn4.js → chunk-hn8m1vsg.js} +7 -7
  122. package/web/{chunk-rh3xb76f.js → chunk-hqxc9m07.js} +10 -10
  123. package/web/chunk-hrgqc1vr.js +1 -0
  124. package/web/{chunk-3eexx7y5.js → chunk-hva7xyne.js} +2 -2
  125. package/web/chunk-hxbfkdjd.js +1 -0
  126. package/web/chunk-j9c8fa82.js +1 -0
  127. package/web/{chunk-5v5q13hz.js → chunk-jeafmjsm.js} +2 -2
  128. package/web/chunk-jyf7a7yp.js +2 -0
  129. package/web/chunk-jz5mmp64.js +1 -0
  130. package/web/{chunk-18neka5g.js → chunk-k4dnjf8n.js} +5 -5
  131. package/web/{chunk-32ty2xfn.js → chunk-kerfb21g.js} +1 -1
  132. package/web/chunk-kxeaj44h.js +1 -0
  133. package/web/chunk-m0136xav.js +1 -0
  134. package/web/chunk-m1rdyvb5.js +1 -0
  135. package/web/chunk-m6vyvgm5.js +1 -0
  136. package/web/{chunk-w3zgfhjb.js → chunk-mxkbmgcv.js} +2 -2
  137. package/web/chunk-my0ec787.js +1 -0
  138. package/web/{chunk-qy1zx2yw.js → chunk-n9v14vyd.js} +22 -22
  139. package/web/{chunk-x5g1yy12.js → chunk-ncfzmf2g.js} +1 -1
  140. package/web/chunk-nkpdd9hw.js +1 -0
  141. package/web/chunk-ny436sqg.js +1 -0
  142. package/web/chunk-pbp1p5ex.js +1 -0
  143. package/web/chunk-ph75hddv.js +1 -0
  144. package/web/chunk-phdfyqaa.js +1 -0
  145. package/web/chunk-phxa5krt.js +1 -0
  146. package/web/{chunk-wrevb4ew.js → chunk-pjpre6de.js} +6 -6
  147. package/web/{chunk-vvvd3grf.js → chunk-pzg25qqe.js} +2 -2
  148. package/web/chunk-q1zxvjhs.js +2 -0
  149. package/web/{chunk-1qh7f5kr.js → chunk-qdd3bx8q.js} +1 -1
  150. package/web/{chunk-9yfftz38.js → chunk-qp3tjhaq.js} +1 -1
  151. package/web/chunk-r4zbw4zj.js +2 -0
  152. package/web/{chunk-1ev0n3n4.js → chunk-r6kk4vp1.js} +2 -2
  153. package/web/{chunk-n4yzs2q0.js → chunk-rdr6wt22.js} +4 -4
  154. package/web/chunk-ry4ycah9.js +1 -0
  155. package/web/{chunk-de40q05r.js → chunk-sdr5wa4z.js} +3 -3
  156. package/web/chunk-sqm16fat.js +1 -0
  157. package/web/{chunk-gsw1tv96.js → chunk-td83xf12.js} +1 -1
  158. package/web/{chunk-t5nvgz7z.js → chunk-v0wtk059.js} +7 -7
  159. package/web/{chunk-pgwf37s2.js → chunk-v1hfbjz9.js} +5 -5
  160. package/web/chunk-v1qt3gq4.js +1 -0
  161. package/web/{chunk-wtvch4ad.js → chunk-v34mr9ky.js} +9 -9
  162. package/web/chunk-v854w9yn.js +1 -0
  163. package/web/{chunk-xtn305fd.js → chunk-ve56gxq0.js} +1 -1
  164. package/web/chunk-w573ym17.js +1 -0
  165. package/web/{chunk-dv1berk6.js → chunk-w9gnqkez.js} +2 -2
  166. package/web/{chunk-q4bst4an.js → chunk-wqzbxzk3.js} +1 -1
  167. package/web/{chunk-rwfmccmh.js → chunk-wvrs986a.js} +4 -4
  168. package/web/chunk-x0mjydtp.js +1 -0
  169. package/web/{chunk-awkdw9rw.js → chunk-xbyrgyy0.js} +2 -2
  170. package/web/{chunk-p55vhns6.js → chunk-xpecre7w.js} +4 -4
  171. package/web/{chunk-ehtmb6sn.js → chunk-xvfeq8v2.js} +13 -13
  172. package/web/{chunk-rbqnre6q.js → chunk-yf8ykk4v.js} +4 -4
  173. package/web/{chunk-sjkg40ay.js → chunk-yjs6jmdb.js} +1 -1
  174. package/web/chunk-ym7kv2hs.js +1 -0
  175. package/web/chunk-zhybh04p.js +1 -0
  176. package/web/index.html +1 -1
  177. package/worker.js +1 -1
  178. package/chunk-3mqf9ped.js +0 -479
  179. package/chunk-7zkswxvk.js +0 -2
  180. package/chunk-m1eam0s5.js +0 -2
  181. package/web/chunk-045d3b5d.js +0 -1
  182. package/web/chunk-12qf1r6m.js +0 -1
  183. package/web/chunk-1ex3wgms.js +0 -2
  184. package/web/chunk-2cz7tx8q.js +0 -1
  185. package/web/chunk-46jnkghq.js +0 -2
  186. package/web/chunk-4am8j3k3.js +0 -1
  187. package/web/chunk-5qvmefq2.js +0 -1
  188. package/web/chunk-5z2n4z9x.css +0 -1
  189. package/web/chunk-6y55gk1n.js +0 -1
  190. package/web/chunk-7np1jp3x.js +0 -8
  191. package/web/chunk-7qq1ypvj.js +0 -1
  192. package/web/chunk-87e8d1hv.js +0 -1
  193. package/web/chunk-8y2526ve.js +0 -1
  194. package/web/chunk-905vw286.js +0 -2
  195. package/web/chunk-918e5t4x.js +0 -2
  196. package/web/chunk-96m2m3e8.js +0 -1
  197. package/web/chunk-9f4zzqbx.js +0 -1
  198. package/web/chunk-a1n4468c.js +0 -1
  199. package/web/chunk-arnzrqnm.js +0 -1
  200. package/web/chunk-b46ws7rf.js +0 -1
  201. package/web/chunk-bwy3e58v.js +0 -1
  202. package/web/chunk-d5gshd1a.js +0 -1
  203. package/web/chunk-dp0k5vhd.js +0 -1
  204. package/web/chunk-eh7wp62z.js +0 -2
  205. package/web/chunk-et1hytyv.js +0 -1
  206. package/web/chunk-f7jpakwh.js +0 -1
  207. package/web/chunk-f9m9seam.js +0 -1
  208. package/web/chunk-g2erm7k0.js +0 -1
  209. package/web/chunk-g3kbn0t2.js +0 -1
  210. package/web/chunk-ght0t49g.js +0 -1
  211. package/web/chunk-ghwm7bdj.js +0 -2
  212. package/web/chunk-h2txs73e.js +0 -39
  213. package/web/chunk-h3tkacc7.js +0 -1
  214. package/web/chunk-je78j3vr.js +0 -1
  215. package/web/chunk-kxdtg9dt.js +0 -1
  216. package/web/chunk-m9xzt9p7.js +0 -1
  217. package/web/chunk-ngt1j8py.js +0 -1139
  218. package/web/chunk-q34as3v6.js +0 -1
  219. package/web/chunk-qe0bgeda.js +0 -1
  220. package/web/chunk-sat7zyva.js +0 -1
  221. package/web/chunk-sk0hpa80.js +0 -1
  222. package/web/chunk-tvcxrx6h.js +0 -1
  223. package/web/chunk-tzpnh70q.js +0 -1
  224. package/web/chunk-vb7g4xg6.js +0 -1
  225. package/web/chunk-wzfe6jtq.js +0 -1
  226. package/web/chunk-xh4xn1az.js +0 -1
  227. package/web/chunk-xk904wqv.js +0 -1
  228. package/web/chunk-xzwxcxb4.js +0 -1
  229. package/web/chunk-yekaz74b.js +0 -1
  230. package/web/chunk-ys2tns0p.js +0 -1
@@ -1 +0,0 @@
1
- import{ki}from"./chunk-6e87m0nm.js";export{ki as default};
@@ -1 +0,0 @@
1
- import{Ei}from"./chunk-qy1zx2yw.js";export{Ei as createCynefinServices};
@@ -1 +0,0 @@
1
- import{o,Y,i,r,f,e,n,y,ne,Q}from"./chunk-ngt1j8py.js";import{na}from"./chunk-918e5t4x.js";var T=[{id:"exa",name:"Exa",description:"免密钥 · 综合搜索"},{id:"tavily",name:"Tavily",description:"免密钥 · 支持域名筛选"},{id:"parallel",name:"Parallel",description:"免密钥 · 网页搜索"},{id:"firecrawl",name:"Firecrawl",description:"免密钥 · 网页内容"},{id:"tinyfish",name:"TinyFish",description:"免密钥 · 搜索摘要"},{id:"searxng",name:"SearXNG",description:"免密钥 · 需自建服务"},{id:"brave",name:"Brave",description:"需密钥 · 独立搜索引擎"}];function D(t){return{enabled:t.search.provider!=="off",provider:t.search.provider==="off"?"auto":t.search.provider,searxngUrl:t.search.searxngUrl??"",proxy:t.proxy??"",acceptLanguage:t.acceptLanguage??""}}function G(t,c){return{search:{provider:t.enabled?t.provider:"off",searxngUrl:t.searxngUrl},keys:{...c},proxy:t.proxy,acceptLanguage:t.acceptLanguage}}function A(t,c,u){let p=D(t);if(c.enabled!==p.enabled)return!0;if(c.enabled&&c.provider!==p.provider)return!0;return c.searxngUrl!==p.searxngUrl||c.proxy!==p.proxy||c.acceptLanguage!==p.acceptLanguage||Object.keys(u).length>0}function z({notice:t}){let{cn:c}=y();if(!t)return null;let u=t.type==="success"?na:ne;return n("div",{role:t.type==="error"?"alert":"status",className:c("flex items-start gap-2 text-xs",t.type==="success"?"text-success":"text-danger"),children:[e(u,{className:"mt-0.5 size-4 shrink-0","aria-hidden":"true"}),e("span",{className:"min-w-0 break-words",children:t.text})]})}function I(t){let{Button:c,Input:u,Switch:p,Select:x,StatusChip:S,SettingActions:R,SettingGroup:P,SettingRow:C,cn:w}=y(),m=Y(),l=t.busy!==void 0;return n("form",{id:`${m}-form`,className:"min-w-0 space-y-5",onSubmit:async(s)=>{s.preventDefault(),await t.onSave()},children:[n(P,{title:"联网搜索",children:[e(C,{title:"启用搜索",description:"查询会发送至所选搜索服务",children:e(p,{label:"启用联网搜索",disabled:l,checked:t.draft.enabled,onCheckedChange:(s)=>t.onDraft({...t.draft,enabled:s})})}),e(C,{title:"搜索渠道",description:"自动:Exa → Tavily → Parallel → Firecrawl → TinyFish",children:e("div",{className:"w-48",children:e(x,{id:`${m}-provider`,value:t.draft.provider,disabled:l||!t.draft.enabled,className:"min-w-0",groups:[{options:[{value:"auto",label:"自动",description:"失败时依次切换渠道"},...T.map((s)=>({value:s.id,label:s.name}))]}],onValueChange:(s)=>{let a=s==="auto"?s:T.find((k)=>k.id===s)?.id;if(a)t.onDraft({...t.draft,provider:a})}})})}),(t.draft.provider==="searxng"||t.draft.searxngUrl)&&e(C,{vertical:!0,title:"自建 SearXNG 地址",children:e(u,{id:`${m}-searxng`,"aria-label":"自建 SearXNG 地址",type:"url",maxLength:2000,disabled:l||!t.draft.enabled,value:t.draft.searxngUrl,placeholder:"https://search.example.com",onChange:(s)=>t.onDraft({...t.draft,searxngUrl:s.target.value})})})]}),e(P,{title:"渠道与密钥",description:"检测使用已保存的配置",action:n(c,{type:"button",size:"sm",variant:"ghost",disabled:l,className:"text-dim",onClick:async()=>await t.onCheck("all"),children:[e(Q,{className:w("size-3.5",t.checking==="all"&&"animate-spin"),"aria-hidden":"true"}),t.checking==="all"?"正在检测…":"全部检测"]}),children:T.map((s)=>{let a=s.id,k=a==="searxng"?void 0:t.saved.keys[a],K=k?.source==="environment",W=a==="searxng"?void 0:t.keys[a],h=W==="",v=t.checks[a],L=t.checking==="all"||t.checking===a,b=k?.configured?"已配置密钥":"未配置";if(a==="searxng")b=t.saved.search.searxngUrl?"已配置地址":"未配置地址";if(K)b="来自环境变量";if(h)b="待移除";if(W)b="待保存密钥";let E=v&&!v.ok&&!L?v.error??(v.kind==="search"?v.meta?.failed[0]?.error:v.meta?.error)??"检测失败,请检查配置。":void 0;return n("div",{className:"min-w-0",children:[n(C,{title:s.name,description:n(f,{children:[s.description,K&&" · 请在服务端环境变量中更换或移除",E&&e("span",{role:"status",className:"block break-words text-danger",children:E})]}),children:[L?e(S,{tone:"neutral",pulse:!0,children:"检测中"}):v?e(S,{tone:v.ok?"success":"danger",children:v.ok?`可用 ${v.elapsedMs} ms`:"不可用"}):e("span",{className:w("text-xs",W!==void 0?"text-warning":"text-faint"),children:b}),a!=="searxng"&&!K&&n(f,{children:[e(c,{type:"button",size:"sm",variant:"ghost",disabled:l,"aria-label":`${k?.configured?"更换":"设置"} ${s.name} 密钥`,"aria-expanded":t.editingKey===a,"aria-controls":`${m}-${a}-key-editor`,onClick:()=>t.onEditKey(t.editingKey===a?void 0:a),children:k?.configured?"更换":"设置密钥"}),k?.configured&&!h&&e(c,{type:"button",size:"sm",variant:"ghost",disabled:l,"aria-label":`移除 ${s.name} 密钥`,onClick:()=>{t.onKeys({...t.keys,[a]:""}),t.onEditKey(void 0)},children:"移除"})]}),e(c,{type:"button",size:"sm",variant:"ghost",disabled:l,"aria-label":`检测 ${s.name}`,onClick:async()=>await t.onCheck(a),children:"检测"})]}),a!=="searxng"&&t.editingKey===a&&n("div",{id:`${m}-${a}-key-editor`,className:"flex items-center gap-2 pb-3",children:[e(u,{id:`${m}-${a}-key`,"aria-label":`${s.name} API 密钥`,type:"password",autoComplete:"new-password",maxLength:4000,disabled:l,value:t.keys[a]??"",placeholder:"输入新密钥,保存后生效;只写入,不回显",onChange:(N)=>{let d={...t.keys};if(N.target.value.trim())d[a]=N.target.value;else delete d[a];t.onKeys(d)}}),e(c,{type:"button",size:"sm",variant:"ghost",disabled:l,onClick:()=>{let N={...t.keys};delete N[a],t.onKeys(N),t.onEditKey(void 0)},children:"取消"})]})]},a)})}),n(P,{title:"网络",children:[e(C,{vertical:!0,title:"代理 URL",description:"留空使用服务端环境代理",children:e(u,{id:`${m}-proxy`,"aria-label":"代理 URL",type:"url",maxLength:2000,disabled:l,value:t.draft.proxy,placeholder:"http://127.0.0.1:7890",onChange:(s)=>t.onDraft({...t.draft,proxy:s.target.value})})}),e(C,{vertical:!0,title:"Accept-Language",children:e(u,{id:`${m}-language`,"aria-label":"Accept-Language",maxLength:200,disabled:l,value:t.draft.acceptLanguage,placeholder:"en-US,en;q=0.9",onChange:(s)=>t.onDraft({...t.draft,acceptLanguage:s.target.value})})})]}),n(R,{children:[e("div",{className:"mr-auto min-w-0",children:e(z,{notice:t.notice})}),t.dirty&&e(c,{type:"button",size:"sm",variant:"ghost",disabled:l,onClick:t.onRestore,children:"撤销更改"}),e(c,{form:`${m}-form`,type:"submit",size:"sm",variant:"primary",disabled:l||!t.dirty,children:t.busy==="save"?"保存中…":"保存"})]})]})}function M({connection:t}){let{Button:c}=y(),[u,p]=r(),[x,S]=r(),[R,P]=r({}),[C,w]=r(),[m,l]=r("load"),[s,a]=r(),[k,K]=r({}),[W,h]=r(),[v,L]=r(0),b=i(void 0);o(()=>{let d=new AbortController;return b.current=d,l("load"),h(void 0),p(void 0),S(void 0),P({}),w(void 0),K({}),t.request("/api/plugins/webfetch/settings",{signal:d.signal,cache:v>0?"reload":"default"}).then((g)=>{if(d.signal.aborted)return;p(g),S(D(g))}).catch((g)=>{if(!d.signal.aborted)h({type:"error",text:g instanceof Error?g.message:"加载设置失败,请重试。"})}).finally(()=>{if(!d.signal.aborted)b.current=void 0,l(void 0)}),()=>{d.abort(),b.current?.abort(),b.current=void 0}},[t,v]);async function E(){if(b.current||!u||!x||!A(u,x,R))return;let d=new AbortController;b.current=d,l("save"),h(void 0);try{let g=await t.request("/api/plugins/webfetch/settings",{method:"PATCH",signal:d.signal,headers:{"Content-Type":"application/json"},body:JSON.stringify(G(x,R))});if(d.signal.aborted)return;p(g),S(D(g)),P({}),w(void 0),K({}),h({type:"success",text:"设置已保存。"})}catch(g){if(!d.signal.aborted)h({type:"error",text:g instanceof Error?g.message:"保存失败,请重试。"})}finally{if(!d.signal.aborted)b.current=void 0,l(void 0)}}async function N(d){if(b.current||!u)return;let g=new AbortController;b.current=g,l("test"),a(d),h(void 0);try{let U=await t.request(`/api/plugins/webfetch/test?provider=${d}`,{method:"POST",signal:g.signal});if(g.signal.aborted)return;K((q)=>{let F={...q};for(let B of U.checks)if(B.kind==="search"&&B.provider)F[B.provider]=B;return F})}catch(U){if(!g.signal.aborted)h({type:"error",text:U instanceof Error?U.message:"检测失败,请重试。"})}finally{if(!g.signal.aborted)b.current=void 0,l(void 0),a(void 0)}}if(!u||!x)return n("div",{className:"min-w-0 space-y-3",children:[m==="load"&&e("p",{role:"status",className:"text-sm text-dim",children:"正在加载设置…"}),e(z,{notice:W}),m!=="load"&&e(c,{type:"button",size:"sm",variant:"ghost",onClick:()=>L(v+1),children:"重新加载"})]});return e(I,{saved:u,draft:x,keys:R,editingKey:C,dirty:A(u,x,R),busy:m==="load"?void 0:m,checking:s,checks:k,notice:W,onDraft:(d)=>{S(d),h(void 0)},onKeys:(d)=>{P(d),h(void 0)},onEditKey:w,onSave:E,onCheck:N,onRestore:()=>{S(D(u)),P({}),w(void 0),h(void 0)}})}export{M as default};
@@ -1 +0,0 @@
1
- import"./chunk-tfqarvdx.js";import"./chunk-vasppf6b.js";import{Po}from"./chunk-rh3xb76f.js";import"./chunk-z5qn0xev.js";import"./chunk-1ex3wgms.js";import"./chunk-sc63488q.js";import"./chunk-1qh7f5kr.js";export{Po as diagram};
@@ -1 +0,0 @@
1
- import"./chunk-tfqarvdx.js";import"./chunk-88wd49xe.js";import"./chunk-rxvm70w5.js";import{oo}from"./chunk-qdzy124b.js";export{oo as render};
@@ -1 +0,0 @@
1
- import{Ni}from"./chunk-qy1zx2yw.js";export{Ni as createArchitectureServices};
@@ -1 +0,0 @@
1
- import{Ti}from"./chunk-qy1zx2yw.js";export{Ti as createWardleyServices};
@@ -1 +0,0 @@
1
- import{Ci}from"./chunk-qy1zx2yw.js";export{Ci as createRadarServices};
@@ -1 +0,0 @@
1
- import{_i}from"./chunk-frnh4zqf.js";export{_i as default};
@@ -1 +0,0 @@
1
- import{g,o,i,r,f,e,n,y,bt,Q}from"./chunk-ngt1j8py.js";import{Or,$r,Br}from"./chunk-jke2ev6m.js";var ee={global:"全局",project:"项目",custom:"自定义",builtin:"内置"};function F({skill:s,issue:N,connection:S}){let{Button:E,CopyButton:d,style:v,useTheme:w}=y();w();let[p,L]=r(),[P,x]=r(),[D,z]=r(0);return o(()=>{let c=!0;x(void 0),L(void 0);let m=new URLSearchParams;if(s.projectID)m.set("projectID",s.projectID);if(s.location)m.set("location",s.location);let I=m.toString()?`?${m.toString()}`:"";return Promise.all([S.request(`/api/skills/${encodeURIComponent(s.name)}/content${I}`),S.request(`/api/skills/${encodeURIComponent(s.name)}/files${I}`)]).then(([b,O])=>{if(c)L({text:b.text,files:O.files})}).catch((b)=>{if(c)x(b instanceof Error?b.message:"读取失败")}),()=>{c=!1}},[S,s.name,s.projectID,s.location,D]),n("div",{className:"min-w-0 space-y-5 text-sm text-ink",children:[e("p",{className:"whitespace-pre-wrap break-words [overflow-wrap:anywhere] text-dim",children:s.description||"暂无描述"}),n("div",{children:[n("p",{className:"break-all text-xs text-dim",children:[ee[s.scope],s.projectName?` · ${s.projectName}`:""]}),n("div",{className:"mt-1 flex min-w-0 items-center gap-2",children:[e("code",{className:v("markdown.inlineCode","min-w-0 flex-1 break-all text-xs"),children:s.location}),e(d,{text:s.location,label:"复制完整路径",className:"size-10"})]})]}),n("ul",{className:"space-y-1 break-words text-xs text-dim",children:[e("li",{children:"启用状态按名称生效,影响所有同名技能的新会话可用性。"}),s.disableModelInvocation&&e("li",{children:"仅手动:可由用户调用,不向模型自动提供。"}),s.platforms&&n("li",{children:["平台限制:",s.platforms.join("、")]}),s.disabled&&e("li",{children:"已禁用:不会提供给新会话。"}),N?.overriddenBy&&n("li",{className:"break-all",children:["被覆盖:同名技能优先使用 ",N.overriddenBy]})]}),s.commands?.length?n("div",{children:[e("h3",{className:"font-medium",children:"bin 命令"}),e("p",{className:"mt-1 text-xs text-dim",children:"技能目录中的可执行命令。"}),e("ul",{className:"mt-2 space-y-1 font-mono text-xs",children:s.commands.map((c)=>e("li",{className:"break-all",children:c},c))})]}):null,P?n("div",{role:"alert",className:"space-y-2",children:[n("p",{className:"break-words text-danger",children:["读取失败:",P]}),e(E,{className:"h-10",onClick:()=>z(D+1),children:"重试"})]}):!p?e("p",{role:"status",className:"text-dim",children:"正在读取文件…"}):n(f,{children:[n("section",{children:[n("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e("h3",{className:"font-medium",children:"SKILL.md 原文"}),e(d,{text:p.text,label:"复制 SKILL.md 原文",className:"size-10"})]}),n("p",{className:"mb-2 text-xs text-faint",children:[p.text.length.toLocaleString()," 字符 · 约 ",Math.ceil(p.text.length/4).toLocaleString()," ","tokens(估算)"]}),e("pre",{className:v("surface.subtle",v("chat.toolOutput"),"rounded-lg bg-raised p-3 text-xs leading-5 break-all"),children:p.text})]}),n("section",{children:[n("h3",{className:"font-medium",children:["目录文件 · ",p.files.length,p.files.length===200?"(最多显示 200 个)":""]}),e("ul",{className:"mt-2 space-y-1 font-mono text-xs text-dim",children:p.files.map((c)=>e("li",{className:"break-all",children:c},c))})]})]})]})}var A="all",G="non-project",te="size-4 cursor-pointer rounded border-line text-accent accent-accent focus-visible:outline-2 focus-visible:outline-accent";function me({connection:s}){let{Button:N,Select:S,Dialog:E,style:d,useTheme:v}=y();v();let[w,p]=r([]),[L,P]=r([]),[x,D]=r(A),[z,c]=r([]),[m,I]=r(),[b,O]=r(""),[k,B]=r(),[h,T]=r(!0),[K,R]=r(),[W,H]=r(),u=i(0),j=i(!1),C=g(async(t=!1)=>{let l=++u.current;j.current=!0,T(!0);try{if(t)await s.request("/api/skills/rescan",{method:"POST"});let[a,U,q]=await Promise.all([s.request("/api/skills?all=true"),s.request("/api/skills/settings"),s.request("/api/projects")]);if(l!==u.current)return;p(a.skills),P(q),c(a.issues),I(U),H(new Date),R(void 0)}catch(a){if(l===u.current)R(a instanceof Error?a.message:"读取失败")}finally{if(l===u.current)j.current=!1,T(!1)}},[s]);o(()=>(C(),()=>{u.current++}),[C]);async function V(t){if(j.current)return;j.current=!0;let l=++u.current;T(!0);try{let a=await s.request("/api/skills/settings",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(t)});if(l!==u.current)return;I(a),await C()}catch(a){if(l!==u.current)return;R(a instanceof Error?a.message:"保存设置失败"),j.current=!1,T(!1)}}let X=b.trim().toLocaleLowerCase(),J=x===A?w:w.filter((t)=>{if(t.scope!=="project")return!0;return x!==G&&t.projectID===x}),M=J.filter((t)=>`${t.name} ${t.description??""}`.toLocaleLowerCase().includes(X)),_=(t)=>z.find((l)=>l.kind==="overridden"&&(l.path==="<built-in>"?t.scope==="builtin":l.path.replace(/\\/g,"/")===`${t.location.replace(/\\/g,"/")}/SKILL.md`));return n("div",{className:"min-w-0 space-y-6",children:[n("section",{className:"min-w-0",children:[n("div",{className:"mb-2.5 flex flex-wrap items-end justify-between gap-3 px-0.5",children:[n("div",{className:"min-w-0 flex-1 basis-48",children:[e("h2",{className:d("settings.groupTitle"),children:"技能"}),e("p",{"aria-live":"polite",className:d("settings.groupDesc"),children:W&&`找到 ${J.length} 个 · ${W.toLocaleTimeString("zh-CN",{hour12:!1})}`})]}),n("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[e(S,{value:x,disabled:h,onValueChange:(t)=>{B(void 0),D(t)},groups:[{options:[{value:A,label:"全部来源"},{value:G,label:"非项目技能"}]},...Or(L)],className:"w-44"}),n(N,{variant:"ghost",disabled:h,onClick:()=>C(!0),className:"h-9 px-2.5 text-xs",children:[e(Q,{className:`size-3.5 ${h?"animate-spin":""}`}),e("span",{className:"ml-1",children:"重新扫描"})]})]})]}),K&&n("div",{role:"alert",className:"mb-3 flex flex-wrap items-center gap-2 rounded-xl border border-line p-3",children:[n("p",{className:"min-w-0 flex-1 break-words text-sm text-danger",children:["无法更新技能:",K]}),e(N,{disabled:h,onClick:()=>C(),children:"重试"})]}),e($r,{label:"搜索技能",placeholder:"搜索技能",value:b,onChange:O}),e("div",{className:d("settings.groupBox"),children:h&&!w.length?e(Br,{}):M.length===0?e("p",{className:"p-4 text-sm text-dim",children:"没有找到匹配的技能"}):e("ul",{className:"divide-y divide-line",children:M.map((t)=>{let l=_(t),a=t.disabled;return n("li",{className:`flex min-w-0 items-center justify-between gap-3 px-4 py-2.5 transition-colors hover:bg-raised/40 ${a?"opacity-55":""}`,children:[n("button",{type:"button",className:"group flex min-h-12 min-w-0 flex-1 cursor-pointer items-center gap-3 py-1 text-left focus-visible:outline-2 focus-visible:outline-accent","aria-label":`查看技能 ${t.name}`,onClick:()=>B(t),children:[n("span",{className:"min-w-0 flex-1",children:[n("span",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[e("span",{className:"truncate text-sm font-medium text-ink",title:t.name,children:t.name}),l&&n("span",{className:"flex shrink-0 items-center gap-1 text-xs text-warning",children:[e(bt,{className:"size-3.5"}),"被覆盖"]})]}),t.description&&e("span",{className:"mt-0.5 block truncate text-xs text-dim",title:t.description,children:t.description})]}),e("span",{className:d("control.badge","shrink-0 text-[11px] text-dim"),children:t.scope==="project"?"项目":t.scope==="builtin"?"built-in":"全局"})]}),e("span",{className:"relative flex size-10 shrink-0 items-center justify-center",children:e("input",{type:"checkbox","aria-label":`启用技能 ${t.name}`,className:te,disabled:h,checked:!a,onChange:(U)=>{if(!m)return;let q=m.disabled??[],Y=U.target.checked?q.filter((Z)=>Z!==t.name):[...q,t.name];V({...m,disabled:Y})}})})]},`${t.scope}:${t.projectID??""}:${t.name}`)})})})]}),e(E,{open:Boolean(k),onOpenChange:(t)=>{if(!t)B(void 0)},title:k?.name??"",size:"lg",footer:e("div",{className:"flex w-full justify-end",children:e(N,{variant:"primary",onClick:()=>B(void 0),children:"关闭"})}),children:k&&e(F,{skill:k,issue:_(k),connection:s})})]})}export{me as SkillsSection};
@@ -1 +0,0 @@
1
- import{xi}from"./chunk-qq6m2my8.js";export{xi as default};
@@ -1 +0,0 @@
1
- import{g,o,i,r,f,e,n,y,s,ne,bt,it,Vt,ve,ce,Q,xt,ct,te,rn,X}from"./chunk-ngt1j8py.js";import{Or,$r,Br}from"./chunk-jke2ev6m.js";var je=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],xe=s("key-round",je);function he(a){let d=[],h="",N,C=!1;for(let u=0;u<a.length;u++){let c=a.charAt(u);if(N)if(c===N)N=void 0;else if(c==="\\"&&N==='"'&&u+1<a.length)h+=a[++u];else h+=c;else if(c==='"'||c==="'")N=c,C=!0;else if(c==="\\"&&u+1<a.length)h+=a[++u],C=!0;else if(/\s/.test(c)){if(C||h)d.push(h);h="",C=!1}else h+=c,C=!0}if(C||h)d.push(h);return d}function me(a){return a.map((d)=>d===""||/[\s"'\\]/.test(d)?`"${d.replace(/(["\\])/g,"\\$1")}"`:d).join(" ")}var be="size-4 cursor-pointer rounded border-line text-accent accent-accent focus-visible:outline-2 focus-visible:outline-accent",$e={connected:{label:"已连接",dot:"bg-success"},idle:{label:"待连接",dot:"bg-faint"},disabled:{label:"已停用",dot:"bg-faint"},failed:{label:"连接失败",dot:"bg-danger"},needs_auth:{label:"需要认证",dot:"bg-warning"}};function ae(a){return a.type==="local"?me(a.command):a.url}function ye({info:a,tools:d=!1}){let h=$e[a.status.status];return n("span",{className:"inline-flex shrink-0 items-center gap-1.5 text-xs text-dim",children:[e("span",{"aria-hidden":!0,className:`size-1.5 shrink-0 rounded-full ${h.dot}`}),e("span",{className:d?void 0:"hidden @md/panel:inline",children:h.label}),d&&a.status.status==="connected"&&n("span",{className:"text-faint",children:["· ",a.toolCount," 个工具"]})]})}function Te(a){if(typeof a!=="object"||a===null||!("type"in a))return"any";let d=a.type;if(typeof d==="string")return d;if(Array.isArray(d))return d.filter((h)=>typeof h==="string").join(" | ")||"any";return"any"}function Ne(a){let{Button:d,CopyButton:h,Dialog:N,StatusChip:C,confirm:u,style:c,useTheme:S}=y();S();let{info:l,connection:E}=a,[m,P]=r(),[Z,A]=r(),[D,k]=r(!1),_=l.status.status==="connected",U=l.status.status==="needs_auth",W=l.status.status==="failed",V=l.config.type==="remote"&&Boolean(l.config.oauth);o(()=>{function p(x){if(x&&x!==l.name)return;let R=l.projectID?`?projectID=${encodeURIComponent(l.projectID)}`:"";E.request(`/api/mcp/${encodeURIComponent(l.name)}/connect${R}`,{method:"POST"}).then((K)=>a.onChanged(K)).catch(()=>{})}function t(x){if(x.data?.type==="mcp-oauth-success")p(x.data.name)}function b(x){if(x.key==="basalt-mcp-oauth-event"&&x.newValue)try{let R=JSON.parse(x.newValue);p(R.name)}catch(R){}}window.addEventListener("message",t),window.addEventListener("storage",b);let w;if("BroadcastChannel"in window)w=new BroadcastChannel("basalt-mcp-oauth"),w.onmessage=(x)=>{if(x.data?.type==="mcp-oauth-success")p(x.data.name)};return()=>{window.removeEventListener("message",t),window.removeEventListener("storage",b),w?.close()}},[E,l.name,l.projectID,a]),o(()=>{if(l.status.status!=="connected")return;let p=l.projectID?`?projectID=${encodeURIComponent(l.projectID)}`:"";E.request(`/api/mcp/${encodeURIComponent(l.name)}/tools${p}`).then((t)=>{if(Array.isArray(t))P(t),A(void 0)}).catch((t)=>{A(t instanceof Error?t.message:"获取工具失败")})},[E,l.name,l.projectID,l.status.status]);async function Y(p){k(!0);try{let t=l.projectID?`?projectID=${encodeURIComponent(l.projectID)}`:"",b=await E.request(`/api/mcp/${encodeURIComponent(l.name)}/${p}${t}`,{method:"POST"});a.onChanged(b)}catch{}finally{k(!1)}}async function H(){k(!0);try{let p=l.projectID?`?projectID=${encodeURIComponent(l.projectID)}`:"",t=l.status.status==="needs_auth"?l.status.authorizationUrl:void 0;if(!t)t=(await E.request(`/api/mcp/${encodeURIComponent(l.name)}/oauth/authorize${p}`,{method:"POST"})).authorizationUrl;if(t)window.open(t,"_blank","width=600,height=700")}catch(p){A(p instanceof Error?p.message:"获取授权链接失败")}finally{k(!1)}}async function G(){k(!0);try{let p=l.projectID?`?projectID=${encodeURIComponent(l.projectID)}`:"",t=await E.request(`/api/mcp/${encodeURIComponent(l.name)}/oauth/clear${p}`,{method:"POST"});a.onChanged(t)}finally{k(!1)}}async function j(){if(!await u({title:`删除 ${l.name}?`,description:"删除后将断开连接并不再向会话提供其工具。",action:"删除",danger:!0}))return;k(!0);try{let t=l.projectID?`?projectID=${encodeURIComponent(l.projectID)}`:"";await E.request(`/api/mcp/${encodeURIComponent(l.name)}${t}`,{method:"DELETE"}),a.onChanged(),a.onClose()}finally{k(!1)}}let T=l.config,M=ae(T),L="error"in l.status?l.status.error:void 0,ee=m?.length??l.toolCount??0;return e(N,{open:!0,className:"bg-panel shadow-float",onOpenChange:(p)=>{if(!p&&!D)a.onClose()},title:n("div",{className:"flex flex-wrap items-center gap-3",children:[e("div",{className:"flex size-8 items-center justify-center rounded-[10px] border border-accent/20 bg-accent-soft text-accent",children:T.type==="local"?e(ct,{className:"size-4"}):e(ve,{className:"size-4"})}),e("span",{className:"font-serif text-lg font-semibold tracking-tight text-ink",children:l.name}),_?e(C,{tone:"success",pulse:!0,children:"已连接"}):U?e(C,{tone:"warning",pulse:!0,children:"需要授权"}):W?e(C,{tone:"danger",children:"连接失败"}):l.status.status==="disabled"?e(C,{tone:"neutral",children:"已停用"}):e(C,{tone:"neutral",children:"未连接"})]}),description:n("div",{className:"mt-2 flex min-w-0 flex-wrap items-center gap-1.5 text-xs",children:[n("span",{className:"flex min-w-0 max-w-full items-center gap-1 rounded-lg border border-line bg-raised/60 py-0.5 pr-1 pl-2.5 font-mono text-[11.5px] text-ink",children:[e("span",{className:"min-w-0 truncate",title:M,children:M}),e(h,{text:M,label:"复制地址",size:"icon-xs",className:"shrink-0 text-dim hover:text-ink"})]}),e("span",{className:"rounded-lg border border-line px-2 py-1 text-[11px] leading-none text-dim",children:T.type==="local"?"本地命令":"远程 HTTP"}),V&&n("span",{className:c("control.badgeAccent","gap-1 rounded-lg border border-accent/25 px-2 py-1"),children:[e(xt,{className:"size-3"}),"OAuth 2.0"]})]}),size:"lg",footer:n("div",{className:"flex w-full items-center justify-between gap-2 max-sm:flex-col",children:[n("div",{className:"flex items-center gap-1 max-sm:w-full",children:[V&&e(d,{type:"button",variant:"ghost",onClick:G,disabled:D,title:"清除已保存的 OAuth 凭据",children:"清除凭据"}),e(d,{type:"button",variant:"danger-ghost",size:"icon-sm","aria-label":"删除服务器",onClick:j,disabled:D,title:"删除服务器",children:e(te,{className:"size-4"})})]}),n("div",{className:"flex items-center gap-2 max-sm:w-full max-sm:justify-end",children:[e(d,{type:"button",variant:"ghost",onClick:a.onEdit,disabled:D,children:"编辑配置"}),!U&&e(d,{type:"button",variant:"secondary",onClick:()=>Y(_?"disconnect":"connect"),disabled:D,children:D?"处理中...":_?"断开连接":"立即连接"}),e(d,{type:"button",variant:"primary",onClick:a.onClose,children:"完成"})]})]}),children:n("div",{className:"space-y-6 pt-1",children:[U&&e("div",{className:"relative overflow-hidden rounded-2xl border border-warning/30 bg-[radial-gradient(120%_140%_at_0%_0%,color-mix(in_oklch,var(--color-warning)_16%,transparent),transparent_65%)] p-5",children:n("div",{className:"flex items-start gap-4 max-sm:flex-col",children:[e("div",{className:"relative flex size-11 shrink-0 items-center justify-center rounded-xl border border-warning/30 bg-panel text-warning shadow-[0_0_28px_-4px_color-mix(in_oklch,var(--color-warning)_55%,transparent)]",children:e(xe,{className:"size-5"})}),n("div",{className:"min-w-0 flex-1 space-y-1.5",children:[e("h4",{className:"text-sm font-semibold text-ink",children:"授权后即可使用此服务器"}),e("p",{className:"text-[13px] leading-relaxed text-dim",children:"该端点要求 OAuth 2.0 身份许可。在浏览器中完成授权后,令牌会自动保存并载入全部工具。"}),L&&e("p",{className:"line-clamp-2 break-words font-mono text-[11.5px] text-faint",title:L,children:L})]}),n(d,{type:"button",variant:"primary",onClick:H,disabled:D,className:"shrink-0",children:[e(Vt,{className:"mr-1.5 size-3.5"}),D?"正在拉起授权...":"前往授权"]})]})}),W&&n("div",{className:c("callout.base",c("callout.danger"),"gap-3 rounded-2xl p-4"),children:[e(bt,{className:"mt-0.5 size-4 shrink-0 text-danger"}),n("div",{className:"min-w-0 space-y-1",children:[e("h4",{className:"text-sm font-medium text-ink",children:"连接失败"}),e("p",{className:"font-mono text-[11.5px] leading-relaxed break-words text-dim",children:L})]})]}),n("section",{className:"space-y-3",children:[n("div",{className:"flex items-baseline justify-between gap-3 px-0.5",children:[n("h4",{className:"flex items-center gap-2 text-[13px] font-medium text-ink",children:["可用工具",e("span",{className:"rounded-full bg-raised px-1.5 py-0.5 font-mono text-[11px] leading-none text-dim",children:ee})]}),e("span",{className:"text-[11.5px] text-faint",children:"对所有会话可用"})]}),Z?e("div",{className:c("callout.base",c("callout.danger"),"text-xs leading-relaxed break-words"),children:Z}):!_?n("div",{className:c("surface.emptyDashed","gap-2 py-10"),children:[e("div",{className:"flex size-10 items-center justify-center rounded-full bg-raised text-faint",children:e(rn,{className:"size-4.5"})}),e("p",{className:"text-[13px] font-medium text-dim",children:U?"等待授权":"尚未连接"}),e("p",{className:"max-w-xs text-xs leading-relaxed text-faint",children:U?"授权完成后会自动连接并列出工具。":"连接服务器后,这里会列出它提供的全部工具。"})]}):!m?e("div",{role:"status","aria-label":"正在获取工具列表",className:"grid gap-2",children:[0,1,2].map((p)=>n("div",{className:"animate-pulse space-y-2.5 rounded-xl border border-line p-3.5",children:[e("div",{className:"h-3.5 w-32 rounded bg-raised"}),e("div",{className:"h-3 w-4/5 rounded bg-raised/70"})]},p))}):m.length===0?n("div",{className:c("surface.emptyDashed","gap-2 py-10"),children:[e("div",{className:"flex size-10 items-center justify-center rounded-full bg-raised text-faint",children:e(rn,{className:"size-4.5"})}),e("p",{className:"text-[13px] font-medium text-dim",children:"没有可用工具"}),e("p",{className:"max-w-xs text-xs leading-relaxed text-faint",children:"已连接成功,但该服务器没有声明任何工具。"})]}):e("ul",{className:"grid gap-2",children:m.map((p)=>{let t=p.inputSchema?.properties??{},b=p.inputSchema?.required??[],w=Object.entries(t);return n("li",{className:c("surface.subtle","border-line bg-raised/30 p-3.5 transition-colors hover:border-line-strong hover:bg-raised/60"),children:[e("span",{className:"font-mono text-[13px] font-medium break-all text-accent",children:p.name}),p.description&&e("p",{className:"mt-1.5 text-[13px] leading-relaxed break-words text-dim",children:p.description}),w.length>0&&e("div",{className:"mt-3 flex flex-wrap gap-1.5",children:w.map(([x,R])=>n("span",{title:b.includes(x)?"必填参数":"可选参数",className:"inline-flex items-center gap-1 rounded-md border border-line bg-panel px-1.5 py-1 font-mono text-[11px] leading-none",children:[e("span",{className:"text-ink",children:x}),b.includes(x)&&e("span",{className:"text-warning",children:"*"}),e("span",{className:"text-faint",children:Te(R)})]},x))})]},p.name)})})]})]})})}var Pe=/^[A-Za-z0-9_-]{1,64}$/;function F(a){return e("span",{className:"truncate text-xs text-faint",children:a.children})}function Ce(a){let{pairs:d,onChange:h,InputComponent:N}=a,C=(u,c)=>h(d.map((S,l)=>l===u?{...S,...c}:S));return n("div",{className:"space-y-2",children:[n("div",{className:"flex min-h-7 items-center gap-2",children:[e("span",{className:"shrink-0 text-[13px] font-medium text-dim",children:a.label}),e(F,{children:a.tip}),n("button",{type:"button",className:"ml-auto inline-flex h-7 shrink-0 cursor-pointer items-center gap-1 rounded-lg px-2 text-xs font-medium text-dim transition-colors hover:bg-raised hover:text-ink",onClick:()=>h([...d,{key:"",value:"",saved:!1}]),children:[e(ce,{className:"size-3.5"}),"添加"]})]}),d.map((u,c)=>n("div",{className:"flex min-w-0 items-center gap-1.5",children:[e(N,{"aria-label":`${a.keyLabel} ${c+1}`,placeholder:a.keyLabel,value:u.key,readOnly:u.saved,onChange:(S)=>C(c,{key:S.target.value}),className:"min-w-0 flex-[2] font-mono text-xs"}),e(N,{"aria-label":`${a.keyLabel} ${u.key||c+1} 的值`,type:"password",autoComplete:"off",placeholder:u.saved?"已保存,留空保持不变":"值",value:u.value,onChange:(S)=>C(c,{value:S.target.value}),className:"min-w-0 flex-[3] font-mono text-xs"}),e("button",{type:"button","aria-label":`删除 ${u.key||"该项"}`,className:"flex size-8 shrink-0 cursor-pointer items-center justify-center rounded-lg text-faint transition-colors hover:bg-danger/10 hover:text-danger",onClick:()=>h(d.filter((S,l)=>l!==c)),children:e(X,{className:"size-4"})})]},c))]})}function we(a){return Object.keys(a??{}).map((d)=>({key:d,value:"",saved:!0}))}function ke(a){let{Button:d,Segmented:h,Dialog:N,Form:C,Field:u,Input:c,Switch:S,style:l,useTheme:E}=y();E();let{existing:m}=a,[P,Z]=r(m?.config.type??"local"),[A,D]=r(m?.name??""),[k,_]=r(m?.config.type==="local"?me(m.config.command):""),[U,W]=r(m?.config.type==="remote"?m.config.url:""),[V,Y]=r(we(m?.config.type==="local"?m.config.environment:void 0)),[H,G]=r(we(m?.config.type==="remote"?m.config.headers:void 0)),j=m?.config.type==="remote"?m.config.oauth:void 0,[T,M]=r(Boolean(j)),[L,ee]=r(typeof j==="object"&&j.clientId?j.clientId:""),[p,t]=r(""),[b,w]=r(typeof j==="object"&&j.scope?j.scope:""),[x,R]=r(m?.config.defer??"default"),[K,se]=r(m?.config.timeout!==void 0?String(m.config.timeout):""),[le,Ie]=r(m?.config.defer!==void 0||m?.config.timeout!==void 0),[ue,J]=r(),[de,fe]=r(!1);async function Se(v){v.preventDefault(),J(void 0);let I=A.trim();if(!m&&!Pe.test(I)){J("名称只能包含英文字母、数字、下划线与中划线,长度 1-64");return}if(!m&&a.taken.includes(I)){J("同名服务器已存在");return}let oe=K.trim()?Number.parseInt(K.trim(),10):void 0;if(oe!==void 0&&(!Number.isFinite(oe)||oe<=0)){J("超时时间须为大于 0 的毫秒数");return}let pe;if(P==="local"){let B=he(k.trim());if(!B.length){J("请输入启动命令");return}let q={};for(let O of V){let z=O.key.trim();if(!z)continue;if(!O.saved||O.value)q[z]=O.value}pe={type:"local",command:B,environment:Object.keys(q).length?q:void 0,enabled:m?m.config.enabled:!0,defer:x==="default"?void 0:x,timeout:oe}}else{let B=U.trim();try{let z=new URL(B);if(z.protocol!=="http:"&&z.protocol!=="https:")throw Error("bad protocol")}catch{J("请输入合法的 HTTP 或 HTTPS 地址");return}let q={};for(let z of H){let ie=z.key.trim();if(!ie)continue;if(!z.saved||z.value)q[ie]=z.value}let O;if(T){let z=L.trim(),ie=p.trim(),ge=b.trim();if(z||ie||ge)O={clientId:z||void 0,clientSecret:ie||void 0,scope:ge||void 0};else O=!0}else O=!1;pe={type:"remote",url:B,headers:Object.keys(q).length?q:void 0,oauth:O,enabled:m?m.config.enabled:!0,defer:x==="default"?void 0:x,timeout:oe}}fe(!0);try{let B=m?.name??I,q=m?m.projectID:a.projectID,O=q?`?projectID=${encodeURIComponent(q)}`:"";await a.connection.request(`/api/mcp/${encodeURIComponent(B)}${O}`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify(pe)}),a.onSaved()}catch(B){J(B instanceof Error?B.message:"保存失败")}finally{fe(!1)}}return e(N,{open:!0,onOpenChange:(v)=>{if(!v&&!de)a.onClose()},title:m?`编辑 ${m.name}`:"添加 MCP 服务器",size:"lg",footer:n("div",{className:"flex w-full justify-end gap-2.5",children:[e(d,{type:"button",variant:"ghost",onClick:a.onClose,disabled:de,className:"min-w-20",children:"取消"}),e(d,{type:"submit",form:"mcp-server-form",variant:"primary",disabled:de,className:"min-w-24",children:de?"保存中...":"保存"})]}),children:n(C,{id:"mcp-server-form",onSubmit:Se,children:[e(h,{value:P,onChange:(v)=>Z(v),className:"w-full [&>button]:flex-1",options:[{value:"local",label:"本地(标准输入输出)"},{value:"remote",label:"远程(HTTP / SSE)"}]}),!m&&e(u,{label:"名称",aside:e(F,{children:"唯一标识,如 postgres"}),children:(v)=>e(c,{id:v,value:A,onChange:(I)=>D(I.target.value),placeholder:"postgres",className:"font-mono text-xs"})}),P==="local"?n(f,{children:[e(u,{label:"启动命令",aside:e(F,{children:"完整命令及参数"}),children:(v)=>e(c,{id:v,value:k,onChange:(I)=>_(I.target.value),placeholder:"npx -y @modelcontextprotocol/server-postgres ...",className:"font-mono text-xs"})}),e(Ce,{label:"环境变量",tip:"启动进程时注入",keyLabel:"变量名",pairs:V,onChange:Y,InputComponent:c})]}):n(f,{children:[e(u,{label:"服务地址",aside:e(F,{children:"HTTP / HTTPS 端点"}),children:(v)=>e(c,{id:v,value:U,onChange:(I)=>W(I.target.value),placeholder:"https://example.com/mcp",className:"font-mono text-xs"})}),e(Ce,{label:"请求头",tip:"随每次请求发送",keyLabel:"头字段",pairs:H,onChange:G,InputComponent:c}),n("div",{className:"flex items-center justify-between gap-4",children:[n("div",{className:"min-w-0",children:[e("span",{className:"block text-[13px] font-medium text-dim",children:"OAuth 2.0 认证"}),e("span",{className:"block truncate text-xs text-faint",children:"自动发现授权端点,使用 PKCE 并刷新令牌"})]}),e(S,{checked:T,onCheckedChange:M,label:"启用 OAuth 2.0"})]}),T&&n(f,{children:[e(u,{label:"Client ID",aside:e(F,{children:"留空自动动态注册(DCR)"}),children:(v)=>e(c,{id:v,value:L,onChange:(I)=>ee(I.target.value),placeholder:"留空自动动态注册",className:"font-mono text-xs"})}),e(u,{label:"Client Secret",aside:e(F,{children:"留空保持不变"}),children:(v)=>e(c,{id:v,type:"password",autoComplete:"off",value:p,onChange:(I)=>t(I.target.value),placeholder:"••••••••",className:"font-mono text-xs"})}),e(u,{label:"Scope",aside:e(F,{children:"选填授权范围"}),children:(v)=>e(c,{id:v,value:b,onChange:(I)=>w(I.target.value),placeholder:"repo read:org",className:"font-mono text-xs"})})]})]}),n("div",{className:"space-y-3 border-t border-line/60 pt-3",children:[n("button",{type:"button","aria-expanded":le,className:"flex w-full cursor-pointer items-center gap-1.5 text-[13px] font-medium text-dim transition-colors hover:text-ink",onClick:()=>Ie(!le),children:[e(it,{className:`size-3.5 transition-transform ${le?"rotate-90":""}`}),"高级设置",e("span",{className:"truncate text-xs font-normal text-faint",children:"加载时机、超时"})]}),le&&n("div",{className:"grid grid-cols-2 gap-3 max-sm:grid-cols-1",children:[e(u,{label:"加载时机",aside:e(F,{children:"延迟 = 按需加载"}),children:()=>e(h,{value:x,onChange:(v)=>R(v),className:"w-full [&>button]:flex-1",options:[{value:"default",label:"默认"},{value:"defer",label:"延迟"},{value:"always",label:"常驻"}]})}),e(u,{label:"超时(毫秒)",aside:e(F,{children:"留空用默认"}),children:(v)=>e(c,{id:v,value:K,onChange:(I)=>se(I.target.value),placeholder:"默认",className:"font-mono text-xs"})})]})]}),ue&&n("div",{role:"alert",className:l("callout.base",l("callout.danger"),"px-3 py-2.5 text-xs"),children:[e(ne,{className:"mt-0.5 size-3.5 shrink-0"}),e("span",{className:"min-w-0 break-words",children:ue})]})]})})}var re="global";function nt({connection:a}){let{Button:d,Select:h,style:N,useTheme:C}=y();C();let[u,c]=r(""),[S,l]=r(),[E,m]=r([]),[P,Z]=r(re),[A,D]=r(),[k,_]=r(!1),[U,W]=r(),[V,Y]=r(!1),H=i(!1),[G,j]=r(),T=i(0),M=g(async()=>{let t=++T.current;_(!0);try{let b=P===re?"":`?projectID=${encodeURIComponent(P)}`,[w,x]=await Promise.all([a.request(`/api/mcp${b}`),a.request("/api/projects")]);if(t!==T.current)return;l(w),m(x),D(void 0)}catch(b){if(t===T.current)D(b instanceof Error?b.message:"读取失败")}finally{if(t===T.current)_(!1)}},[a,P]);o(()=>(M(),()=>{T.current++}),[M]);async function L(t,b){if(H.current)return;H.current=!0,Y(!0);let w=T.current;try{let x=t.projectID?`?projectID=${encodeURIComponent(t.projectID)}`:"",R=await a.request(`/api/mcp/${encodeURIComponent(t.name)}${x}`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({...t.config,enabled:b})});if(w===T.current)l((K)=>K?.map((se)=>se.name===R.name&&se.projectID===R.projectID?R:se))}finally{H.current=!1,Y(!1)}}let ee=S?.filter((t)=>`${t.name} ${ae(t.config)}`.toLowerCase().includes(u.trim().toLowerCase())),p=S?.find((t)=>t.name===U);return n("div",{className:"min-w-0 space-y-6",children:[n("section",{className:"min-w-0",children:[n("div",{className:"mb-2.5 flex flex-wrap items-end justify-between gap-3 px-0.5",children:[n("div",{className:"min-w-0 flex-1 basis-48",children:[e("h2",{className:N("settings.groupTitle"),children:"MCP 服务器"}),e("p",{className:N("settings.groupDesc"),children:"外部工具与数据源管理"})]}),n("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[e(h,{value:P,disabled:k,onValueChange:(t)=>{W(void 0),j(void 0),l(void 0),Z(t)},groups:[{options:[{value:re,label:"全局"}]},...Or(E)],className:"w-44"}),e(d,{variant:"ghost",disabled:k,onClick:M,className:"h-9 px-2.5 text-xs",children:e(Q,{className:`size-3.5 ${k?"animate-spin":""}`})}),n(d,{variant:"secondary",onClick:()=>j({}),className:"h-9 px-2.5 text-xs",children:[e(ce,{className:"size-3.5 mr-1"}),"添加服务器"]})]})]}),A&&n("div",{role:"alert",className:N("callout.base",N("callout.danger"),"mb-3 flex-wrap items-center justify-between"),children:[n("p",{className:"min-w-0 flex-1 break-words text-sm text-danger",children:["无法读取 MCP 服务器:",A]}),e(d,{disabled:k,onClick:M,children:"重试"})]}),e($r,{label:"搜索 MCP 服务器",placeholder:"搜索服务器",value:u,onChange:c}),e("div",{className:N("settings.groupBox"),children:!S?e(Br,{}):ee?.length===0?e("p",{className:"p-4 text-sm text-dim",children:"没有匹配的 MCP 服务器"}):e("ul",{className:"divide-y divide-line",children:ee?.map((t)=>{let b=t.config.enabled===!1,w=t.scope==="file";return n("li",{className:`flex min-w-0 items-center justify-between gap-3 px-4 py-2.5 transition-colors hover:bg-raised/40 ${b?"opacity-55":""}`,children:[n("button",{type:"button",className:"group flex min-h-12 min-w-0 flex-1 cursor-pointer items-center gap-3 py-1 text-left focus-visible:outline-2 focus-visible:outline-accent","aria-label":`查看 ${t.name}`,disabled:w,title:w?"来自项目的 .mcp.json,只读":void 0,onClick:()=>W(t.name),children:[e("span",{"aria-hidden":!0,className:"flex size-9 shrink-0 items-center justify-center rounded-lg bg-raised text-dim",children:t.config.type==="local"?e(ct,{className:"size-4"}):e(ve,{className:"size-4"})}),n("span",{className:"min-w-0 flex-1",children:[e("span",{className:"block truncate text-sm font-medium text-ink",title:t.name,children:t.name}),e("span",{className:"mt-0.5 block truncate font-mono text-xs text-dim",title:ae(t.config),children:ae(t.config)})]}),e("span",{className:N("control.badge","shrink-0 text-[11px] text-dim"),children:t.scope==="project"?"项目":t.scope==="file"?".mcp.json":"全局"}),e(ye,{info:t})]}),e("span",{className:"relative flex size-10 shrink-0 items-center justify-center",children:!w&&e("input",{type:"checkbox","aria-label":`启用服务器 ${t.name}`,className:be,disabled:V||k,checked:!b,onChange:(x)=>L(t,x.target.checked)})})]},t.name)})})})]}),p&&!G&&e(Ne,{connection:a,info:p,onClose:()=>W(void 0),onEdit:()=>j({info:p}),onChanged:(t)=>t?l((b)=>b?.map((w)=>w.name===t.name?t:w)):M()},`${p.projectID}:${p.name}`),G&&e(ke,{connection:a,projectID:P===re?void 0:P,existing:G.info,taken:(S??[]).filter((t)=>t.scope===(P===re?"global":"project")).map((t)=>t.name),onClose:()=>j(void 0),onSaved:()=>{j(void 0),M()}})]})}export{nt as McpSection};
@@ -1 +0,0 @@
1
- import{wi}from"./chunk-jccz14ye.js";export{wi as default};