zen-code 4.7.4 → 4.8.1

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 (83) hide show
  1. package/dist/app.js +271 -0
  2. package/dist/chunk-0fhpz98a.js +2 -0
  3. package/dist/chunk-15smn69q.js +31 -0
  4. package/dist/chunk-3ep2tag7.js +2 -0
  5. package/dist/chunk-3jek9sxm.js +2 -0
  6. package/dist/chunk-3n2b4eb4.js +2 -0
  7. package/dist/chunk-3znrwnd8.js +1 -0
  8. package/dist/chunk-4b8yaknt.js +1 -0
  9. package/dist/chunk-5fqt5yg1.js +81 -0
  10. package/dist/chunk-5nzs0q25.js +1 -0
  11. package/dist/chunk-5wn1nfqy.js +6 -0
  12. package/dist/chunk-6ty22kkt.js +4 -0
  13. package/dist/chunk-70a0e941.js +1 -0
  14. package/dist/chunk-7dp8kq2f.js +2 -0
  15. package/dist/chunk-8nhayyat.js +1 -0
  16. package/dist/chunk-9k57afdm.js +2 -0
  17. package/dist/chunk-9kc9cea3.js +7 -0
  18. package/dist/chunk-bgpcx3bm.js +2 -0
  19. package/dist/chunk-bjywwcgn.js +26 -0
  20. package/dist/chunk-c9q11tk2.js +88 -0
  21. package/dist/chunk-cga0m5sy.js +1 -0
  22. package/dist/chunk-cze71w02.js +2 -0
  23. package/dist/chunk-czz2fs2w.js +7 -0
  24. package/dist/chunk-dh3jz71n.js +1 -0
  25. package/dist/chunk-e0sqjq2h.js +1 -0
  26. package/dist/chunk-efhkdw2z.js +1 -0
  27. package/dist/chunk-ew7249h9.js +1 -0
  28. package/dist/chunk-h5nnz4dy.js +1 -0
  29. package/dist/chunk-hww94vjn.js +1 -0
  30. package/dist/chunk-j1n8jp1w.js +253 -0
  31. package/dist/chunk-j204fejq.js +1 -0
  32. package/dist/chunk-jkbtx9va.js +2 -0
  33. package/dist/chunk-k67epfhc.js +1 -0
  34. package/dist/chunk-kbs4px1b.js +6 -0
  35. package/dist/chunk-keqk70wm.js +2 -0
  36. package/dist/chunk-kxk71nn0.js +1 -0
  37. package/dist/chunk-mg8zpgaz.js +1 -0
  38. package/dist/chunk-n1d8xx5k.js +2 -0
  39. package/dist/chunk-ndtwq2zx.js +2 -0
  40. package/dist/chunk-pdkbrds7.js +1 -0
  41. package/dist/chunk-q8arjxg1.js +23 -0
  42. package/dist/chunk-rdc9pxf6.js +1 -0
  43. package/dist/chunk-rrkzfahh.js +91 -0
  44. package/dist/chunk-s3fyfrka.js +2 -0
  45. package/dist/chunk-sft6ep0c.js +310 -0
  46. package/dist/chunk-vc384abg.js +3 -0
  47. package/dist/chunk-vjj00e3e.js +6 -0
  48. package/dist/chunk-vkng13p1.js +424 -0
  49. package/dist/chunk-wbn1hbxf.js +1 -0
  50. package/dist/chunk-wwn7gw8g.js +274 -0
  51. package/dist/chunk-yaa4eesd.js +2 -0
  52. package/dist/chunk-yvhq458c.js +25 -0
  53. package/dist/cli.js +2 -0
  54. package/dist/nonInteractive.js +4 -0
  55. package/dist/zen-keyboard.js +3 -0
  56. package/package.json +88 -87
  57. package/LICENSE +0 -201
  58. package/dist/FileSystemPluginStore-ChortK7z.mjs +0 -64
  59. package/dist/FileSystemSkillStore-Dl5briBv.mjs +0 -108
  60. package/dist/MultiLineTextInput-CL8nm9nv.mjs +0 -24492
  61. package/dist/_commonjsHelpers-DQNKXVTB.mjs +0 -33
  62. package/dist/app-CK3nD8Gj.mjs +0 -22428
  63. package/dist/checkpoint-C5AFBYE--CczNxXBB.mjs +0 -355
  64. package/dist/checkpoint-DxiUsHMy-B5iaccT2.mjs +0 -394
  65. package/dist/cli.mjs +0 -57
  66. package/dist/devtools-CzaVuYnh.mjs +0 -2667
  67. package/dist/graphBuilder-DJoMXf6J.mjs +0 -28909
  68. package/dist/index-BPG5Np-8.mjs +0 -144
  69. package/dist/index-Dxfhvdx8.mjs +0 -23
  70. package/dist/index-F6_SKYUd.mjs +0 -463
  71. package/dist/load-iYJqYrjn.mjs +0 -119
  72. package/dist/memories-CaHDnBK1.mjs +0 -115
  73. package/dist/metadata-XVTVXthy.mjs +0 -6
  74. package/dist/nonInteractive.mjs +0 -55
  75. package/dist/pg-adapter-BFtir1GE-BbUXBpaX.mjs +0 -60
  76. package/dist/queue-DySatFkr-CG2GdO4P.mjs +0 -106
  77. package/dist/remote-threads-CrG03ZS7-C9duTCnB.mjs +0 -157
  78. package/dist/shallow-G4eKoZ7M.mjs +0 -331
  79. package/dist/shallow-checkpoint-BEhTdp7z-DfHxnfoU.mjs +0 -383
  80. package/dist/sqlite-adapter-oBA95xba-BrBWorSV.mjs +0 -82
  81. package/dist/subTasks-DNjIN4eU.mjs +0 -18
  82. package/dist/zen-code.mjs +0 -3
  83. package/dist/zen-keyboard.mjs +0 -13
@@ -0,0 +1,4 @@
1
+ import{L as n}from"./chunk-3n2b4eb4.js";import{M as o}from"./chunk-keqk70wm.js";import{P as m,S as d,T as x}from"./chunk-9kc9cea3.js";import{ca as u,da as X,ea as G,ha as a,ka as g,la as D,ma as E}from"./chunk-wwn7gw8g.js";import"./chunk-dh3jz71n.js";import"./chunk-yaa4eesd.js";import"./chunk-jkbtx9va.js";import"./chunk-kbs4px1b.js";import"./chunk-9k57afdm.js";import{nb as S}from"./chunk-cze71w02.js";var H=S(u(),1);var b=S(u(),1);var _=S(D(),1);function Xz(Y){try{let $=JSON.parse(Y);if(typeof $!=="object"||$===null)return{isValid:!1,error:{message:"配置必须是 JSON 对象"}};if(!$.command&&!$.url)return{isValid:!1,error:{message:'配置必须包含 "command" (stdio) 或 "url" (SSE)'}};return{isValid:!0,config:$}}catch($){let L=$ instanceof Error?$.message:String($),B=L.match(/position (\d+)/),Q=B?parseInt(B[1],10):void 0;return{isValid:!1,error:{message:`JSON 格式错误: ${L}`,line:Q}}}}function Yz(Y,$,L){if(!Y||Y.length<2||Y.length>32)return"名称必须为 2-32 个字符";if(!/^[a-zA-Z0-9_-]+$/.test(Y))return"名称只能包含字母、数字、下划线和连字符";if($.includes(Y)&&Y!==L)return"名称已存在";return null}function Zz(Y,$=2){return JSON.stringify(Y,null,$)}var _z=[{key:"serverName",label:"Server ID"},{key:"config",label:"Config (JSON)"}],$z=({mode:Y,serverName:$,serverConfig:L,onCancel:B,onSave:Q})=>{let[O,y]=b.useState({serverName:$||"",configJSON:L?Zz(L):""}),[F,I]=b.useState(0),[j,V]=b.useState(null),M=b.useMemo(()=>{return[]},[]),U=b.useMemo(()=>{return Xz(O.configJSON)},[O.configJSON]),k=b.useCallback(()=>{let A=Yz(O.serverName,M,Y==="edit"?$:void 0);return V(A),A===null},[O.serverName,M,$,Y]),N=b.useCallback(()=>{if(Y==="add"&&!k())return;if(!U.isValid||!U.config)return;Q(O.serverName,U.config)},[Y,O.serverName,U,Q,k]),w=b.useCallback((A)=>{let h=Y==="add"?_z.length-1:1,q=A==="next"?(F+1)%h:(F-1+h)%h;I(q)},[F,Y]),f=()=>{if(Y!=="add")return null;let A=F===0,h=j!==null;return _.jsxDEV(X,{marginBottom:1,children:[_.jsxDEV(G,{color:A?"cyan":h?"red":"gray",children:"Server ID: "},void 0,!1,void 0,this),A?_.jsxDEV(X,{width:40,children:_.jsxDEV(E,{value:O.serverName,onChange:(q)=>{y((K)=>({...K,serverName:q})),V(null)},onSubmit:N,placeholder:"my-server",maxVisibleLines:1,showCursor:!0},void 0,!1,void 0,this)},void 0,!1,void 0,this):_.jsxDEV(G,{children:O.serverName||"my-server"},void 0,!1,void 0,this),h&&_.jsxDEV(G,{color:"red",children:[" ",j]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},p=()=>{let A=Y==="add"?F===1:F===0,h=U.isValid;return _.jsxDEV(X,{flexDirection:"column",marginBottom:1,children:[_.jsxDEV(G,{color:A?"cyan":"gray",children:"Config (JSON):"},void 0,!1,void 0,this),_.jsxDEV(X,{marginTop:1,children:_.jsxDEV(E,{value:O.configJSON,onChange:(q)=>y((K)=>({...K,configJSON:q})),onSubmit:N,placeholder:`{
2
+ "command": "npx",
3
+ "args": ["-y", "..."]
4
+ }`,showCursor:!0},void 0,!1,void 0,this)},void 0,!1,void 0,this),O.configJSON&&_.jsxDEV(X,{marginTop:1,children:h?_.jsxDEV(G,{color:"green",children:"✓ JSON 格式有效"},void 0,!1,void 0,this):_.jsxDEV(G,{color:"red",children:["✗ ",U.error?.message||"JSON 格式错误"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},P=()=>_.jsxDEV(X,{marginTop:1,children:_.jsxDEV(G,{color:"gray",dimColor:!0,children:[_.jsxDEV(G,{color:"cyan",children:"Enter"},void 0,!1,void 0,this)," 保存 ",_.jsxDEV(G,{color:"cyan",children:"Tab"},void 0,!1,void 0,this)," 切换字段"," ",_.jsxDEV(G,{color:"cyan",children:"Esc"},void 0,!1,void 0,this)," 取消"]},void 0,!0,void 0,this)},void 0,!1,void 0,this);return _.jsxDEV(X,{flexDirection:"column",paddingX:2,children:[_.jsxDEV(X,{marginBottom:1,children:_.jsxDEV(G,{bold:!0,color:"cyan",children:Y==="add"?"Add MCP Server":`Edit MCP Server: ${$}`},void 0,!1,void 0,this)},void 0,!1,void 0,this),_.jsxDEV(X,{flexDirection:"column",gap:1,children:[f(),p()]},void 0,!0,void 0,this),P()]},void 0,!0,void 0,this)},l=$z;function i({mcpConfig:Y,updateConfig:$}){let L=m(),B=d({mutationFn:async(Q)=>{return await $({mcp_config:Q}),Q},onSuccess:(Q)=>{L.setQueryData(x.mcp.config(),Q)}});return{mcpConfig:Y,updateMcpConfig:B.mutateAsync,isUpdating:B.isPending}}var z=S(D(),1),Hz=({onClose:Y})=>{let{config:$,updateConfig:L}=o(),B=$?.mcp_config||{},{mcpConfig:Q,updateMcpConfig:O}=i({mcpConfig:B,updateConfig:L}),[y,F]=H.useState("list"),[I,j]=H.useState("add"),[V,M]=H.useState(null),[U,k]=H.useState(0),[N,w]=H.useState(null),[f,p]=H.useState(null),[P,A]=H.useState(null),h=H.useCallback(()=>w(null),[]);n(h,N?3000:null);let q=Object.keys(Q),K=q[U],R=K?Q[K]:null,v=H.useCallback((W)=>{if(W.command)return"stdio";if(W.url)return"SSE";return"unknown"},[]),r=H.useCallback(()=>{j("add"),M(null),F("json"),w(null)},[]),t=H.useCallback(()=>{if(!K||!R)return;j("edit"),M(K),F("json"),w(null)},[K,R]),s=H.useCallback(async()=>{if(!K||!R)return;p(K),A(null),F("test");try{let W=!!(R.command&&R.args),Z=!!R.url;if(!W&&!Z){A({success:!1,message:"配置无效:必须包含 command (stdio) 或 url (SSE)"});return}if(W&&(!R.command||!Array.isArray(R.args))){A({success:!1,message:"配置无效:stdio 模式需要 command 和 args 字段"});return}A({success:!0,message:`配置格式验证通过 (${Z?"SSE":"stdio"} 模式)`,tools:[]})}catch(W){A({success:!1,message:`验证失败: ${W instanceof Error?W.message:String(W)}`})}},[K,R]),C=H.useCallback(()=>{F("list"),M(null),A(null),w(null)},[]),e=H.useCallback(async(W,Z)=>{let J={...Q};if(J[W]=Z,await O(J),w(I==="add"?`已添加服务器: ${W}`:`已更新服务器: ${W}`),I==="add"){let T=Object.keys(J).findIndex((c)=>c===W);k(T>=0?T:0)}C()},[I,Q,O,C]),zz=H.useCallback(async()=>{if(!K)return;let W={...Q};delete W[K],await O(W);let Z=Math.min(U,Object.keys(W).length-1);k(Z>=0?Z:0),w(`已删除服务器: ${K}`)},[K,U,Q,O]);g((W,Z)=>{if(y==="json"||y==="test"){if(Z.escape)C();return}if(Z.upArrow)k((J)=>J>0?J-1:q.length-1);else if(Z.downArrow)k((J)=>J<q.length-1?J+1:0);else if(W==="n"||W==="N")r();else if((W==="e"||W==="E"||Z.return)&&K)t();else if((W==="d"||W==="D")&&K)zz();else if((W==="t"||W==="T")&&K)s();else if(Z.escape)Y()},{isActive:!0});let Gz=H.useMemo(()=>{if(q.length===0)return z.jsxDEV(X,{paddingX:2,paddingY:1,children:[z.jsxDEV(G,{color:"yellow",children:"未配置任何 MCP 服务器"},void 0,!1,void 0,this),z.jsxDEV(X,{marginTop:1,children:z.jsxDEV(G,{color:"gray",dimColor:!0,children:["按 ",z.jsxDEV(G,{color:"cyan",children:"n"},void 0,!1,void 0,this)," 添加新服务器"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return z.jsxDEV(X,{flexDirection:"column",paddingX:2,gap:1,children:[q.map((W,Z)=>{let J=Q[W],T=v(J);return z.jsxDEV(X,{marginBottom:0,gap:1,children:[z.jsxDEV(G,{color:Z===U?"cyan":"gray",bold:Z===U,children:Z===U?">":" "},void 0,!1,void 0,this),z.jsxDEV(G,{bold:Z===U,color:Z===U?"cyan":void 0,children:W},void 0,!1,void 0,this),z.jsxDEV(a,{},void 0,!1,void 0,this),z.jsxDEV(G,{color:T==="stdio"?"green":T==="SSE"?"blue":"yellow",dimColor:Z!==U,children:["[",T.toUpperCase(),"]"]},void 0,!0,void 0,this)]},`server-${Z}-${W}`,!0,void 0,this)}),z.jsxDEV(X,{marginTop:1,children:z.jsxDEV(G,{color:"gray",dimColor:!0,children:[z.jsxDEV(G,{color:"cyan",children:"↑↓"},void 0,!1,void 0,this)," 导航 ",z.jsxDEV(G,{color:"cyan",children:"n"},void 0,!1,void 0,this)," 新增 ",z.jsxDEV(G,{color:"cyan",children:"e"},void 0,!1,void 0,this)," ","编辑 ",z.jsxDEV(G,{color:"cyan",children:"d"},void 0,!1,void 0,this)," 删除 ",z.jsxDEV(G,{color:"cyan",children:"t"},void 0,!1,void 0,this)," 测试"," ",z.jsxDEV(G,{color:"cyan",children:"Esc"},void 0,!1,void 0,this)," 关闭"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},[q,Q,U,v]),Wz=H.useMemo(()=>{if(!f||!P)return z.jsxDEV(X,{paddingX:2,paddingY:1,children:z.jsxDEV(G,{color:"yellow",children:"正在验证配置..."},void 0,!1,void 0,this)},void 0,!1,void 0,this);if(P.success)return z.jsxDEV(X,{flexDirection:"column",paddingX:2,gap:1,children:[z.jsxDEV(X,{children:z.jsxDEV(G,{color:"green",children:["✓ ",P.message]},void 0,!0,void 0,this)},void 0,!1,void 0,this),P.tools&&P.tools.length>0&&z.jsxDEV(X,{flexDirection:"column",marginTop:1,children:[z.jsxDEV(G,{color:"gray",children:["发现 ",P.tools.length," 个工具:"]},void 0,!0,void 0,this),P.tools.slice(0,10).map((W)=>z.jsxDEV(X,{paddingLeft:2,children:z.jsxDEV(G,{color:"gray",children:["- ",W]},void 0,!0,void 0,this)},W,!1,void 0,this)),P.tools.length>10&&z.jsxDEV(X,{paddingLeft:2,children:z.jsxDEV(G,{color:"gray",children:["... 还有 ",P.tools.length-10," 个工具"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV(X,{marginTop:1,children:z.jsxDEV(G,{color:"gray",dimColor:!0,children:["按 ",z.jsxDEV(G,{color:"cyan",children:"Enter"},void 0,!1,void 0,this)," 关闭"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);else return z.jsxDEV(X,{flexDirection:"column",paddingX:2,gap:1,children:[z.jsxDEV(X,{children:z.jsxDEV(G,{color:"red",children:"✗ 验证失败"},void 0,!1,void 0,this)},void 0,!1,void 0,this),z.jsxDEV(X,{children:z.jsxDEV(G,{color:"yellow",children:P.message},void 0,!1,void 0,this)},void 0,!1,void 0,this),z.jsxDEV(X,{marginTop:1,children:[z.jsxDEV(G,{color:"gray",children:"建议检查:"},void 0,!1,void 0,this),z.jsxDEV(G,{color:"gray",children:"- 配置格式是否正确"},void 0,!1,void 0,this),z.jsxDEV(G,{color:"gray",children:"- 命令是否已安装(stdio 模式)"},void 0,!1,void 0,this),z.jsxDEV(G,{color:"gray",children:"- URL 是否可访问(SSE 模式)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV(X,{marginTop:1,children:z.jsxDEV(G,{color:"gray",dimColor:!0,children:["按 ",z.jsxDEV(G,{color:"cyan",children:"Enter"},void 0,!1,void 0,this)," 关闭"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},[f,P]);return g((W,Z)=>{if(y==="test"&&Z.return)C()},{isActive:y==="test"}),z.jsxDEV(X,{flexDirection:"column",children:[z.jsxDEV(X,{paddingX:2,paddingY:1,children:z.jsxDEV(G,{bold:!0,color:"cyan",children:"MCP Servers"},void 0,!1,void 0,this)},void 0,!1,void 0,this),y==="list"?Gz:y==="json"?z.jsxDEV(l,{mode:I,serverName:V||void 0,serverConfig:R||void 0,onCancel:C,onSave:e},void 0,!1,void 0,this):Wz,N&&z.jsxDEV(X,{paddingX:2,paddingY:0,children:z.jsxDEV(G,{color:"green",children:N},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},kz=Hz;export{kz as default};
@@ -0,0 +1 @@
1
+ import{lb as a}from"./chunk-kbs4px1b.js";import"./chunk-cze71w02.js";export{a as FileSystemSkillStore};
@@ -0,0 +1,2 @@
1
+ import{ob as L}from"./chunk-cze71w02.js";var N=L((O,D)=>{var I=[0,4129,8258,12387,16516,20645,24774,28903,33032,37161,41290,45419,49548,53677,57806,61935,4657,528,12915,8786,21173,17044,29431,25302,37689,33560,45947,41818,54205,50076,62463,58334,9314,13379,1056,5121,25830,29895,17572,21637,42346,46411,34088,38153,58862,62927,50604,54669,13907,9842,5649,1584,30423,26358,22165,18100,46939,42874,38681,34616,63455,59390,55197,51132,18628,22757,26758,30887,2112,6241,10242,14371,51660,55789,59790,63919,35144,39273,43274,47403,23285,19156,31415,27286,6769,2640,14899,10770,56317,52188,64447,60318,39801,35672,47931,43802,27814,31879,19684,23749,11298,15363,3168,7233,60846,64911,52716,56781,44330,48395,36200,40265,32407,28342,24277,20212,15891,11826,7761,3696,65439,61374,57309,53244,48923,44858,40793,36728,37256,33193,45514,41451,53516,49453,61774,57711,4224,161,12482,8419,20484,16421,28742,24679,33721,37784,41979,46042,49981,54044,58239,62302,689,4752,8947,13010,16949,21012,25207,29270,46570,42443,38312,34185,62830,58703,54572,50445,13538,9411,5280,1153,29798,25671,21540,17413,42971,47098,34713,38840,59231,63358,50973,55100,9939,14066,1681,5808,26199,30326,17941,22068,55628,51565,63758,59695,39368,35305,47498,43435,22596,18533,30726,26663,6336,2273,14466,10403,52093,56156,60223,64286,35833,39896,43963,48026,19061,23124,27191,31254,2801,6864,10931,14994,64814,60687,56684,52557,48554,44427,40424,36297,31782,27655,23652,19525,15522,11395,7392,3265,61215,65342,53085,57212,44955,49082,36825,40952,28183,32310,20053,24180,11923,16050,3793,7920],M=function(x){var j,z=0,q=0,w=[],B=x.length;for(;z<B;z++)if(j=x.charCodeAt(z),j<128)w[q++]=j;else if(j<2048)w[q++]=j>>6|192,w[q++]=j&63|128;else if((j&64512)===55296&&z+1<x.length&&(x.charCodeAt(z+1)&64512)===56320)j=65536+((j&1023)<<10)+(x.charCodeAt(++z)&1023),w[q++]=j>>18|240,w[q++]=j>>12&63|128,w[q++]=j>>6&63|128,w[q++]=j&63|128;else w[q++]=j>>12|224,w[q++]=j>>6&63|128,w[q++]=j&63|128;return w},J=D.exports=function(x){var j,z=0,q=-1,w=0,B=0,G=typeof x==="string"?M(x):x,K=G.length;while(z<K){if(j=G[z++],q===-1){if(j===123)q=z}else if(j!==125)B=I[(j^B>>8)&255]^B<<8;else if(z-1!==q)return B&16383;w=I[(j^w>>8)&255]^w<<8}return w&16383};D.exports.generateMulti=function(x){var j=1,z=x.length,q=J(x[0]);while(j<z)if(J(x[j++])!==q)return-1;return q}});
2
+ export{N as c};
@@ -0,0 +1 @@
1
+ import{wa as a}from"./chunk-15smn69q.js";import"./chunk-n1d8xx5k.js";import"./chunk-cze71w02.js";export{a as MemoriesMiddleware};
@@ -0,0 +1,2 @@
1
+ import k from"fs/promises";import q from"path";import z from"os";class A{pluginsDir;constructor(){let b=z.homedir();this.pluginsDir=q.join(b,".zen-code","plugins")}async listPlugins(){try{let b=await k.readdir(this.pluginsDir,{withFileTypes:!0}),d=[];for(let j of b)if(j.isDirectory()){let v=q.join(this.pluginsDir,j.name,"plugin.json");try{let x=await k.readFile(v,"utf-8"),w=JSON.parse(x);d.push({name:j.name,version:w.version||"0.0.0",enabled:w.enabled!==!1})}catch{}}return d}catch{return[]}}async getPluginConfig(b){let d=q.join(this.pluginsDir,b,"plugin.json");try{let j=await k.readFile(d,"utf-8");return JSON.parse(j)}catch{return null}}async updatePluginConfig(b,d){let j=q.join(this.pluginsDir,b);await k.mkdir(j,{recursive:!0});let v=q.join(j,"plugin.json");await k.writeFile(v,JSON.stringify(d,null,2),"utf-8")}async installPlugin(b,d){let j=q.join(this.pluginsDir,b);await k.mkdir(j,{recursive:!0});let v={name:b,version:"0.0.1",enabled:!0,source:d};await this.updatePluginConfig(b,v)}async uninstallPlugin(b){let d=q.join(this.pluginsDir,b);await k.rm(d,{recursive:!0,force:!0})}}
2
+ export{A as mb};
@@ -0,0 +1,7 @@
1
+ import{ca as c}from"./chunk-wwn7gw8g.js";import{nb as h,ob as wY}from"./chunk-cze71w02.js";var IX=wY((DY)=>{var p=h(c());(function(){function X($){if($==null)return null;if(typeof $==="function")return $.$$typeof===i?null:$.displayName||$.name||null;if(typeof $==="string")return $;switch($){case L:return"Fragment";case k:return"Profiler";case P:return"StrictMode";case b:return"Suspense";case YX:return"SuspenseList";case d:return"Activity"}if(typeof $==="object")switch(typeof $.tag==="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),$.$$typeof){case w:return"Portal";case R:return $.displayName||"Context";case S:return($._context.displayName||"Context")+".Consumer";case g:var V=$.render;return $=$.displayName,$||($=V.displayName||V.name||"",$=$!==""?"ForwardRef("+$+")":"ForwardRef"),$;case O:return V=$.displayName||null,V!==null?V:X($.type)||"Memo";case Q:V=$._payload,$=$._init;try{return X($(V))}catch(D){}}return null}function Y($){return""+$}function G($){try{Y($);var V=!1}catch(_X){V=!0}if(V){V=console;var D=V.error,T=typeof Symbol==="function"&&Symbol.toStringTag&&$[Symbol.toStringTag]||$.constructor.name||"Object";return D.call(V,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",T),Y($)}}function J($){if($===L)return"<>";if(typeof $==="object"&&$!==null&&$.$$typeof===Q)return"<...>";try{var V=X($);return V?"<"+V+">":"<...>"}catch(D){return"<...>"}}function Z(){var $=s.A;return $===null?null:$.getOwner()}function H(){return Error("react-stack-top-frame")}function _($){if(y.call($,"key")){var V=Object.getOwnPropertyDescriptor($,"key").get;if(V&&V.isReactWarning)return!1}return $.key!==void 0}function W($,V){function D(){vX||(vX=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",V))}D.isReactWarning=!0,Object.defineProperty($,"key",{get:D,configurable:!0})}function A(){var $=X(this.type);return gX[$]||(gX[$]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),$=this.props.ref,$!==void 0?$:null}function U($,V,D,T,_X,KX){var I=D.ref;return $={$$typeof:K,type:$,key:V,props:D,_owner:T},(I!==void 0?I:null)!==null?Object.defineProperty($,"ref",{enumerable:!1,get:A}):Object.defineProperty($,"ref",{enumerable:!1,value:null}),$._store={},Object.defineProperty($._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty($,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty($,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:_X}),Object.defineProperty($,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:KX}),Object.freeze&&(Object.freeze($.props),Object.freeze($)),$}function z($,V,D,T,_X,KX){var I=V.children;if(I!==void 0)if(T)if(n(I)){for(T=0;T<I.length;T++)E(I[T]);Object.freeze&&Object.freeze(I)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else E(I);if(y.call(V,"key")){I=X($);var a=Object.keys(V).filter(function(BY){return BY!=="key"});T=0<a.length?"{key: someKey, "+a.join(": ..., ")+": ...}":"{key: someKey}",mX[I+T]||(a=0<a.length?"{"+a.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
2
+ let props = %s;
3
+ <%s {...props} />
4
+ React keys must be passed directly to JSX without using spread:
5
+ let props = %s;
6
+ <%s key={someKey} {...props} />`,T,I,a,I),mX[I+T]=!0)}if(I=null,D!==void 0&&(G(D),I=""+D),_(V)&&(G(V.key),I=""+V.key),"key"in V){D={};for(var TX in V)TX!=="key"&&(D[TX]=V[TX])}else D=V;return I&&W(D,typeof $==="function"?$.displayName||$.name||"Unknown":$),U($,I,D,Z(),_X,KX)}function E($){N($)?$._store&&($._store.validated=1):typeof $==="object"&&$!==null&&$.$$typeof===Q&&($._payload.status==="fulfilled"?N($._payload.value)&&$._payload.value._store&&($._payload.value._store.validated=1):$._store&&($._store.validated=1))}function N($){return typeof $==="object"&&$!==null&&$.$$typeof===K}var K=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),L=Symbol.for("react.fragment"),P=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),S=Symbol.for("react.consumer"),R=Symbol.for("react.context"),g=Symbol.for("react.forward_ref"),b=Symbol.for("react.suspense"),YX=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),Q=Symbol.for("react.lazy"),d=Symbol.for("react.activity"),i=Symbol.for("react.client.reference"),s=p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,y=Object.prototype.hasOwnProperty,n=Array.isArray,EX=console.createTask?console.createTask:function(){return null};p={react_stack_bottom_frame:function($){return $()}};var vX,gX={},bX=p.react_stack_bottom_frame.bind(p,H)(),hX=EX(J(H)),mX={};DY.Fragment=L,DY.jsx=function($,V,D){var T=1e4>s.recentlyCreatedOwnerStacks++;return z($,V,D,!1,T?Error("react-stack-top-frame"):bX,T?EX(J($)):hX)},DY.jsxs=function($,V,D){var T=1e4>s.recentlyCreatedOwnerStacks++;return z($,V,D,!0,T?Error("react-stack-top-frame"):bX,T?EX(J($)):hX)}})()});var o=h(c(),1),fX=h(IX(),1),PX=o.createContext(void 0),GX=(X)=>{let Y=o.useContext(PX);if(X)return X;if(!Y)throw Error("No QueryClient set, use QueryClientProvider to set one");return Y},FY=({client:X,children:Y})=>{return o.useEffect(()=>{return X.mount(),()=>{X.unmount()}},[X]),fX.jsx(PX.Provider,{value:X,children:Y})};var M=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(X){return this.listeners.add(X),this.onSubscribe(),()=>{this.listeners.delete(X),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}};var EY={setTimeout:(X,Y)=>setTimeout(X,Y),clearTimeout:(X)=>clearTimeout(X),setInterval:(X,Y)=>setInterval(X,Y),clearInterval:(X)=>clearInterval(X)},KY=class{#X=EY;#Y=!1;setTimeoutProvider(X){if(this.#Y&&X!==this.#X)console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:this.#X,provider:X});this.#X=X,this.#Y=!1}setTimeout(X,Y){return this.#Y=!0,this.#X.setTimeout(X,Y)}clearTimeout(X){this.#X.clearTimeout(X)}setInterval(X,Y){return this.#Y=!0,this.#X.setInterval(X,Y)}clearInterval(X){this.#X.clearInterval(X)}},q=new KY;function dX(X){setTimeout(X,0)}var x=typeof window>"u"||"Deno"in globalThis;function F(){}function cX(X,Y){return typeof X==="function"?X(Y):X}function JX(X){return typeof X==="number"&&X>=0&&X!==1/0}function VX(X,Y){return Math.max(X+(Y||0)-Date.now(),0)}function C(X,Y){return typeof X==="function"?X(Y):X}function j(X,Y){return typeof X==="function"?X(Y):X}function AX(X,Y){let{type:G="all",exact:J,fetchStatus:Z,predicate:H,queryKey:_,stale:W}=X;if(_){if(J){if(Y.queryHash!==ZX(_,Y.options))return!1}else if(!u(Y.queryKey,_))return!1}if(G!=="all"){let A=Y.isActive();if(G==="active"&&!A)return!1;if(G==="inactive"&&A)return!1}if(typeof W==="boolean"&&Y.isStale()!==W)return!1;if(Z&&Z!==Y.state.fetchStatus)return!1;if(H&&!H(Y))return!1;return!0}function NX(X,Y){let{exact:G,status:J,predicate:Z,mutationKey:H}=X;if(H){if(!Y.options.mutationKey)return!1;if(G){if(v(Y.options.mutationKey)!==v(H))return!1}else if(!u(Y.options.mutationKey,H))return!1}if(J&&Y.state.status!==J)return!1;if(Z&&!Z(Y))return!1;return!0}function ZX(X,Y){return(Y?.queryKeyHashFn||v)(X)}function v(X){return JSON.stringify(X,(Y,G)=>kX(G)?Object.keys(G).sort().reduce((J,Z)=>{return J[Z]=G[Z],J},{}):G)}function u(X,Y){if(X===Y)return!0;if(typeof X!==typeof Y)return!1;if(X&&Y&&typeof X==="object"&&typeof Y==="object")return Object.keys(Y).every((G)=>u(X[G],Y[G]));return!1}var TY=Object.prototype.hasOwnProperty;function zX(X,Y,G=0){if(X===Y)return X;if(G>500)return Y;let J=yX(X)&&yX(Y);if(!J&&!(kX(X)&&kX(Y)))return Y;let H=(J?X:Object.keys(X)).length,_=J?Y:Object.keys(Y),W=_.length,A=J?Array(W):{},U=0;for(let z=0;z<W;z++){let E=J?z:_[z],N=X[E],K=Y[E];if(N===K){if(A[E]=N,J?z<H:TY.call(X,E))U++;continue}if(N===null||K===null||typeof N!=="object"||typeof K!=="object"){A[E]=K;continue}let w=zX(N,K,G+1);if(A[E]=w,w===N)U++}return H===W&&U===H?X:A}function r(X,Y){if(!Y||Object.keys(X).length!==Object.keys(Y).length)return!1;for(let G in X)if(X[G]!==Y[G])return!1;return!0}function yX(X){return Array.isArray(X)&&X.length===Object.keys(X).length}function kX(X){if(!pX(X))return!1;let Y=X.constructor;if(Y===void 0)return!0;let G=Y.prototype;if(!pX(G))return!1;if(!G.hasOwnProperty("isPrototypeOf"))return!1;if(Object.getPrototypeOf(X)!==Object.prototype)return!1;return!0}function pX(X){return Object.prototype.toString.call(X)==="[object Object]"}function lX(X){return new Promise((Y)=>{q.setTimeout(Y,X)})}function $X(X,Y,G){if(typeof G.structuralSharing==="function")return G.structuralSharing(X,Y);else if(G.structuralSharing!==!1){try{return zX(X,Y)}catch(J){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${G.queryHash}]: ${J}`),J}return zX(X,Y)}return Y}function uX(X,Y,G=0){let J=[...X,Y];return G&&J.length>G?J.slice(1):J}function iX(X,Y,G=0){let J=[Y,...X];return G&&J.length>G?J.slice(0,-1):J}var l=Symbol();function LX(X,Y){if(X.queryFn===l)console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${X.queryHash}'`);if(!X.queryFn&&Y?.initialPromise)return()=>Y.initialPromise;if(!X.queryFn||X.queryFn===l)return()=>Promise.reject(Error(`Missing queryFn: '${X.queryHash}'`));return X.queryFn}function t(X,Y){if(typeof X==="function")return X(...Y);return!!X}function sX(X,Y,G){let J=!1,Z;return Object.defineProperty(X,"signal",{enumerable:!0,get:()=>{if(Z??=Y(),J)return Z;if(J=!0,Z.aborted)G();else Z.addEventListener("abort",G,{once:!0});return Z}}),X}var IY=class extends M{#X;#Y;#G;constructor(){super();this.#G=(X)=>{if(!x&&window.addEventListener){let Y=()=>X();return window.addEventListener("visibilitychange",Y,!1),()=>{window.removeEventListener("visibilitychange",Y)}}return}}onSubscribe(){if(!this.#Y)this.setEventListener(this.#G)}onUnsubscribe(){if(!this.hasListeners())this.#Y?.(),this.#Y=void 0}setEventListener(X){this.#G=X,this.#Y?.(),this.#Y=X((Y)=>{if(typeof Y==="boolean")this.setFocused(Y);else this.onFocus()})}setFocused(X){if(this.#X!==X)this.#X=X,this.onFocus()}onFocus(){let X=this.isFocused();this.listeners.forEach((Y)=>{Y(X)})}isFocused(){if(typeof this.#X==="boolean")return this.#X;return globalThis.document?.visibilityState!=="hidden"}},e=new IY;function WX(){let X,Y,G=new Promise((Z,H)=>{X=Z,Y=H});G.status="pending",G.catch(()=>{});function J(Z){Object.assign(G,Z),delete G.resolve,delete G.reject}return G.resolve=(Z)=>{J({status:"fulfilled",value:Z}),X(Z)},G.reject=(Z)=>{J({status:"rejected",reason:Z}),Y(Z)},G}var nX=dX;function PY(){let X=[],Y=0,G=(W)=>{W()},J=(W)=>{W()},Z=nX,H=(W)=>{if(Y)X.push(W);else Z(()=>{G(W)})},_=()=>{let W=X;if(X=[],W.length)Z(()=>{J(()=>{W.forEach((A)=>{G(A)})})})};return{batch:(W)=>{let A;Y++;try{A=W()}finally{if(Y--,!Y)_()}return A},batchCalls:(W)=>{return(...A)=>{H(()=>{W(...A)})}},schedule:H,setNotifyFunction:(W)=>{G=W},setBatchNotifyFunction:(W)=>{J=W},setScheduler:(W)=>{Z=W}}}var B=PY();var kY=class extends M{#X=!0;#Y;#G;constructor(){super();this.#G=(X)=>{if(!x&&window.addEventListener){let Y=()=>X(!0),G=()=>X(!1);return window.addEventListener("online",Y,!1),window.addEventListener("offline",G,!1),()=>{window.removeEventListener("online",Y),window.removeEventListener("offline",G)}}return}}onSubscribe(){if(!this.#Y)this.setEventListener(this.#G)}onUnsubscribe(){if(!this.hasListeners())this.#Y?.(),this.#Y=void 0}setEventListener(X){this.#G=X,this.#Y?.(),this.#Y=X(this.setOnline.bind(this))}setOnline(X){if(this.#X!==X)this.#X=X,this.listeners.forEach((G)=>{G(X)})}isOnline(){return this.#X}},XX=new kY;function QY(X){return Math.min(1000*2**X,30000)}function QX(X){return(X??"online")==="online"?XX.isOnline():!0}var UX=class extends Error{constructor(X){super("CancelledError");this.revert=X?.revert,this.silent=X?.silent}};function BX(X){let Y=!1,G=0,J,Z=WX(),H=()=>Z.status!=="pending",_=(L)=>{if(!H()){let P=new UX(L);N(P),X.onCancel?.(P)}},W=()=>{Y=!0},A=()=>{Y=!1},U=()=>e.isFocused()&&(X.networkMode==="always"||XX.isOnline())&&X.canRun(),z=()=>QX(X.networkMode)&&X.canRun(),E=(L)=>{if(!H())J?.(),Z.resolve(L)},N=(L)=>{if(!H())J?.(),Z.reject(L)},K=()=>{return new Promise((L)=>{J=(P)=>{if(H()||U())L(P)},X.onPause?.()}).then(()=>{if(J=void 0,!H())X.onContinue?.()})},w=()=>{if(H())return;let L,P=G===0?X.initialPromise:void 0;try{L=P??X.fn()}catch(k){L=Promise.reject(k)}Promise.resolve(L).then(E).catch((k)=>{if(H())return;let S=X.retry??(x?0:3),R=X.retryDelay??QY,g=typeof R==="function"?R(G,k):R,b=S===!0||typeof S==="number"&&G<S||typeof S==="function"&&S(G,k);if(Y||!b){N(k);return}G++,X.onFail?.(G,k),lX(g).then(()=>{return U()?void 0:K()}).then(()=>{if(Y)N(k);else w()})})};return{promise:Z,status:()=>Z.status,cancel:_,continue:()=>{return J?.(),Z},cancelRetry:W,continueRetry:A,canStart:z,start:()=>{if(z())w();else K().then(w);return Z}}}var wX=class{#X;destroy(){this.clearGcTimeout()}scheduleGc(){if(this.clearGcTimeout(),JX(this.gcTime))this.#X=q.setTimeout(()=>{this.optionalRemove()},this.gcTime)}updateGcTime(X){this.gcTime=Math.max(this.gcTime||0,X??(x?1/0:300000))}clearGcTimeout(){if(this.#X)q.clearTimeout(this.#X),this.#X=void 0}};var rX=class extends wX{#X;#Y;#G;#Z;#J;#W;#H;constructor(X){super();this.#H=!1,this.#W=X.defaultOptions,this.setOptions(X.options),this.observers=[],this.#Z=X.client,this.#G=this.#Z.getQueryCache(),this.queryKey=X.queryKey,this.queryHash=X.queryHash,this.#X=oX(this.options),this.state=X.state??this.#X,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#J?.promise}setOptions(X){if(this.options={...this.#W,...X},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let Y=oX(this.options);if(Y.data!==void 0)this.setState(aX(Y.data,Y.dataUpdatedAt)),this.#X=Y}}optionalRemove(){if(!this.observers.length&&this.state.fetchStatus==="idle")this.#G.remove(this)}setData(X,Y){let G=$X(this.state.data,X,this.options);return this.#$({data:G,type:"success",dataUpdatedAt:Y?.updatedAt,manual:Y?.manual}),G}setState(X,Y){this.#$({type:"setState",state:X,setStateOptions:Y})}cancel(X){let Y=this.#J?.promise;return this.#J?.cancel(X),Y?Y.then(F).catch(F):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#X)}isActive(){return this.observers.some((X)=>j(X.options.enabled,this)!==!1)}isDisabled(){if(this.getObserversCount()>0)return!this.isActive();return this.options.queryFn===l||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){if(this.getObserversCount()>0)return this.observers.some((X)=>C(X.options.staleTime,this)==="static");return!1}isStale(){if(this.getObserversCount()>0)return this.observers.some((X)=>X.getCurrentResult().isStale);return this.state.data===void 0||this.state.isInvalidated}isStaleByTime(X=0){if(this.state.data===void 0)return!0;if(X==="static")return!1;if(this.state.isInvalidated)return!0;return!VX(this.state.dataUpdatedAt,X)}onFocus(){this.observers.find((Y)=>Y.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#J?.continue()}onOnline(){this.observers.find((Y)=>Y.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#J?.continue()}addObserver(X){if(!this.observers.includes(X))this.observers.push(X),this.clearGcTimeout(),this.#G.notify({type:"observerAdded",query:this,observer:X})}removeObserver(X){if(this.observers.includes(X)){if(this.observers=this.observers.filter((Y)=>Y!==X),!this.observers.length){if(this.#J)if(this.#H)this.#J.cancel({revert:!0});else this.#J.cancelRetry();this.scheduleGc()}this.#G.notify({type:"observerRemoved",query:this,observer:X})}}getObserversCount(){return this.observers.length}invalidate(){if(!this.state.isInvalidated)this.#$({type:"invalidate"})}async fetch(X,Y){if(this.state.fetchStatus!=="idle"&&this.#J?.status()!=="rejected"){if(this.state.data!==void 0&&Y?.cancelRefetch)this.cancel({silent:!0});else if(this.#J)return this.#J.continueRetry(),this.#J.promise}if(X)this.setOptions(X);if(!this.options.queryFn){let W=this.observers.find((A)=>A.options.queryFn);if(W)this.setOptions(W.options)}if(!Array.isArray(this.options.queryKey))console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']");let G=new AbortController,J=(W)=>{Object.defineProperty(W,"signal",{enumerable:!0,get:()=>{return this.#H=!0,G.signal}})},Z=()=>{let W=LX(this.options,Y),U=(()=>{let z={client:this.#Z,queryKey:this.queryKey,meta:this.meta};return J(z),z})();if(this.#H=!1,this.options.persister)return this.options.persister(W,U,this);return W(U)},_=(()=>{let W={fetchOptions:Y,options:this.options,queryKey:this.queryKey,client:this.#Z,state:this.state,fetchFn:Z};return J(W),W})();if(this.options.behavior?.onFetch(_,this),this.#Y=this.state,this.state.fetchStatus==="idle"||this.state.fetchMeta!==_.fetchOptions?.meta)this.#$({type:"fetch",meta:_.fetchOptions?.meta});this.#J=BX({initialPromise:Y?.initialPromise,fn:_.fetchFn,onCancel:(W)=>{if(W instanceof UX&&W.revert)this.setState({...this.#Y,fetchStatus:"idle"});G.abort()},onFail:(W,A)=>{this.#$({type:"failed",failureCount:W,error:A})},onPause:()=>{this.#$({type:"pause"})},onContinue:()=>{this.#$({type:"continue"})},retry:_.options.retry,retryDelay:_.options.retryDelay,networkMode:_.options.networkMode,canRun:()=>!0});try{let W=await this.#J.start();if(W===void 0)throw console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),Error(`${this.queryHash} data is undefined`);return this.setData(W),this.#G.config.onSuccess?.(W,this),this.#G.config.onSettled?.(W,this.state.error,this),W}catch(W){if(W instanceof UX){if(W.silent)return this.#J.promise;else if(W.revert){if(this.state.data===void 0)throw W;return this.state.data}}throw this.#$({type:"error",error:W}),this.#G.config.onError?.(W,this),this.#G.config.onSettled?.(this.state.data,W,this),W}finally{this.scheduleGc()}}#$(X){let Y=(G)=>{switch(X.type){case"failed":return{...G,fetchFailureCount:X.failureCount,fetchFailureReason:X.error};case"pause":return{...G,fetchStatus:"paused"};case"continue":return{...G,fetchStatus:"fetching"};case"fetch":return{...G,...xX(G.data,this.options),fetchMeta:X.meta??null};case"success":let J={...G,...aX(X.data,X.dataUpdatedAt),dataUpdateCount:G.dataUpdateCount+1,...!X.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#Y=X.manual?J:void 0,J;case"error":let Z=X.error;return{...G,error:Z,errorUpdateCount:G.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:G.fetchFailureCount+1,fetchFailureReason:Z,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...G,isInvalidated:!0};case"setState":return{...G,...X.state}}};this.state=Y(this.state),B.batch(()=>{this.observers.forEach((G)=>{G.onQueryUpdate()}),this.#G.notify({query:this,type:"updated",action:X})})}};function xX(X,Y){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:QX(Y.networkMode)?"fetching":"paused",...X===void 0&&{error:null,status:"pending"}}}function aX(X,Y){return{data:X,dataUpdatedAt:Y??Date.now(),error:null,isInvalidated:!1,status:"success"}}function oX(X){let Y=typeof X.initialData==="function"?X.initialData():X.initialData,G=Y!==void 0,J=G?typeof X.initialDataUpdatedAt==="function"?X.initialDataUpdatedAt():X.initialDataUpdatedAt:0;return{data:Y,dataUpdateCount:0,dataUpdatedAt:G?J??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:G?"success":"pending",fetchStatus:"idle"}}var SX=class extends M{constructor(X,Y){super();this.options=Y,this.#X=X,this.#$=null,this.#H=WX(),this.bindMethods(),this.setOptions(Y)}#X;#Y=void 0;#G=void 0;#Z=void 0;#J;#W;#H;#$;#B;#N;#L;#z;#V;#_;#U=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){if(this.listeners.size===1){if(this.#Y.addObserver(this),tX(this.#Y,this.options))this.#A();else this.updateResult();this.#E()}}onUnsubscribe(){if(!this.hasListeners())this.destroy()}shouldFetchOnReconnect(){return jX(this.#Y,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return jX(this.#Y,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#K(),this.#T(),this.#Y.removeObserver(this)}setOptions(X){let Y=this.options,G=this.#Y;if(this.options=this.#X.defaultQueryOptions(X),this.options.enabled!==void 0&&typeof this.options.enabled!=="boolean"&&typeof this.options.enabled!=="function"&&typeof j(this.options.enabled,this.#Y)!=="boolean")throw Error("Expected enabled to be a boolean or a callback that returns a boolean");if(this.#I(),this.#Y.setOptions(this.options),Y._defaulted&&!r(this.options,Y))this.#X.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#Y,observer:this});let J=this.hasListeners();if(J&&eX(this.#Y,G,this.options,Y))this.#A();if(this.updateResult(),J&&(this.#Y!==G||j(this.options.enabled,this.#Y)!==j(Y.enabled,this.#Y)||C(this.options.staleTime,this.#Y)!==C(Y.staleTime,this.#Y)))this.#w();let Z=this.#D();if(J&&(this.#Y!==G||j(this.options.enabled,this.#Y)!==j(Y.enabled,this.#Y)||Z!==this.#_))this.#F(Z)}getOptimisticResult(X){let Y=this.#X.getQueryCache().build(this.#X,X),G=this.createResult(Y,X);if(jY(this,G))this.#Z=G,this.#W=this.options,this.#J=this.#Y.state;return G}getCurrentResult(){return this.#Z}trackResult(X,Y){return new Proxy(X,{get:(G,J)=>{if(this.trackProp(J),Y?.(J),J==="promise"){if(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#H.status==="pending")this.#H.reject(Error("experimental_prefetchInRender feature flag is not enabled"))}return Reflect.get(G,J)}})}trackProp(X){this.#U.add(X)}getCurrentQuery(){return this.#Y}refetch({...X}={}){return this.fetch({...X})}fetchOptimistic(X){let Y=this.#X.defaultQueryOptions(X),G=this.#X.getQueryCache().build(this.#X,Y);return G.fetch().then(()=>this.createResult(G,Y))}fetch(X){return this.#A({...X,cancelRefetch:X.cancelRefetch??!0}).then(()=>{return this.updateResult(),this.#Z})}#A(X){this.#I();let Y=this.#Y.fetch(this.options,X);if(!X?.throwOnError)Y=Y.catch(F);return Y}#w(){this.#K();let X=C(this.options.staleTime,this.#Y);if(x||this.#Z.isStale||!JX(X))return;let G=VX(this.#Z.dataUpdatedAt,X)+1;this.#z=q.setTimeout(()=>{if(!this.#Z.isStale)this.updateResult()},G)}#D(){return(typeof this.options.refetchInterval==="function"?this.options.refetchInterval(this.#Y):this.options.refetchInterval)??!1}#F(X){if(this.#T(),this.#_=X,x||j(this.options.enabled,this.#Y)===!1||!JX(this.#_)||this.#_===0)return;this.#V=q.setInterval(()=>{if(this.options.refetchIntervalInBackground||e.isFocused())this.#A()},this.#_)}#E(){this.#w(),this.#F(this.#D())}#K(){if(this.#z)q.clearTimeout(this.#z),this.#z=void 0}#T(){if(this.#V)q.clearInterval(this.#V),this.#V=void 0}createResult(X,Y){let G=this.#Y,J=this.options,Z=this.#Z,H=this.#J,_=this.#W,A=X!==G?X.state:this.#G,{state:U}=X,z={...U},E=!1,N;if(Y._optimisticResults){let Q=this.hasListeners(),d=!Q&&tX(X,Y),i=Q&&eX(X,G,Y,J);if(d||i)z={...z,...xX(U.data,X.options)};if(Y._optimisticResults==="isRestoring")z.fetchStatus="idle"}let{error:K,errorUpdatedAt:w,status:L}=z;N=z.data;let P=!1;if(Y.placeholderData!==void 0&&N===void 0&&L==="pending"){let Q;if(Z?.isPlaceholderData&&Y.placeholderData===_?.placeholderData)Q=Z.data,P=!0;else Q=typeof Y.placeholderData==="function"?Y.placeholderData(this.#L?.state.data,this.#L):Y.placeholderData;if(Q!==void 0)L="success",N=$X(Z?.data,Q,Y),E=!0}if(Y.select&&N!==void 0&&!P)if(Z&&N===H?.data&&Y.select===this.#B)N=this.#N;else try{this.#B=Y.select,N=Y.select(N),N=$X(Z?.data,N,Y),this.#N=N,this.#$=null}catch(Q){this.#$=Q}if(this.#$)K=this.#$,N=this.#N,w=Date.now(),L="error";let k=z.fetchStatus==="fetching",S=L==="pending",R=L==="error",g=S&&k,b=N!==void 0,O={status:L,fetchStatus:z.fetchStatus,isPending:S,isSuccess:L==="success",isError:R,isInitialLoading:g,isLoading:g,data:N,dataUpdatedAt:z.dataUpdatedAt,error:K,errorUpdatedAt:w,failureCount:z.fetchFailureCount,failureReason:z.fetchFailureReason,errorUpdateCount:z.errorUpdateCount,isFetched:z.dataUpdateCount>0||z.errorUpdateCount>0,isFetchedAfterMount:z.dataUpdateCount>A.dataUpdateCount||z.errorUpdateCount>A.errorUpdateCount,isFetching:k,isRefetching:k&&!S,isLoadingError:R&&!b,isPaused:z.fetchStatus==="paused",isPlaceholderData:E,isRefetchError:R&&b,isStale:MX(X,Y),refetch:this.refetch,promise:this.#H,isEnabled:j(Y.enabled,X)!==!1};if(this.options.experimental_prefetchInRender){let Q=O.data!==void 0,d=O.status==="error"&&!Q,i=(n)=>{if(d)n.reject(O.error);else if(Q)n.resolve(O.data)},s=()=>{let n=this.#H=O.promise=WX();i(n)},y=this.#H;switch(y.status){case"pending":if(X.queryHash===G.queryHash)i(y);break;case"fulfilled":if(d||O.data!==y.value)s();break;case"rejected":if(!d||O.error!==y.reason)s();break}}return O}updateResult(){let X=this.#Z,Y=this.createResult(this.#Y,this.options);if(this.#J=this.#Y.state,this.#W=this.options,this.#J.data!==void 0)this.#L=this.#Y;if(r(Y,X))return;this.#Z=Y;let G=()=>{if(!X)return!0;let{notifyOnChangeProps:J}=this.options,Z=typeof J==="function"?J():J;if(Z==="all"||!Z&&!this.#U.size)return!0;let H=new Set(Z??this.#U);if(this.options.throwOnError)H.add("error");return Object.keys(this.#Z).some((_)=>{let W=_;return this.#Z[W]!==X[W]&&H.has(W)})};this.#P({listeners:G()})}#I(){let X=this.#X.getQueryCache().build(this.#X,this.options);if(X===this.#Y)return;let Y=this.#Y;if(this.#Y=X,this.#G=X.state,this.hasListeners())Y?.removeObserver(this),X.addObserver(this)}onQueryUpdate(){if(this.updateResult(),this.hasListeners())this.#E()}#P(X){B.batch(()=>{if(X.listeners)this.listeners.forEach((Y)=>{Y(this.#Z)});this.#X.getQueryCache().notify({query:this.#Y,type:"observerResultsUpdated"})})}};function xY(X,Y){return j(Y.enabled,X)!==!1&&X.state.data===void 0&&!(X.state.status==="error"&&Y.retryOnMount===!1)}function tX(X,Y){return xY(X,Y)||X.state.data!==void 0&&jX(X,Y,Y.refetchOnMount)}function jX(X,Y,G){if(j(Y.enabled,X)!==!1&&C(Y.staleTime,X)!=="static"){let J=typeof G==="function"?G(X):G;return J==="always"||J!==!1&&MX(X,Y)}return!1}function eX(X,Y,G,J){return(X!==Y||j(J.enabled,X)===!1)&&(!G.suspense||X.state.status!=="error")&&MX(X,G)}function MX(X,Y){return j(Y.enabled,X)!==!1&&X.isStaleByTime(C(Y.staleTime,X))}function jY(X,Y){if(!r(X.getCurrentResult(),Y))return!0;return!1}function RX(X){return{onFetch:(Y,G)=>{let J=Y.options,Z=Y.fetchOptions?.meta?.fetchMore?.direction,H=Y.state.data?.pages||[],_=Y.state.data?.pageParams||[],W={pages:[],pageParams:[]},A=0,U=async()=>{let z=!1,E=(w)=>{sX(w,()=>Y.signal,()=>z=!0)},N=LX(Y.options,Y.fetchOptions),K=async(w,L,P)=>{if(z)return Promise.reject();if(L==null&&w.pages.length)return Promise.resolve(w);let S=(()=>{let YX={client:Y.client,queryKey:Y.queryKey,pageParam:L,direction:P?"backward":"forward",meta:Y.options.meta};return E(YX),YX})(),R=await N(S),{maxPages:g}=Y.options,b=P?iX:uX;return{pages:b(w.pages,R,g),pageParams:b(w.pageParams,L,g)}};if(Z&&H.length){let w=Z==="backward",L=w?SY:XY,P={pages:H,pageParams:_},k=L(J,P);W=await K(P,k,w)}else{let w=X??H.length;do{let L=A===0?_[0]??J.initialPageParam:XY(J,W);if(A>0&&L==null)break;W=await K(W,L),A++}while(A<w)}return W};if(Y.options.persister)Y.fetchFn=()=>{return Y.options.persister?.(U,{client:Y.client,queryKey:Y.queryKey,meta:Y.options.meta,signal:Y.signal},G)};else Y.fetchFn=U}}}function XY(X,{pages:Y,pageParams:G}){let J=Y.length-1;return Y.length>0?X.getNextPageParam(Y[J],Y,G[J],G):void 0}function SY(X,{pages:Y,pageParams:G}){return Y.length>0?X.getPreviousPageParam?.(Y[0],Y,G[0],G):void 0}var YY=class extends wX{#X;#Y;#G;#Z;constructor(X){super();this.#X=X.client,this.mutationId=X.mutationId,this.#G=X.mutationCache,this.#Y=[],this.state=X.state||CX(),this.setOptions(X.options),this.scheduleGc()}setOptions(X){this.options=X,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(X){if(!this.#Y.includes(X))this.#Y.push(X),this.clearGcTimeout(),this.#G.notify({type:"observerAdded",mutation:this,observer:X})}removeObserver(X){this.#Y=this.#Y.filter((Y)=>Y!==X),this.scheduleGc(),this.#G.notify({type:"observerRemoved",mutation:this,observer:X})}optionalRemove(){if(!this.#Y.length)if(this.state.status==="pending")this.scheduleGc();else this.#G.remove(this)}continue(){return this.#Z?.continue()??this.execute(this.state.variables)}async execute(X){let Y=()=>{this.#J({type:"continue"})},G={client:this.#X,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#Z=BX({fn:()=>{if(!this.options.mutationFn)return Promise.reject(Error("No mutationFn found"));return this.options.mutationFn(X,G)},onFail:(H,_)=>{this.#J({type:"failed",failureCount:H,error:_})},onPause:()=>{this.#J({type:"pause"})},onContinue:Y,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#G.canRun(this)});let J=this.state.status==="pending",Z=!this.#Z.canStart();try{if(J)Y();else{if(this.#J({type:"pending",variables:X,isPaused:Z}),this.#G.config.onMutate)await this.#G.config.onMutate(X,this,G);let _=await this.options.onMutate?.(X,G);if(_!==this.state.context)this.#J({type:"pending",context:_,variables:X,isPaused:Z})}let H=await this.#Z.start();return await this.#G.config.onSuccess?.(H,X,this.state.context,this,G),await this.options.onSuccess?.(H,X,this.state.context,G),await this.#G.config.onSettled?.(H,null,this.state.variables,this.state.context,this,G),await this.options.onSettled?.(H,null,X,this.state.context,G),this.#J({type:"success",data:H}),H}catch(H){try{await this.#G.config.onError?.(H,X,this.state.context,this,G)}catch(_){Promise.reject(_)}try{await this.options.onError?.(H,X,this.state.context,G)}catch(_){Promise.reject(_)}try{await this.#G.config.onSettled?.(void 0,H,this.state.variables,this.state.context,this,G)}catch(_){Promise.reject(_)}try{await this.options.onSettled?.(void 0,H,X,this.state.context,G)}catch(_){Promise.reject(_)}throw this.#J({type:"error",error:H}),H}finally{this.#G.runNext(this)}}#J(X){let Y=(G)=>{switch(X.type){case"failed":return{...G,failureCount:X.failureCount,failureReason:X.error};case"pause":return{...G,isPaused:!0};case"continue":return{...G,isPaused:!1};case"pending":return{...G,context:X.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:X.isPaused,status:"pending",variables:X.variables,submittedAt:Date.now()};case"success":return{...G,data:X.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...G,data:void 0,error:X.error,failureCount:G.failureCount+1,failureReason:X.error,isPaused:!1,status:"error"}}};this.state=Y(this.state),B.batch(()=>{this.#Y.forEach((G)=>{G.onMutationUpdate(X)}),this.#G.notify({mutation:this,type:"updated",action:X})})}};function CX(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var GY=class extends M{constructor(X={}){super();this.config=X,this.#X=new Set,this.#Y=new Map,this.#G=0}#X;#Y;#G;build(X,Y,G){let J=new YY({client:X,mutationCache:this,mutationId:++this.#G,options:X.defaultMutationOptions(Y),state:G});return this.add(J),J}add(X){this.#X.add(X);let Y=DX(X);if(typeof Y==="string"){let G=this.#Y.get(Y);if(G)G.push(X);else this.#Y.set(Y,[X])}this.notify({type:"added",mutation:X})}remove(X){if(this.#X.delete(X)){let Y=DX(X);if(typeof Y==="string"){let G=this.#Y.get(Y);if(G){if(G.length>1){let J=G.indexOf(X);if(J!==-1)G.splice(J,1)}else if(G[0]===X)this.#Y.delete(Y)}}}this.notify({type:"removed",mutation:X})}canRun(X){let Y=DX(X);if(typeof Y==="string"){let J=this.#Y.get(Y)?.find((Z)=>Z.state.status==="pending");return!J||J===X}else return!0}runNext(X){let Y=DX(X);if(typeof Y==="string")return this.#Y.get(Y)?.find((J)=>J!==X&&J.state.isPaused)?.continue()??Promise.resolve();else return Promise.resolve()}clear(){B.batch(()=>{this.#X.forEach((X)=>{this.notify({type:"removed",mutation:X})}),this.#X.clear(),this.#Y.clear()})}getAll(){return Array.from(this.#X)}find(X){let Y={exact:!0,...X};return this.getAll().find((G)=>NX(Y,G))}findAll(X={}){return this.getAll().filter((Y)=>NX(X,Y))}notify(X){B.batch(()=>{this.listeners.forEach((Y)=>{Y(X)})})}resumePausedMutations(){let X=this.getAll().filter((Y)=>Y.state.isPaused);return B.batch(()=>Promise.all(X.map((Y)=>Y.continue().catch(F))))}};function DX(X){return X.options.scope?.id}var OX=class extends M{#X;#Y=void 0;#G;#Z;constructor(X,Y){super();this.#X=X,this.setOptions(Y),this.bindMethods(),this.#J()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(X){let Y=this.options;if(this.options=this.#X.defaultMutationOptions(X),!r(this.options,Y))this.#X.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#G,observer:this});if(Y?.mutationKey&&this.options.mutationKey&&v(Y.mutationKey)!==v(this.options.mutationKey))this.reset();else if(this.#G?.state.status==="pending")this.#G.setOptions(this.options)}onUnsubscribe(){if(!this.hasListeners())this.#G?.removeObserver(this)}onMutationUpdate(X){this.#J(),this.#W(X)}getCurrentResult(){return this.#Y}reset(){this.#G?.removeObserver(this),this.#G=void 0,this.#J(),this.#W()}mutate(X,Y){return this.#Z=Y,this.#G?.removeObserver(this),this.#G=this.#X.getMutationCache().build(this.#X,this.options),this.#G.addObserver(this),this.#G.execute(X)}#J(){let X=this.#G?.state??CX();this.#Y={...X,isPending:X.status==="pending",isSuccess:X.status==="success",isError:X.status==="error",isIdle:X.status==="idle",mutate:this.mutate,reset:this.reset}}#W(X){B.batch(()=>{if(this.#Z&&this.hasListeners()){let Y=this.#Y.variables,G=this.#Y.context,J={client:this.#X,meta:this.options.meta,mutationKey:this.options.mutationKey};if(X?.type==="success"){try{this.#Z.onSuccess?.(X.data,Y,G,J)}catch(Z){Promise.reject(Z)}try{this.#Z.onSettled?.(X.data,null,Y,G,J)}catch(Z){Promise.reject(Z)}}else if(X?.type==="error"){try{this.#Z.onError?.(X.error,Y,G,J)}catch(Z){Promise.reject(Z)}try{this.#Z.onSettled?.(void 0,X.error,Y,G,J)}catch(Z){Promise.reject(Z)}}}this.listeners.forEach((Y)=>{Y(this.#Y)})})}};var JY=class extends M{constructor(X={}){super();this.config=X,this.#X=new Map}#X;build(X,Y,G){let J=Y.queryKey,Z=Y.queryHash??ZX(J,Y),H=this.get(Z);if(!H)H=new rX({client:X,queryKey:J,queryHash:Z,options:X.defaultQueryOptions(Y),state:G,defaultOptions:X.getQueryDefaults(J)}),this.add(H);return H}add(X){if(!this.#X.has(X.queryHash))this.#X.set(X.queryHash,X),this.notify({type:"added",query:X})}remove(X){let Y=this.#X.get(X.queryHash);if(Y){if(X.destroy(),Y===X)this.#X.delete(X.queryHash);this.notify({type:"removed",query:X})}}clear(){B.batch(()=>{this.getAll().forEach((X)=>{this.remove(X)})})}get(X){return this.#X.get(X)}getAll(){return[...this.#X.values()]}find(X){let Y={exact:!0,...X};return this.getAll().find((G)=>AX(Y,G))}findAll(X={}){let Y=this.getAll();return Object.keys(X).length>0?Y.filter((G)=>AX(X,G)):Y}notify(X){B.batch(()=>{this.listeners.forEach((Y)=>{Y(X)})})}onFocus(){B.batch(()=>{this.getAll().forEach((X)=>{X.onFocus()})})}onOnline(){B.batch(()=>{this.getAll().forEach((X)=>{X.onOnline()})})}};var MY=class{#X;#Y;#G;#Z;#J;#W;#H;#$;constructor(X={}){this.#X=X.queryCache||new JY,this.#Y=X.mutationCache||new GY,this.#G=X.defaultOptions||{},this.#Z=new Map,this.#J=new Map,this.#W=0}mount(){if(this.#W++,this.#W!==1)return;this.#H=e.subscribe(async(X)=>{if(X)await this.resumePausedMutations(),this.#X.onFocus()}),this.#$=XX.subscribe(async(X)=>{if(X)await this.resumePausedMutations(),this.#X.onOnline()})}unmount(){if(this.#W--,this.#W!==0)return;this.#H?.(),this.#H=void 0,this.#$?.(),this.#$=void 0}isFetching(X){return this.#X.findAll({...X,fetchStatus:"fetching"}).length}isMutating(X){return this.#Y.findAll({...X,status:"pending"}).length}getQueryData(X){let Y=this.defaultQueryOptions({queryKey:X});return this.#X.get(Y.queryHash)?.state.data}ensureQueryData(X){let Y=this.defaultQueryOptions(X),G=this.#X.build(this,Y),J=G.state.data;if(J===void 0)return this.fetchQuery(X);if(X.revalidateIfStale&&G.isStaleByTime(C(Y.staleTime,G)))this.prefetchQuery(Y);return Promise.resolve(J)}getQueriesData(X){return this.#X.findAll(X).map(({queryKey:Y,state:G})=>{let J=G.data;return[Y,J]})}setQueryData(X,Y,G){let J=this.defaultQueryOptions({queryKey:X}),H=this.#X.get(J.queryHash)?.state.data,_=cX(Y,H);if(_===void 0)return;return this.#X.build(this,J).setData(_,{...G,manual:!0})}setQueriesData(X,Y,G){return B.batch(()=>this.#X.findAll(X).map(({queryKey:J})=>[J,this.setQueryData(J,Y,G)]))}getQueryState(X){let Y=this.defaultQueryOptions({queryKey:X});return this.#X.get(Y.queryHash)?.state}removeQueries(X){let Y=this.#X;B.batch(()=>{Y.findAll(X).forEach((G)=>{Y.remove(G)})})}resetQueries(X,Y){let G=this.#X;return B.batch(()=>{return G.findAll(X).forEach((J)=>{J.reset()}),this.refetchQueries({type:"active",...X},Y)})}cancelQueries(X,Y={}){let G={revert:!0,...Y},J=B.batch(()=>this.#X.findAll(X).map((Z)=>Z.cancel(G)));return Promise.all(J).then(F).catch(F)}invalidateQueries(X,Y={}){return B.batch(()=>{if(this.#X.findAll(X).forEach((G)=>{G.invalidate()}),X?.refetchType==="none")return Promise.resolve();return this.refetchQueries({...X,type:X?.refetchType??X?.type??"active"},Y)})}refetchQueries(X,Y={}){let G={...Y,cancelRefetch:Y.cancelRefetch??!0},J=B.batch(()=>this.#X.findAll(X).filter((Z)=>!Z.isDisabled()&&!Z.isStatic()).map((Z)=>{let H=Z.fetch(void 0,G);if(!G.throwOnError)H=H.catch(F);return Z.state.fetchStatus==="paused"?Promise.resolve():H}));return Promise.all(J).then(F)}fetchQuery(X){let Y=this.defaultQueryOptions(X);if(Y.retry===void 0)Y.retry=!1;let G=this.#X.build(this,Y);return G.isStaleByTime(C(Y.staleTime,G))?G.fetch(Y):Promise.resolve(G.state.data)}prefetchQuery(X){return this.fetchQuery(X).then(F).catch(F)}fetchInfiniteQuery(X){return X.behavior=RX(X.pages),this.fetchQuery(X)}prefetchInfiniteQuery(X){return this.fetchInfiniteQuery(X).then(F).catch(F)}ensureInfiniteQueryData(X){return X.behavior=RX(X.pages),this.ensureQueryData(X)}resumePausedMutations(){if(XX.isOnline())return this.#Y.resumePausedMutations();return Promise.resolve()}getQueryCache(){return this.#X}getMutationCache(){return this.#Y}getDefaultOptions(){return this.#G}setDefaultOptions(X){this.#G=X}setQueryDefaults(X,Y){this.#Z.set(v(X),{queryKey:X,defaultOptions:Y})}getQueryDefaults(X){let Y=[...this.#Z.values()],G={};return Y.forEach((J)=>{if(u(X,J.queryKey))Object.assign(G,J.defaultOptions)}),G}setMutationDefaults(X,Y){this.#J.set(v(X),{mutationKey:X,defaultOptions:Y})}getMutationDefaults(X){let Y=[...this.#J.values()],G={};return Y.forEach((J)=>{if(u(X,J.mutationKey))Object.assign(G,J.defaultOptions)}),G}defaultQueryOptions(X){if(X._defaulted)return X;let Y={...this.#G.queries,...this.getQueryDefaults(X.queryKey),...X,_defaulted:!0};if(!Y.queryHash)Y.queryHash=ZX(Y.queryKey,Y);if(Y.refetchOnReconnect===void 0)Y.refetchOnReconnect=Y.networkMode!=="always";if(Y.throwOnError===void 0)Y.throwOnError=!!Y.suspense;if(!Y.networkMode&&Y.persister)Y.networkMode="offlineFirst";if(Y.queryFn===l)Y.enabled=!1;return Y}defaultMutationOptions(X){if(X?._defaulted)return X;return{...this.#G.mutations,...X?.mutationKey&&this.getMutationDefaults(X.mutationKey),...X,_defaulted:!0}}clear(){this.#X.clear(),this.#Y.clear()}};var f=h(c(),1);var HX=h(c(),1),RY=h(IX(),1);function CY(){let X=!1;return{clearReset:()=>{X=!1},reset:()=>{X=!0},isReset:()=>{return X}}}var OY=HX.createContext(CY()),ZY=()=>HX.useContext(OY);var $Y=h(c(),1);var WY=(X,Y,G)=>{let J=G?.state.error&&typeof X.throwOnError==="function"?t(X.throwOnError,[G.state.error,G]):X.throwOnError;if(X.suspense||X.experimental_prefetchInRender||J){if(!Y.isReset())X.retryOnMount=!1}},HY=(X)=>{$Y.useEffect(()=>{X.clearReset()},[X])},_Y=({result:X,errorResetBoundary:Y,throwOnError:G,query:J,suspense:Z})=>{return X.isError&&!Y.isReset()&&!X.isFetching&&J&&(Z&&X.data===void 0||t(G,[X.error,J]))};var FX=h(c(),1),zY=FX.createContext(!1),VY=()=>FX.useContext(zY),K2=zY.Provider;var AY=(X)=>{if(X.suspense){let G=(Z)=>Z==="static"?Z:Math.max(Z??1000,1000),J=X.staleTime;if(X.staleTime=typeof J==="function"?(...Z)=>G(J(...Z)):G(J),typeof X.gcTime==="number")X.gcTime=Math.max(X.gcTime,1000)}},NY=(X,Y)=>X.isLoading&&X.isFetching&&!Y,LY=(X,Y)=>X?.suspense&&Y.isPending,qX=(X,Y,G)=>Y.fetchOptimistic(X).catch(()=>{G.clearReset()});function UY(X,Y,G){if(typeof X!=="object"||Array.isArray(X))throw Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');let J=VY(),Z=ZY(),H=GX(G),_=H.defaultQueryOptions(X);H.getDefaultOptions().queries?._experimental_beforeQuery?.(_);let W=H.getQueryCache().get(_.queryHash);if(!_.queryFn)console.error(`[${_.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`);_._optimisticResults=J?"isRestoring":"optimistic",AY(_),WY(_,Z,W),HY(Z);let A=!H.getQueryCache().get(_.queryHash),[U]=f.useState(()=>new Y(H,_)),z=U.getOptimisticResult(_),E=!J&&X.subscribed!==!1;if(f.useSyncExternalStore(f.useCallback((N)=>{let K=E?U.subscribe(B.batchCalls(N)):F;return U.updateResult(),K},[U,E]),()=>U.getCurrentResult(),()=>U.getCurrentResult()),f.useEffect(()=>{U.setOptions(_)},[_,U]),LY(_,z))throw qX(_,U,Z);if(_Y({result:z,errorResetBoundary:Z,throwOnError:_.throwOnError,query:W,suspense:_.suspense}))throw z.error;if(H.getDefaultOptions().queries?._experimental_afterQuery?.(_,z),_.experimental_prefetchInRender&&!x&&NY(z,J))(A?qX(_,U,Z):W?.promise)?.catch(F).finally(()=>{U.updateResult()});return!_.notifyOnChangeProps?U.trackResult(z):z}function qY(X,Y){return UY(X,SX,Y)}var m=h(c(),1);function vY(X,Y){let G=GX(Y),[J]=m.useState(()=>new OX(G,X));m.useEffect(()=>{J.setOptions(X)},[J,X]);let Z=m.useSyncExternalStore(m.useCallback((_)=>J.subscribe(B.batchCalls(_)),[J]),()=>J.getCurrentResult(),()=>J.getCurrentResult()),H=m.useCallback((_,W)=>{J.mutate(_,W).catch(F)},[J]);if(Z.error&&t(J.options.throwOnError,[Z.error]))throw Z.error;return{...Z,mutate:H,mutateAsync:Z.mutate}}var p2={config:{all:["config"],detail:()=>["config","detail"]},providers:{all:["providers"],list:()=>["providers","list"],detail:(X)=>["providers","detail",X]},models:{all:["models"],list:(X)=>["models","list",X],available:()=>["models","available"]},skills:{all:["skills"],list:()=>["skills","list"],detail:(X)=>["skills","detail",X]},tasks:{all:["tasks"],list:(X)=>["tasks","list",X],detail:(X)=>["tasks","detail",X]},history:{all:["history"],list:()=>["history","list"],detail:(X)=>["history","detail",X]},knowledge:{all:["knowledge"],memories:()=>["knowledge","memories"],skills:()=>["knowledge","skills"]},agents:{all:["agents"],list:()=>["agents","list"],detail:(X)=>["agents","detail",X]},mcp:{all:["mcp"],config:()=>["mcp","config"]}};
7
+ export{MY as O,GX as P,FY as Q,qY as R,vY as S,p2 as T};
@@ -0,0 +1,2 @@
1
+ import{nb as v5,ob as F,rb as _}from"./chunk-cze71w02.js";var i=F((n)=>{Object.defineProperty(n,"__esModule",{value:!0});n.default=void 0;var c5=n.default="ffffffff-ffff-ffff-ffff-ffffffffffff"});var t=F((o)=>{Object.defineProperty(o,"__esModule",{value:!0});o.default=void 0;var p5=o.default="00000000-0000-0000-0000-000000000000"});var Q0=F((s)=>{Object.defineProperty(s,"__esModule",{value:!0});s.default=void 0;var o5=s.default=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i});var V=F((Z0)=>{Object.defineProperty(Z0,"__esModule",{value:!0});Z0.default=void 0;var W1=Y1(Q0());function Y1(Q){return Q&&Q.__esModule?Q:{default:Q}}function F1(Q){return typeof Q==="string"&&W1.default.test(Q)}var t5=Z0.default=F1});var T=F((X0)=>{Object.defineProperty(X0,"__esModule",{value:!0});X0.default=void 0;var U1=D1(V());function D1(Q){return Q&&Q.__esModule?Q:{default:Q}}function z1(Q){if(!(0,U1.default)(Q))throw TypeError("Invalid UUID");let Z,X=new Uint8Array(16);return X[0]=(Z=parseInt(Q.slice(0,8),16))>>>24,X[1]=Z>>>16&255,X[2]=Z>>>8&255,X[3]=Z&255,X[4]=(Z=parseInt(Q.slice(9,13),16))>>>8,X[5]=Z&255,X[6]=(Z=parseInt(Q.slice(14,18),16))>>>8,X[7]=Z&255,X[8]=(Z=parseInt(Q.slice(19,23),16))>>>8,X[9]=Z&255,X[10]=(Z=parseInt(Q.slice(24,36),16))/1099511627776&255,X[11]=Z/4294967296&255,X[12]=Z>>>24&255,X[13]=Z>>>16&255,X[14]=Z>>>8&255,X[15]=Z&255,X}var e5=X0.default=z1});var R=F((A0)=>{Object.defineProperty(A0,"__esModule",{value:!0});A0.default=void 0;A0.unsafeStringify=P0;var H1=O1(V());function O1(Q){return Q&&Q.__esModule?Q:{default:Q}}var U=[];for(let Q=0;Q<256;++Q)U.push((Q+256).toString(16).slice(1));function P0(Q,Z=0){return(U[Q[Z+0]]+U[Q[Z+1]]+U[Q[Z+2]]+U[Q[Z+3]]+"-"+U[Q[Z+4]]+U[Q[Z+5]]+"-"+U[Q[Z+6]]+U[Q[Z+7]]+"-"+U[Q[Z+8]]+U[Q[Z+9]]+"-"+U[Q[Z+10]]+U[Q[Z+11]]+U[Q[Z+12]]+U[Q[Z+13]]+U[Q[Z+14]]+U[Q[Z+15]]).toLowerCase()}function w1(Q,Z=0){let X=P0(Q,Z);if(!(0,H1.default)(X))throw TypeError("Stringified UUID is invalid");return X}var Z6=A0.default=w1});var q=F((W0)=>{Object.defineProperty(W0,"__esModule",{value:!0});W0.default=V1;var R1=K1(_("node:crypto"));function K1(Q){return Q&&Q.__esModule?Q:{default:Q}}var N=new Uint8Array(256),E=N.length;function V1(){if(E>N.length-16)R1.default.randomFillSync(N),E=0;return N.slice(E,E+=16)}});var g=F((Y0)=>{Object.defineProperty(Y0,"__esModule",{value:!0});Y0.default=void 0;var S1=N1(q()),E1=R();function N1(Q){return Q&&Q.__esModule?Q:{default:Q}}var C,f,I=0,B=0;function _1(Q,Z,X){let G=Z&&X||0,J=Z||Array(16);Q=Q||{};let{node:P,clockseq:W}=Q;if(!Q._v6){if(!P)P=C;if(W==null)W=f}if(P==null||W==null){let O=Q.random||(Q.rng||S1.default)();if(P==null){if(P=[O[0],O[1],O[2],O[3],O[4],O[5]],!C&&!Q._v6)P[0]|=1,C=P}if(W==null){if(W=(O[6]<<8|O[7])&16383,f===void 0&&!Q._v6)f=W}}let A=Q.msecs!==void 0?Q.msecs:Date.now(),Y=Q.nsecs!==void 0?Q.nsecs:B+1,M=A-I+(Y-B)/1e4;if(M<0&&Q.clockseq===void 0)W=W+1&16383;if((M<0||A>I)&&Q.nsecs===void 0)Y=0;if(Y>=1e4)throw Error("uuid.v1(): Can't create more than 10M uuids/sec");I=A,B=Y,f=W,A+=12219292800000;let L=((A&268435455)*1e4+Y)%4294967296;J[G++]=L>>>24&255,J[G++]=L>>>16&255,J[G++]=L>>>8&255,J[G++]=L&255;let S=A/4294967296*1e4&268435455;J[G++]=S>>>8&255,J[G++]=S&255,J[G++]=S>>>24&15|16,J[G++]=S>>>16&255,J[G++]=W>>>8|128,J[G++]=W&255;for(let O=0;O<6;++O)J[G+O]=P[O];return Z||(0,E1.unsafeStringify)(J)}var J6=Y0.default=_1});var u=F((U0)=>{Object.defineProperty(U0,"__esModule",{value:!0});U0.default=$1;var q1=x1(T()),f1=R();function x1(Q){return Q&&Q.__esModule?Q:{default:Q}}function $1(Q){let Z=typeof Q==="string"?(0,q1.default)(Q):Q,X=C1(Z);return typeof Q==="string"?(0,f1.unsafeStringify)(X):X}function C1(Q,Z=!1){return Uint8Array.of((Q[6]&15)<<4|Q[7]>>4&15,(Q[7]&15)<<4|(Q[4]&240)>>4,(Q[4]&15)<<4|(Q[5]&240)>>4,(Q[5]&15)<<4|(Q[0]&240)>>4,(Q[0]&15)<<4|(Q[1]&240)>>4,(Q[1]&15)<<4|(Q[2]&240)>>4,96|Q[2]&15,Q[3],Q[8],Q[9],Q[10],Q[11],Q[12],Q[13],Q[14],Q[15])}});var j=F((D0)=>{Object.defineProperty(D0,"__esModule",{value:!0});D0.URL=D0.DNS=void 0;D0.default=h1;var B1=R(),g1=u1(T());function u1(Q){return Q&&Q.__esModule?Q:{default:Q}}function j1(Q){Q=unescape(encodeURIComponent(Q));let Z=[];for(let X=0;X<Q.length;++X)Z.push(Q.charCodeAt(X));return Z}var v1=D0.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",m1=D0.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function h1(Q,Z,X){function G(J,P,W,A){var Y;if(typeof J==="string")J=j1(J);if(typeof P==="string")P=(0,g1.default)(P);if(((Y=P)===null||Y===void 0?void 0:Y.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let M=new Uint8Array(16+J.length);if(M.set(P),M.set(J,P.length),M=X(M),M[6]=M[6]&15|Z,M[8]=M[8]&63|128,W){A=A||0;for(let L=0;L<16;++L)W[A+L]=M[L];return W}return(0,B1.unsafeStringify)(M)}try{G.name=Q}catch(J){}return G.DNS=v1,G.URL=m1,G}});var w0=F((H0)=>{Object.defineProperty(H0,"__esModule",{value:!0});H0.default=void 0;var d1=b1(_("node:crypto"));function b1(Q){return Q&&Q.__esModule?Q:{default:Q}}function k1(Q){if(Array.isArray(Q))Q=Buffer.from(Q);else if(typeof Q==="string")Q=Buffer.from(Q,"utf8");return d1.default.createHash("md5").update(Q).digest()}var W6=H0.default=k1});var V0=F((R0)=>{Object.defineProperty(R0,"__esModule",{value:!0});R0.default=void 0;var r1=L0(j()),c1=L0(w0());function L0(Q){return Q&&Q.__esModule?Q:{default:Q}}var n1=(0,r1.default)("v3",48,c1.default),F6=R0.default=n1});var E0=F((T0)=>{Object.defineProperty(T0,"__esModule",{value:!0});T0.default=void 0;var p1=i1(_("node:crypto"));function i1(Q){return Q&&Q.__esModule?Q:{default:Q}}var D6=T0.default={randomUUID:p1.default.randomUUID}});var x0=F((q0)=>{Object.defineProperty(q0,"__esModule",{value:!0});q0.default=void 0;var N0=_0(E0()),o1=_0(q()),a1=R();function _0(Q){return Q&&Q.__esModule?Q:{default:Q}}function t1(Q,Z,X){if(N0.default.randomUUID&&!Z&&!Q)return N0.default.randomUUID();Q=Q||{};let G=Q.random||(Q.rng||o1.default)();if(G[6]=G[6]&15|64,G[8]=G[8]&63|128,Z){X=X||0;for(let J=0;J<16;++J)Z[X+J]=G[J];return Z}return(0,a1.unsafeStringify)(G)}var H6=q0.default=t1});var I0=F(($0)=>{Object.defineProperty($0,"__esModule",{value:!0});$0.default=void 0;var s1=e1(_("node:crypto"));function e1(Q){return Q&&Q.__esModule?Q:{default:Q}}function Q5(Q){if(Array.isArray(Q))Q=Buffer.from(Q);else if(typeof Q==="string")Q=Buffer.from(Q,"utf8");return s1.default.createHash("sha1").update(Q).digest()}var w6=$0.default=Q5});var j0=F((g0)=>{Object.defineProperty(g0,"__esModule",{value:!0});g0.default=void 0;var Z5=B0(j()),G5=B0(I0());function B0(Q){return Q&&Q.__esModule?Q:{default:Q}}var X5=(0,Z5.default)("v5",80,G5.default),R6=g0.default=X5});var h0=F((m0)=>{Object.defineProperty(m0,"__esModule",{value:!0});m0.default=M5;var J5=R(),P5=v0(g()),A5=v0(u());function v0(Q){return Q&&Q.__esModule?Q:{default:Q}}function M5(Q={},Z,X=0){let G=(0,P5.default)({...Q,_v6:!0},new Uint8Array(16));if(G=(0,A5.default)(G),Z){for(let J=0;J<16;J++)Z[X+J]=G[J];return Z}return(0,J5.unsafeStringify)(G)}});var l0=F((y0)=>{Object.defineProperty(y0,"__esModule",{value:!0});y0.default=D5;var Y5=U5(T()),F5=R();function U5(Q){return Q&&Q.__esModule?Q:{default:Q}}function D5(Q){let Z=typeof Q==="string"?(0,Y5.default)(Q):Q,X=z5(Z);return typeof Q==="string"?(0,F5.unsafeStringify)(X):X}function z5(Q){return Uint8Array.of((Q[3]&15)<<4|Q[4]>>4&15,(Q[4]&15)<<4|(Q[5]&240)>>4,(Q[5]&15)<<4|Q[6]&15,Q[7],(Q[1]&15)<<4|(Q[2]&240)>>4,(Q[2]&15)<<4|(Q[3]&240)>>4,16|(Q[0]&240)>>4,(Q[0]&15)<<4|(Q[1]&240)>>4,Q[8],Q[9],Q[10],Q[11],Q[12],Q[13],Q[14],Q[15])}});var c0=F((k0)=>{Object.defineProperty(k0,"__esModule",{value:!0});k0.default=void 0;var O5=L5(q()),w5=R();function L5(Q){return Q&&Q.__esModule?Q:{default:Q}}var d0=null,b0=null,w=0;function R5(Q,Z,X){Q=Q||{};let G=Z&&X||0,J=Z||new Uint8Array(16),P=Q.random||(Q.rng||O5.default)(),W=Q.msecs!==void 0?Q.msecs:Date.now(),A=Q.seq!==void 0?Q.seq:null,Y=b0,M=d0;if(W>w&&Q.msecs===void 0){if(w=W,A!==null)Y=null,M=null}if(A!==null){if(A>2147483647)A=2147483647;Y=A>>>19&4095,M=A&524287}if(Y===null||M===null)Y=P[6]&127,Y=Y<<8|P[7],M=P[8]&63,M=M<<8|P[9],M=M<<5|P[10]>>>3;if(W+1e4>w&&A===null){if(++M>524287){if(M=0,++Y>4095)Y=0,w++}}else w=W;return b0=Y,d0=M,J[G++]=w/1099511627776&255,J[G++]=w/4294967296&255,J[G++]=w/16777216&255,J[G++]=w/65536&255,J[G++]=w/256&255,J[G++]=w&255,J[G++]=Y>>>4&15|112,J[G++]=Y&255,J[G++]=M>>>13&63|128,J[G++]=M>>>5&255,J[G++]=M<<3&255|P[10]&7,J[G++]=P[11],J[G++]=P[12],J[G++]=P[13],J[G++]=P[14],J[G++]=P[15],Z||(0,w5.unsafeStringify)(J)}var S6=k0.default=R5});var i0=F((n0)=>{Object.defineProperty(n0,"__esModule",{value:!0});n0.default=void 0;var K5=V5(V());function V5(Q){return Q&&Q.__esModule?Q:{default:Q}}function T5(Q){if(!(0,K5.default)(Q))throw TypeError("Invalid UUID");return parseInt(Q.slice(14,15),16)}var N6=n0.default=T5});var o0=F((D)=>{Object.defineProperty(D,"__esModule",{value:!0});Object.defineProperty(D,"MAX",{enumerable:!0,get:function(){return S5.default}});Object.defineProperty(D,"NIL",{enumerable:!0,get:function(){return E5.default}});Object.defineProperty(D,"parse",{enumerable:!0,get:function(){return N5.default}});Object.defineProperty(D,"stringify",{enumerable:!0,get:function(){return _5.default}});Object.defineProperty(D,"v1",{enumerable:!0,get:function(){return q5.default}});Object.defineProperty(D,"v1ToV6",{enumerable:!0,get:function(){return f5.default}});Object.defineProperty(D,"v3",{enumerable:!0,get:function(){return x5.default}});Object.defineProperty(D,"v4",{enumerable:!0,get:function(){return $5.default}});Object.defineProperty(D,"v5",{enumerable:!0,get:function(){return C5.default}});Object.defineProperty(D,"v6",{enumerable:!0,get:function(){return I5.default}});Object.defineProperty(D,"v6ToV1",{enumerable:!0,get:function(){return B5.default}});Object.defineProperty(D,"v7",{enumerable:!0,get:function(){return g5.default}});Object.defineProperty(D,"validate",{enumerable:!0,get:function(){return u5.default}});Object.defineProperty(D,"version",{enumerable:!0,get:function(){return j5.default}});var S5=H(i()),E5=H(t()),N5=H(T()),_5=H(R()),q5=H(g()),f5=H(u()),x5=H(V0()),$5=H(x0()),C5=H(j0()),I5=H(h0()),B5=H(l0()),g5=H(c0()),u5=H(V()),j5=H(i0());function H(Q){return Q&&Q.__esModule?Q:{default:Q}}});var z=v5(o0(),1),f6=z.default.v1,x6=z.default.v1ToV6,$6=z.default.v3,C6=z.default.v4,m5=z.default.v5,a0=z.default.v6,I6=z.default.v6ToV1,B6=z.default.v7,g6=z.default.NIL,u6=z.default.MAX,j6=z.default.version,v6=z.default.validate,m6=z.default.stringify,h6=z.default.parse;function t0(Q){return a0({clockseq:Q})}var s0="__pregel_tasks",v="__error__",m="__scheduled__",h="__interrupt__",y="__resume__";var e0="[...]",h5="[Circular]",x=[],K=[];function y5(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function Q1(Q,Z,X,G){if(typeof G>"u")G=y5();d(Q,"",0,[],void 0,0,G);var J;try{if(K.length===0)J=JSON.stringify(Q,Z,X);else J=JSON.stringify(Q,l5(Z),X)}catch(W){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{while(x.length!==0){var P=x.pop();if(P.length===4)Object.defineProperty(P[0],P[1],P[3]);else P[0][P[1]]=P[2]}}return J}function l(Q,Z,X,G){var J=Object.getOwnPropertyDescriptor(G,X);if(J.get!==void 0)if(J.configurable)Object.defineProperty(G,X,{value:Q}),x.push([G,X,Z,J]);else K.push([Z,X,Q]);else G[X]=Q,x.push([G,X,Z])}function d(Q,Z,X,G,J,P,W){P+=1;var A;if(typeof Q==="object"&&Q!==null){for(A=0;A<G.length;A++)if(G[A]===Q){l(h5,Q,Z,J);return}if(typeof W.depthLimit<"u"&&P>W.depthLimit){l(e0,Q,Z,J);return}if(typeof W.edgesLimit<"u"&&X+1>W.edgesLimit){l(e0,Q,Z,J);return}if(G.push(Q),Array.isArray(Q))for(A=0;A<Q.length;A++)d(Q[A],A,A,G,Q,P,W);else{var Y=Object.keys(Q);for(A=0;A<Y.length;A++){var M=Y[A];d(Q[M],M,A,G,Q,P,W)}}G.pop()}}function l5(Q){return Q=typeof Q<"u"?Q:function(Z,X){return X},function(Z,X){if(K.length>0)for(var G=0;G<K.length;G++){var J=K[G];if(J[1]===Z&&J[0]===X){X=J[2],K.splice(G,1);break}}return Q.call(this,Z,X)}}import{load as d5}from"@langchain/core/load";function b5(Q){return Q!==null&&Q.lc===1&&Q.type==="constructor"&&Array.isArray(Q.id)}async function k(Q){if(Q&&typeof Q==="object")if(Array.isArray(Q))return await Promise.all(Q.map((X)=>k(X)));else{let Z={};for(let[X,G]of Object.entries(Q))Z[X]=await k(G);if(Z.lc===2&&Z.type==="undefined")return;else if(Z.lc===2&&Z.type==="constructor"&&Array.isArray(Z.id))try{let X=Z.id[Z.id.length-1],G;switch(X){case"Set":G=Set;break;case"Map":G=Map;break;case"RegExp":G=RegExp;break;case"Error":G=Error;break;default:return Z}if(Z.method)return G[Z.method](...Z.args||[]);else return new G(...Z.args||[])}catch(X){return Z}else if(b5(Z))return d5(JSON.stringify(Z));return Z}return Q}function b(Q,Z,X,G){return{lc:2,type:"constructor",id:[Q.name],method:Z??null,args:X??[],kwargs:G??{}}}function k5(Q){if(Q===void 0)return{lc:2,type:"undefined"};else if(Q instanceof Set||Q instanceof Map)return b(Q.constructor,void 0,[Array.from(Q)]);else if(Q instanceof RegExp)return b(RegExp,void 0,[Q.source,Q.flags]);else if(Q instanceof Error)return b(Q.constructor,void 0,[Q.message]);else if(Q?.lg_name==="Send")return{node:Q.node,args:Q.args};else return Q}var $=class{_dumps(Q){return new TextEncoder().encode(Q1(Q,(X,G)=>{return k5(G)}))}async dumpsTyped(Q){if(Q instanceof Uint8Array)return["bytes",Q];else return["json",this._dumps(Q)]}async _loads(Q){let Z=JSON.parse(Q);return k(Z)}async loadsTyped(Q,Z){if(Q==="bytes")return typeof Z==="string"?new TextEncoder().encode(Z):Z;else if(Q==="json")return this._loads(typeof Z==="string"?Z:new TextDecoder().decode(Z));else throw Error(`Unknown serialization type: ${Q}`)}};function r(Q){if(typeof Q!=="object"||Q===null)return Q;let Z=Array.isArray(Q)?[]:{};for(let X in Q)if(Object.prototype.hasOwnProperty.call(Q,X))Z[X]=r(Q[X]);return Z}function Z1(Q){return{v:Q.v,id:Q.id,ts:Q.ts,channel_values:{...Q.channel_values},channel_versions:{...Q.channel_versions},versions_seen:r(Q.versions_seen)}}var G1=class{serde=new $;constructor(Q){this.serde=Q||this.serde}async get(Q){let Z=await this.getTuple(Q);return Z?Z.checkpoint:void 0}getNextVersion(Q){if(typeof Q==="string")throw Error("Please override this method to use string versions.");return Q!==void 0&&typeof Q==="number"?Q+1:1}};function X1(Q,Z){if(typeof Q==="number"&&typeof Z==="number")return Math.sign(Q-Z);return String(Q).localeCompare(String(Z))}function J1(...Q){return Q.reduce((Z,X,G)=>{if(G===0)return X;return X1(Z,X)>=0?Z:X})}var P1={[v]:-1,[m]:-2,[h]:-3,[y]:-4};function A1(Q){return Q.configurable?.checkpoint_id||Q.configurable?.thread_ts||""}var c=class{serde=new $;constructor(Q){this.serde=Q||this.serde}};
2
+ export{t0 as U,s0 as V,Z1 as W,G1 as X,J1 as Y,P1 as Z,A1 as _};
@@ -0,0 +1,26 @@
1
+ import{Na as a}from"./chunk-sft6ep0c.js";import{kb as s}from"./chunk-jkbtx9va.js";import{Annotation as S}from"@langchain/langgraph";var _=(...G)=>{return{build:(U={})=>{return S.Root(Object.assign({},...G.map((L)=>L.spec),U))}}},H=(G)=>S({reducer:(U,L)=>L,default:G});import{tool as G1}from"@langchain/core/tools";import{z as P}from"zod";var U1=P.object({thought:P.string().describe("Your current thinking step"),nextThoughtNeeded:P.boolean().describe("Whether another thought step is needed"),thoughtNumber:P.number().min(1).describe("Current thought number"),totalThoughts:P.number().min(1).describe("Estimated total thoughts needed"),isRevision:P.boolean().optional().describe("Whether this revises previous thinking"),revisesThought:P.number().min(1).optional().describe("Which thought is being reconsidered"),branchFromThought:P.number().min(1).optional().describe("Branching point thought number"),branchId:P.string().optional().describe("Branch identifier"),needsMoreThoughts:P.boolean().optional().describe("If more thoughts are needed")}),w=[],I={},g1=G1(async(G)=>{try{if(G.thoughtNumber>G.totalThoughts)G.totalThoughts=G.thoughtNumber;if(w.push(G),G.branchFromThought&&G.branchId){if(!I[G.branchId])I[G.branchId]=[];I[G.branchId].push(G)}return JSON.stringify({thoughtNumber:G.thoughtNumber,totalThoughts:G.totalThoughts,nextThoughtNeeded:G.nextThoughtNeeded,branches:Object.keys(I),thoughtHistoryLength:w.length},null,2)}catch(U){return JSON.stringify({error:U instanceof Error?U.message:String(U),status:"failed"},null,2)}},{name:"sequential-thinking",description:`A detailed tool for dynamic and reflective problem-solving through thoughts.
2
+ This tool helps analyze problems through a flexible thinking process that can adapt and evolve.
3
+ Each thought can build on, question, or revise previous insights as understanding deepens.
4
+
5
+ When to use this tool:
6
+ - Breaking down complex problems into steps
7
+ - Planning and design with room for revision
8
+ - Analysis that might need course correction
9
+ - Problems where the full scope might not be clear initially
10
+ - Problems that require a multi-step solution
11
+ - Tasks that need to maintain context over multiple steps
12
+ - Situations where irrelevant information needs to be filtered out
13
+
14
+ Key features:
15
+ - You can adjust total_thoughts up or down as you progress
16
+ - You can question or revise previous thoughts
17
+ - You can add more thoughts even after reaching what seemed like the end
18
+ - You can express uncertainty and explore alternative approaches
19
+ - Not every thought needs to build linearly - you can branch or backtrack
20
+ - Generates a solution hypothesis
21
+ - Verifies the hypothesis based on the Chain of Thought steps
22
+ - Repeats the process until satisfied
23
+ - Provides a correct answer`,schema:U1});import{tool as f}from"@langchain/core/tools";import{z as q}from"zod";var L1=q.object({url:q.string().url().describe("the url to crawl"),raw:q.boolean().optional().default(!1).describe("return raw html")}),W1=q.object({query:q.string().describe("the query to search"),engines:q.array(q.enum(["basic","npm","juejin","anthropic","github"])).default(["basic"]).describe("the engines to use"),returnType:q.enum(["json","markdown"]).default("json").describe("the content type to return"),withMetadata:q.boolean().default(!0).describe("whether to include metadata in the search results")}),t1=f(async({url:G})=>{if(!G)return{status:"error",error:"URL is required"};let U=await fetch(`${process.env.SEARCH_SERVER_URL||"http://localhost:8123"}/website-to-md/extract`,{method:"POST",body:JSON.stringify({url:G})});if(!U.ok)throw Error(`HTTP error! status: ${U.status}`);return await U.text()},{name:"read_web_page",description:"A powerful web content extraction tool that retrieves and processes raw content from specified URLs, ideal for data collection, content analysis, and research tasks.",schema:q.object(L1.shape)}),s1=f(async({query:G,engines:U})=>{let L=await fetch(`${process.env.SEARCH_SERVER_URL||"http://localhost:8123"}/website-to-md/search`,{method:"POST",body:JSON.stringify({query:G,engines:U,returnType:"json",withMetadata:!0})});if(!L.ok)throw Error(`HTTP error! status: ${L.status}`);return await L.text()},{name:"web_search",description:"A powerful web search tool that provides comprehensive, real-time results using search engine. Returns relevant web content with customizable parameters for result count, content type, and domain filtering. Ideal for gathering current information, news, and detailed web content analysis.",schema:q.object(W1.shape)});import{AIMessage as Y0,ToolMessage as Z0}from"@langchain/core/messages";import{AIMessage as L0,HumanMessage as W0,SystemMessage as X0,ToolMessage as B0}from"@langchain/core/messages";var V0=(G)=>{return G?.configurable?.thread_id};import{Command as $0,getCurrentTaskInput as H0}from"@langchain/langgraph";import{z as O0}from"zod";import{ToolMessage as F0}from"@langchain/core/messages";import{tool as z0}from"@langchain/core/tools";import{Annotation as N,MessagesAnnotation as B1,START as _0,StateGraph as D0}from"@langchain/langgraph";var A=N.Root({...B1.spec,activeAgent:N});import{z as M0}from"zod";import{ToolMessage as u0}from"@langchain/core/messages";import{tool as r0}from"@langchain/core/tools";import{Command as p0,getCurrentTaskInput as i0}from"@langchain/langgraph";import{Command as m0}from"@langchain/langgraph";import{ChatOpenAI as GG}from"@langchain/openai";import{SystemMessage as WG,HumanMessage as XG,AIMessageChunk as BG,ToolMessage as JG}from"@langchain/core/messages";import{z as b}from"zod";import{withLangGraph as K1}from"@langchain/langgraph/zod";import{MessagesZodMeta as Y1}from"@langchain/langgraph";var T=b.object({messages:K1(b.custom(),Y1).default([])});import{AIMessage as I1,AIMessageChunk as h1,isAIMessage as _1}from"@langchain/core/messages";import{ChatGenerationChunk as n}from"@langchain/core/outputs";import{wrapOpenAIClientError as D1}from"@langchain/openai";import{convertToOpenAITool as QG,isLangChainTool as jG}from"@langchain/core/utils/function_calling";import{isInteropZodSchema as $G}from"@langchain/core/utils/types";import{toJsonSchema as PG}from"@langchain/core/utils/json_schema";function M(G){if(!G)return;else if(G==="any"||G==="required")return"required";else if(G==="auto")return"auto";else if(G==="none")return"none";else if(typeof G==="string")return{type:"function",function:{name:G}};else return G}import{BaseChatOpenAI as S1}from"@langchain/openai";import{AIMessage as d,AIMessageChunk as Z1,ChatMessage as x1,ChatMessageChunk as V1,FunctionMessageChunk as Q1,HumanMessageChunk as j1,SystemMessageChunk as u,ToolMessage as p,ToolMessageChunk as q1,parseBase64DataUrl as k,parseMimeType as r,isDataContentBlock as $1,iife as H1,convertToProviderContentBlock as P1}from"@langchain/core/messages";import{convertLangChainToolCallToOpenAI as O1,makeInvalidToolCall as E1,parseToolCall as F1}from"@langchain/core/output_parsers/openai_tools";import{isZodSchemaV3 as FG,isZodSchemaV4 as yG}from"@langchain/core/utils/types";import{toJSONSchema as RG,parse as IG}from"zod/v4/core";import{zodResponseFormat as _G}from"openai/helpers/zod";function C(G,U){if(U&&typeof U==="object"&&"images"in U&&Array.isArray(U.images)){let L=U.images.filter((W)=>typeof W?.image_url?.url==="string").map((W)=>({type:"image",url:W.image_url.url}));return[{type:"text",text:G},...L]}return G}import{messageToOpenAIRole as i}from"@langchain/openai";var y1={providerName:"ChatOpenAI",fromStandardTextBlock(G){return{type:"text",text:G.text}},fromStandardImageBlock(G){if(G.source_type==="url")return{type:"image_url",image_url:{url:G.url,...G.metadata?.detail?{detail:G.metadata.detail}:{}}};if(G.source_type==="base64")return{type:"image_url",image_url:{url:`data:${G.mime_type??""};base64,${G.data}`,...G.metadata?.detail?{detail:G.metadata.detail}:{}}};throw Error(`Image content blocks with source_type ${G.source_type} are not supported for ChatOpenAI`)},fromStandardAudioBlock(G){if(G.source_type==="url"){let U=k({dataUrl:G.url});if(!U)throw Error(`URL audio blocks with source_type ${G.source_type} must be formatted as a data URL for ChatOpenAI`);let L=U.mime_type||G.mime_type||"",W;try{W=r(L)}catch{throw Error(`Audio blocks with source_type ${G.source_type} must have mime type of audio/wav or audio/mp3`)}if(W.type!=="audio"||W.subtype!=="wav"&&W.subtype!=="mp3")throw Error(`Audio blocks with source_type ${G.source_type} must have mime type of audio/wav or audio/mp3`);return{type:"input_audio",input_audio:{format:W.subtype,data:U.data}}}if(G.source_type==="base64"){let U;try{U=r(G.mime_type??"")}catch{throw Error(`Audio blocks with source_type ${G.source_type} must have mime type of audio/wav or audio/mp3`)}if(U.type!=="audio"||U.subtype!=="wav"&&U.subtype!=="mp3")throw Error(`Audio blocks with source_type ${G.source_type} must have mime type of audio/wav or audio/mp3`);return{type:"input_audio",input_audio:{format:U.subtype,data:G.data}}}throw Error(`Audio content blocks with source_type ${G.source_type} are not supported for ChatOpenAI`)},fromStandardFileBlock(G){if(G.source_type==="url"){if(!k({dataUrl:G.url}))throw Error(`URL file blocks with source_type ${G.source_type} must be formatted as a data URL for ChatOpenAI`);return{type:"file",file:{file_data:G.url,...G.metadata?.filename||G.metadata?.name?{filename:G.metadata?.filename||G.metadata?.name}:{}}}}if(G.source_type==="base64")return{type:"file",file:{file_data:`data:${G.mime_type??""};base64,${G.data}`,...G.metadata?.filename||G.metadata?.name||G.metadata?.title?{filename:G.metadata?.filename||G.metadata?.name||G.metadata?.title}:{}}};if(G.source_type==="id")return{type:"file",file:{file_id:G.id}};throw Error(`File content blocks with source_type ${G.source_type} are not supported for ChatOpenAI`)}},c=({message:G,rawResponse:U,includeRawResponse:L})=>{let W=G.tool_calls;switch(G.role){case"assistant":{let X=[],B=[];for(let K of W??[])try{X.push(F1(K,{returnId:!0}))}catch(Q){B.push(E1(K,Q.message))}let J={function_call:G.function_call,tool_calls:W};if(L!==void 0)J.__raw_response=U;let v={model_provider:"openai",model_name:U.model,...U.system_fingerprint?{usage:{...U.usage},system_fingerprint:U.system_fingerprint}:{}};if(G.audio)J.audio=G.audio;let Z=C(G.content||"",U.choices?.[0]?.message);return new d({content:Z,tool_calls:X,invalid_tool_calls:B,additional_kwargs:J,response_metadata:v,id:U.id})}default:return new x1(G.content||"",G.role??"unknown")}},g=({delta:G,rawResponse:U,includeRawResponse:L,defaultRole:W})=>{let X=G.role??W,B=G.content??"",J;if(G.function_call)J={function_call:G.function_call};else if(G.tool_calls)J={tool_calls:G.tool_calls};else J={};if(L)J.__raw_response=U;if(G.audio)J.audio={...G.audio,index:U.choices[0].index};let v={model_provider:"openai",usage:{...U.usage}};if(X==="user")return new j1({content:B,response_metadata:v});else if(X==="assistant"){let Z=[];if(Array.isArray(G.tool_calls))for(let K of G.tool_calls)Z.push({name:K.function?.name,args:K.function?.arguments,id:K.id,index:K.index,type:"tool_call_chunk"});return new Z1({content:B,tool_call_chunks:Z,additional_kwargs:J,id:U.id,response_metadata:v})}else if(X==="system")return new u({content:B,response_metadata:v});else if(X==="developer")return new u({content:B,response_metadata:v,additional_kwargs:{__openai_role__:"developer"}});else if(X==="function")return new Q1({content:B,additional_kwargs:J,name:G.name,response_metadata:v});else if(X==="tool")return new q1({content:B,additional_kwargs:J,tool_call_id:G.tool_call_id,response_metadata:v});else return new V1({content:B,role:X,response_metadata:v})},z1=(G)=>{if(G.type==="image"){if(G.url)return{type:"image_url",image_url:{url:G.url}};else if(G.data)return{type:"image_url",image_url:{url:`data:${G.mimeType};base64,${G.data}`}}}if(G.type==="audio"){if(G.data){let U=H1(()=>{let[,L]=G.mimeType.split("/");if(L==="wav"||L==="mp3")return L;return"wav"});return{type:"input_audio",input_audio:{data:G.data.toString(),format:U}}}}if(G.type==="file"){if(G.data)return{type:"file",file:{file_data:G.data.toString()}};if(G.fileId)return{type:"file",file:{file_id:G.fileId}}}return};function m(G){if(!G)return!1;if(/^o\d/.test(G??""))return!0;if(G.startsWith("gpt-5")&&!G.startsWith("gpt-5-chat"))return!0;return!1}var R1=({message:G,model:U})=>{let L=i(G);if(L==="system"&&m(U))L="developer";if(L==="developer")return{role:"developer",content:G.contentBlocks.filter((X)=>X.type==="text")};else if(L==="system")return{role:"system",content:G.contentBlocks.filter((X)=>X.type==="text")};else if(L==="assistant")return{role:"assistant",content:G.contentBlocks.filter((X)=>X.type==="text")};else if(L==="tool"&&p.isInstance(G))return{role:"tool",tool_call_id:G.tool_call_id,content:G.contentBlocks.filter((X)=>X.type==="text")};else if(L==="function")return{role:"function",name:G.name??"",content:G.contentBlocks.filter((X)=>X.type==="text").join("")};function*W(X){for(let B of X){if(B.type==="text")yield{type:"text",text:B.text};let J=z1(B);if(J)yield J}}return{role:"user",content:Array.from(W(G.contentBlocks))}},D=({messages:G,model:U})=>{return G.flatMap((L)=>{if("output_version"in L.response_metadata&&L.response_metadata?.output_version==="v1")return R1({message:L});let W=i(L);if(W==="system"&&m(U))W="developer";let X=typeof L.content==="string"?L.content:L.content.map((J)=>{if($1(J))return P1(J,y1);return J}),B={role:W,content:X};if(L.name!=null)B.name=L.name;if(L.additional_kwargs.function_call!=null)B.function_call=L.additional_kwargs.function_call,B.content="";if(L.additional_kwargs?.reasoning_content&&U?.includes("deepseek"))B.reasoning_content=L.additional_kwargs.reasoning_content;if(d.isInstance(L)&&!!L.tool_calls?.length)B.tool_calls=L.tool_calls.map(O1),B.content="";else{if(L.additional_kwargs.tool_calls!=null)B.tool_calls=L.additional_kwargs.tool_calls;if(p.isInstance(L)&&L.tool_call_id!=null)B.tool_call_id=L.tool_call_id}if(L.additional_kwargs.audio&&typeof L.additional_kwargs.audio==="object"&&"id"in L.additional_kwargs.audio){let J={role:"assistant",audio:{id:L.additional_kwargs.audio.id}};return[B,J]}return B})};class R extends S1{invocationParams(G,U){let L;if(G?.strict!==void 0)L=G.strict;else if(this.supportsStrictToolCalling!==void 0)L=this.supportsStrictToolCalling;let W={};if(G?.stream_options!==void 0)W={stream_options:G.stream_options};else if(this.streamUsage&&(this.streaming||U?.streaming))W={stream_options:{include_usage:!0}};let X={model:this.model,temperature:this.temperature,top_p:this.topP,frequency_penalty:this.frequencyPenalty,presence_penalty:this.presencePenalty,logprobs:this.logprobs,top_logprobs:this.topLogprobs,n:this.n,logit_bias:this.logitBias,stop:G?.stop??this.stopSequences,user:this.user,stream:this.streaming,functions:G?.functions,function_call:G?.function_call,tools:G?.tools?.length?G.tools.map((J)=>this._convertChatOpenAIToolToCompletionsTool(J,{strict:L})):void 0,tool_choice:M(G?.tool_choice),response_format:this._getResponseFormat(G?.response_format),seed:G?.seed,...W,parallel_tool_calls:G?.parallel_tool_calls,...this.audio||G?.audio?{audio:this.audio||G?.audio}:{},...this.modalities||G?.modalities?{modalities:this.modalities||G?.modalities}:{},...this.modelKwargs,prompt_cache_key:G?.promptCacheKey??this.promptCacheKey,verbosity:G?.verbosity??this.verbosity};if(G?.prediction!==void 0)X.prediction=G.prediction;if(this.service_tier!==void 0)X.service_tier=this.service_tier;if(G?.service_tier!==void 0)X.service_tier=G.service_tier;let B=this._getReasoningParams(G);if(B!==void 0&&B.effort!==void 0)X.reasoning_effort=B.effort;if(this.reasoning)X.max_completion_tokens=this.maxTokens===-1?void 0:this.maxTokens;else X.max_tokens=this.maxTokens===-1?void 0:this.maxTokens;return X}async _generate(G,U,L){let W={},X=this.invocationParams(U),B=D({messages:G,model:this.model});if(X.stream){let J=this._streamResponseChunks(G,U,L),v={};for await(let Y of J){Y.message.response_metadata={...Y.generationInfo,...Y.message.response_metadata};let V=Y.generationInfo?.completion??0;if(v[V]===void 0)v[V]=Y;else v[V]=v[V].concat(Y)}let Z=Object.entries(v).sort(([Y],[V])=>parseInt(Y,10)-parseInt(V,10)).map(([Y,V])=>V),{functions:K,function_call:Q}=this.invocationParams(U),x=await this._getEstimatedTokenCountFromPrompt(G,K,Q),$=await this._getNumTokensFromGenerations(Z);return W.input_tokens=x,W.output_tokens=$,W.total_tokens=x+$,{generations:Z,llmOutput:{estimatedTokenUsage:{promptTokens:W.input_tokens,completionTokens:W.output_tokens,totalTokens:W.total_tokens}}}}else{let J=await this.completionWithRetry({...X,stream:!1,messages:B},{signal:U?.signal,...U?.options}),{completion_tokens:v,prompt_tokens:Z,total_tokens:K,prompt_tokens_details:Q,completion_tokens_details:x}=J?.usage??{};if(v)W.output_tokens=(W.output_tokens??0)+v;if(Z)W.input_tokens=(W.input_tokens??0)+Z;if(K)W.total_tokens=(W.total_tokens??0)+K;if(Q?.audio_tokens!==null||Q?.cached_tokens!==null)W.input_token_details={...Q?.audio_tokens!==null&&{audio:Q?.audio_tokens},...Q?.cached_tokens!==null&&{cache_read:Q?.cached_tokens}};if(x?.audio_tokens!==null||x?.reasoning_tokens!==null)W.output_token_details={...x?.audio_tokens!==null&&{audio:x?.audio_tokens},...x?.reasoning_tokens!==null&&{reasoning:x?.reasoning_tokens}};let $=[];for(let Y of J?.choices??[]){let V=Y.message?.content??"",F=Y.message?.reasoning_content??Y.message?.reasoning??"",j={text:V,message:this._convertCompletionsMessageToBaseMessage(Y.message??{role:"assistant"},J)};if(j.message.additional_kwargs={...j.message.additional_kwargs,reasoning_content:F},j.generationInfo={...Y.finish_reason?{finish_reason:Y.finish_reason}:{},...Y.logprobs?{logprobs:Y.logprobs}:{}},_1(j.message))j.message.usage_metadata=W;j.message=new I1(Object.fromEntries(Object.entries(j.message).filter(([y])=>!y.startsWith("lc_")))),$.push(j)}return{generations:$,llmOutput:{tokenUsage:{promptTokens:W.input_tokens,completionTokens:W.output_tokens,totalTokens:W.total_tokens}}}}}async*_streamResponseChunks(G,U,L){let W=D({messages:G,model:this.model}),X={...this.invocationParams(U,{streaming:!0}),messages:W,stream:!0},B,J=await this.completionWithRetry(X,U),v;for await(let Z of J){let K=Z?.choices?.[0];if(Z.usage)v=Z.usage;if(!K)continue;let{delta:Q}=K;if(!Q)continue;let x=this._convertCompletionsDeltaToBaseMessageChunk(Q,Z,B),$=Q.reasoning_content??Q.reasoning??"";if($)x.additional_kwargs={...x.additional_kwargs,reasoning_content:$};B=Q.role??B;let Y={prompt:U.promptIndex??0,completion:K.index??0};if(typeof x.content!=="string"){console.log("[WARNING]: Received non-string content from OpenAI. This is currently not supported.");continue}let V={...Y};if(K.finish_reason!=null)V.finish_reason=K.finish_reason,V.system_fingerprint=Z.system_fingerprint,V.model_name=Z.model,V.service_tier=Z.service_tier;if(this.logprobs)V.logprobs=K.logprobs;let F=new n({message:x,text:x.content,generationInfo:V});yield F,await L?.handleLLMNewToken(F.text??"",Y,void 0,void 0,void 0,{chunk:F})}if(v){let Z={...v.prompt_tokens_details?.audio_tokens!==null&&{audio:v.prompt_tokens_details?.audio_tokens},...v.prompt_tokens_details?.cached_tokens!==null&&{cache_read:v.prompt_tokens_details?.cached_tokens}},K={...v.completion_tokens_details?.audio_tokens!==null&&{audio:v.completion_tokens_details?.audio_tokens},...v.completion_tokens_details?.reasoning_tokens!==null&&{reasoning:v.completion_tokens_details?.reasoning_tokens}};yield new n({message:new h1({content:"",response_metadata:{usage:{...v}},usage_metadata:{input_tokens:v.prompt_tokens,output_tokens:v.completion_tokens,total_tokens:v.total_tokens,...Object.keys(Z).length>0&&{input_token_details:Z},...Object.keys(K).length>0&&{output_token_details:K}}}),text:""})}if(U.signal?.aborted)throw Error("AbortError")}async completionWithRetry(G,U){let L=this._getClientOptions(U),W=G.response_format&&G.response_format.type==="json_schema";return this.caller.call(async()=>{try{if(W&&!G.stream)return await this.client.chat.completions.parse(G,L);else return await this.client.chat.completions.create(G,L)}catch(X){throw D1(X)}})}_convertCompletionsDeltaToBaseMessageChunk(G,U,L){return g({delta:G,rawResponse:U,includeRawResponse:this.__includeRawResponse,defaultRole:L})}_convertCompletionsMessageToBaseMessage(G,U){return c({message:G,rawResponse:U,includeRawResponse:this.__includeRawResponse})}}import{createMiddleware as iG}from"langchain";import{z as E}from"zod";import{MessagesAnnotation as w1}from"@langchain/langgraph";import{SubAgentAnnotation as f1,SubAgentStateSchema as N1}from"@langgraph-js/standard-agent";var vU=T.extend(N1.shape).extend({provider_id:E.string().default("openai"),provider_type:E.string().default("openai"),model_id:E.string().default("qwen-plus"),agent_name:E.string().default("Code Agent"),switch_command:E.string().optional(),enable_thinking:E.boolean().default(!0),user_id:E.string().optional(),thread_id:E.string().optional()}),l=_(f1,w1).build({provider_id:H(()=>"openai"),provider_type:H(()=>"openai"),model_id:H(()=>"qwen-plus"),agent_name:H(()=>"Code Agent"),switch_command:H(()=>null),enable_thinking:H(()=>!0),user_id:H(()=>""),thread_id:H(()=>"")});import{ChatAnthropic as A1}from"@langchain/anthropic";import{ChatGoogleGenerativeAI as b1}from"@langchain/google-genai";var t=async(G,U={})=>{let{modelProvider:L,enableThinking:W=!0}=U,X="v1",B;if(L==="anthropic")B=new A1({model:G,streamUsage:!0,streaming:!0,maxRetries:1,maxTokens:64000,thinking:W?{budget_tokens:1024,type:"enabled"}:void 0,apiKey:U.apiKey,anthropicApiUrl:U.baseURL,metadata:U.metadata,outputVersion:"v1"});else if(L==="gemini"||L==="google")console.log(process.env.GOOGLE_BASE_URL),B=new b1({model:G,apiKey:U.apiKey,baseUrl:U.baseURL||process.env.GOOGLE_BASE_URL,maxRetries:1,streaming:!0,streamUsage:!0,thinkingConfig:{},metadata:U.metadata,outputVersion:"v1"});else B=new R({model:G,configuration:{baseURL:U.baseURL,apiKey:U.apiKey},streamUsage:!0,maxRetries:1,modelKwargs:W?{thinking:{type:"enabled"}}:void 0,metadata:U.metadata,outputVersion:"v1"});return B};import{createAgent as M1,tool as C1}from"langchain";import{anthropicPromptCachingMiddleware as u1}from"@langgraph-js/standard-agent";import{MCPMiddleware as T1}from"@langgraph-js/standard-agent";class h extends T1{constructor(G){super({configProvider:async()=>h.loadConfigFromStore(),cache:G})}static async loadConfigFromStore(){try{let G=new s;await G.initialize();let U=await G.getConfig();if(!U.mcp_config||Object.keys(U.mcp_config).length===0)return null;return{servers:U.mcp_config}}catch(G){return console.error("Failed to load MCP config from store:",G),null}}}import{humanInTheLoopMiddleware as k1}from"@langgraph-js/standard-agent";var r1={ask_user_questions:{allowedDecisions:["respond","approve","reject","edit"]}};async function SU(G,U,L,W,X){let B=!!X?.parent_id,J=await U.getAgent(G);if(!J)throw Error(`Agent not found: ${G}`);let v=await U.validateAgent(G);if(!v.valid)throw Error(`Agent validation failed: ${JSON.stringify(v.errors)}`);let Z=await t(L.model_id,{modelProvider:L.provider_id,streamUsage:!0,enableThinking:L.enable_thinking,metadata:{parent_id:X?.parent_id}}),K=[],Q=U.tools;for(let[j,y]of Object.entries(J.tools)){let O=Q.getImplementation(j);if(!O){console.warn(`Tool ${j} not found in registry`);continue}if(!O.name||!y)continue;let o=C1(async(e)=>{let z=await O.execute(e);if(z&&typeof z==="object"&&"content"in z)return z.content;return z},{name:O.name,description:O.description,schema:O.paramsSchema});K.push(o)}let x=[];for(let[j,y]of Object.entries(J.middleware)){if(j==="subagents"&&B)continue;let O=U.middlewares.getImplementation(j);if(!y)break;x.push(await O.execute(y.customParams||{}))}let $=new h;x.push($);let Y={...r1};if(process.env.YOLO_MODE!=="true")Object.assign(Y,{terminal:{allowedDecisions:["approve","reject","edit"]}});if(x.push(k1({interruptOn:Y})),process.env.MODEL_PROVIDER==="anthropic")x.push(u1());let V=await U.getPrompt(J.systemPromptId);if(!V)throw Error(`Prompt not found: ${J.systemPromptId}`);let F=V.content+`
24
+
25
+ ${await a(L)}`;return M1({name:B?`subagent_${X.parent_id}`:J.name,model:Z,systemPrompt:F,tools:K,stateSchema:l,middleware:x})}async function wU(G){return(await G.listAgents()).map((L)=>L.id)}
26
+ export{V0 as Ga,vU as Ha,l as Ia,t as Ja,SU as Ka,wU as La};