@intent-hq/web 2.300.1 → 2.301.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 (248) hide show
  1. package/package.json +1 -1
  2. package/web/app/immutable/chunks/{D24Lh2xV.js → -1vWYJiy.js} +1 -1
  3. package/web/app/immutable/chunks/{B00a-E5y.js → -8mBz6EW.js} +1 -1
  4. package/web/app/immutable/chunks/{seZ3kiWB.js → 2Iga5834.js} +1 -1
  5. package/web/app/immutable/chunks/{DD_wk1WS.js → 3-bIA0_b.js} +2 -2
  6. package/web/app/immutable/chunks/{VIc8fDOK.js → 3cwLWYk-.js} +1 -1
  7. package/web/app/immutable/chunks/{uuGBA4cr.js → 4byfznQh.js} +1 -1
  8. package/web/app/immutable/chunks/{D_HBTAOp.js → 6WuGSm1v.js} +2 -2
  9. package/web/app/immutable/chunks/{CoKvDYIY.js → 6hOEL6g0.js} +1 -1
  10. package/web/app/immutable/chunks/{CtPUg4ad.js → 8FC2Ymrs.js} +1 -1
  11. package/web/app/immutable/chunks/{XRDpypMz.js → 90FT2TPG.js} +2 -2
  12. package/web/app/immutable/chunks/{7lKdD900.js → 9Bp-qw-c.js} +1 -1
  13. package/web/app/immutable/chunks/{B6GFXjaE.js → 9pcH5qab.js} +4 -4
  14. package/web/app/immutable/chunks/{CHHzckiT.js → Alw6Bgam.js} +1 -1
  15. package/web/app/immutable/chunks/{DOb83nqS.js → B-pxGJ33.js} +1 -1
  16. package/web/app/immutable/chunks/{CTb5E7ts.js → B1f-Dpa6.js} +1 -1
  17. package/web/app/immutable/chunks/{C7jsu14h.js → B1ySs1Ps.js} +1 -1
  18. package/web/app/immutable/chunks/{6bctAAQ4.js → B3pWDt4A.js} +2 -2
  19. package/web/app/immutable/chunks/{BVR4ypbe.js → B5FPkuba.js} +1 -1
  20. package/web/app/immutable/chunks/{Ca7foKhO.js → B5gRIzZb.js} +1 -1
  21. package/web/app/immutable/chunks/{Cr3qamxz.js → B6wnyXxa.js} +1 -1
  22. package/web/app/immutable/chunks/{CbB5VTQO.js → B9e_lQGd.js} +1 -1
  23. package/web/app/immutable/chunks/{WAk1in99.js → BAJdDJmt.js} +1 -1
  24. package/web/app/immutable/chunks/{BKb2X4nY.js → BBfmiZwR.js} +1 -1
  25. package/web/app/immutable/chunks/{J1JvTxzS.js → BCFfKX9W.js} +1 -1
  26. package/web/app/immutable/chunks/{BOBlxuhv.js → BDHBtQ3l.js} +1 -1
  27. package/web/app/immutable/chunks/{DOP6s1nq.js → BDUAehdP.js} +4 -4
  28. package/web/app/immutable/chunks/{BBi8ZQ4f.js → BFnbk-Kf.js} +1 -1
  29. package/web/app/immutable/chunks/{DJPQ2gWl.js → BGGzsVfR.js} +1 -1
  30. package/web/app/immutable/chunks/{ClQcbOPg.js → BH5cuIQi.js} +1 -1
  31. package/web/app/immutable/chunks/{B08ZRfRe.js → BIDHEGct.js} +1 -1
  32. package/web/app/immutable/chunks/{CMT8W8d8.js → BIOk6wuV.js} +1 -1
  33. package/web/app/immutable/chunks/{D1YVXYbM.js → BJ_6izfA.js} +7 -7
  34. package/web/app/immutable/chunks/{CcJbNmRb.js → BMPb03sg.js} +1 -1
  35. package/web/app/immutable/chunks/{C1ANrPzv.js → BNPFPBlO.js} +1 -1
  36. package/web/app/immutable/chunks/{MSSSP_6i.js → BNVzhw1y.js} +1 -1
  37. package/web/app/immutable/chunks/{CNcMC2eS.js → BO9EbiHx.js} +1 -1
  38. package/web/app/immutable/chunks/{C0sDoyzY.js → BPC4nNQe.js} +1 -1
  39. package/web/app/immutable/chunks/{0nqxMME2.js → BR-wS1W8.js} +1 -1
  40. package/web/app/immutable/chunks/{BRX8YzX5.js → BRKe81M1.js} +1 -1
  41. package/web/app/immutable/chunks/{BsU6XLOF.js → BSuE_PI2.js} +1 -1
  42. package/web/app/immutable/chunks/{BS-h7rm3.js → BTIw3yd0.js} +1 -1
  43. package/web/app/immutable/chunks/{DHUOIULZ.js → BTeM7_LX.js} +1 -1
  44. package/web/app/immutable/chunks/{DW4Kmsyn.js → BU8fu6L_.js} +1 -1
  45. package/web/app/immutable/chunks/{DfARSELN.js → BVTor63R.js} +3 -3
  46. package/web/app/immutable/chunks/{zFZ2p9zT.js → BW_04noU.js} +1 -1
  47. package/web/app/immutable/chunks/{B648LYGe.js → BWerHQW_.js} +1 -1
  48. package/web/app/immutable/chunks/{3sRD2IoY.js → BX8IWbyz.js} +2 -2
  49. package/web/app/immutable/chunks/{BzvRDF8m.js → BYZmS9Dk.js} +1 -1
  50. package/web/app/immutable/chunks/{C_A8Orac.js → BYk_qw69.js} +1 -1
  51. package/web/app/immutable/chunks/{Bx4lXaHY.js → BYxkGGC-.js} +1 -1
  52. package/web/app/immutable/chunks/{D8RydOZp.js → B_vcNRuc.js} +1 -1
  53. package/web/app/immutable/chunks/{Dj9vAmvP.js → BapFUUqZ.js} +1 -1
  54. package/web/app/immutable/chunks/{COWTRkIf.js → Bd69ye4n.js} +1 -1
  55. package/web/app/immutable/chunks/{gM93sUNx.js → Bd9XSgIb.js} +1 -1
  56. package/web/app/immutable/chunks/{BKoNmPdl.js → BdCx7DnP.js} +1 -1
  57. package/web/app/immutable/chunks/{3cdteGtc.js → BeRTGLrw.js} +1 -1
  58. package/web/app/immutable/chunks/{BggFqLcQ.js → BghpE59-.js} +1 -1
  59. package/web/app/immutable/chunks/{DD1B8iWW.js → BhYLt5th.js} +1 -1
  60. package/web/app/immutable/chunks/{Ozne-tFy.js → Bk5SMnS3.js} +49 -49
  61. package/web/app/immutable/chunks/{x9rbYKj9.js → BlDfHMda.js} +1 -1
  62. package/web/app/immutable/chunks/{QvMOlSpE.js → BlPj7Bqh.js} +1 -1
  63. package/web/app/immutable/chunks/{CLwukbv5.js → Bo2QS6PZ.js} +1 -1
  64. package/web/app/immutable/chunks/{CcRQKkS2.js → Bo7YWMXl.js} +1 -1
  65. package/web/app/immutable/chunks/{0-b4ZvTK.js → BuXA0uuF.js} +1 -1
  66. package/web/app/immutable/chunks/{9ZGNcJrk.js → BvUM18CV.js} +1 -1
  67. package/web/app/immutable/chunks/BvgUrOVR.js +227 -0
  68. package/web/app/immutable/chunks/{BO3uDFyf.js → BwEpZ6hl.js} +3 -3
  69. package/web/app/immutable/chunks/{xnqT8zWA.js → BxC2yVbF.js} +1 -1
  70. package/web/app/immutable/chunks/{DPODhnzy.js → BxgeL5Cn.js} +2 -2
  71. package/web/app/immutable/chunks/{CAdJgRT-.js → BzDjODLF.js} +1 -1
  72. package/web/app/immutable/chunks/{CojjevwO.js → BzwTpGAs.js} +3 -3
  73. package/web/app/immutable/chunks/{Cs8-gQAN.js → C-yDVBGV.js} +1 -1
  74. package/web/app/immutable/chunks/{MkI4_nBU.js → C0DySWij.js} +1 -1
  75. package/web/app/immutable/chunks/{IFT0w_rv.js → C4Zy0P7R.js} +1 -1
  76. package/web/app/immutable/chunks/{2ZXwYJuA.js → C4wwbPuR.js} +1 -1
  77. package/web/app/immutable/chunks/{xn0HgFL2.js → C6PYFU8v.js} +1 -1
  78. package/web/app/immutable/chunks/{CViglT06.js → C9dil5-t.js} +1 -1
  79. package/web/app/immutable/chunks/{B5FD8FRF.js → CB1wD_PC.js} +1 -1
  80. package/web/app/immutable/chunks/{CjZ3vck_.js → CBDImldB.js} +1 -1
  81. package/web/app/immutable/chunks/{s1gAk8mT.js → CBYPZH-W.js} +1 -1
  82. package/web/app/immutable/chunks/CDxER840.js +1 -0
  83. package/web/app/immutable/chunks/{h-HGzFkJ.js → CEOoXkJa.js} +4 -4
  84. package/web/app/immutable/chunks/{DczZ5XlV.js → CEs-7mch.js} +3 -3
  85. package/web/app/immutable/chunks/{ConaHaDS.js → CFgK9GfH.js} +1 -1
  86. package/web/app/immutable/chunks/{CIhr4uzF.js → CGwmPMQc.js} +1 -1
  87. package/web/app/immutable/chunks/{BQ3lIAxU.js → CHDy3QTf.js} +1 -1
  88. package/web/app/immutable/chunks/{B1BoYgO3.js → CK1vqkSE.js} +1 -1
  89. package/web/app/immutable/chunks/{Cc7p6my_.js → CKI5DKl7.js} +6 -6
  90. package/web/app/immutable/chunks/{Cz3L4t3K.js → CKj5bwOX.js} +1 -1
  91. package/web/app/immutable/chunks/{CZ0U9o7-.js → CMAl4tQM.js} +1 -1
  92. package/web/app/immutable/chunks/{Q0MFbJMW.js → CMQqNZFP.js} +1 -1
  93. package/web/app/immutable/chunks/CMS0Mt7v.js +1 -0
  94. package/web/app/immutable/chunks/{BB2kR3UP.js → CNGkxhSe.js} +1 -1
  95. package/web/app/immutable/chunks/{D_fVcaam.js → CORu-AyV.js} +1 -1
  96. package/web/app/immutable/chunks/{5GrgBznS.js → COuOkYRg.js} +1 -1
  97. package/web/app/immutable/chunks/{CLt_MpVR.js → CPBiF1gr.js} +1 -1
  98. package/web/app/immutable/chunks/{qoEkEEyr.js → CS1PgLFW.js} +1 -1
  99. package/web/app/immutable/chunks/{UiwXoSAw.js → CSiZwu1h.js} +1 -1
  100. package/web/app/immutable/chunks/{5sBQ6rKD.js → CT_wb7-d.js} +1 -1
  101. package/web/app/immutable/chunks/{Dp-w6U2a.js → CTt3kMm1.js} +1 -1
  102. package/web/app/immutable/chunks/{CI_dqO7A.js → CUl5WBR5.js} +1 -1
  103. package/web/app/immutable/chunks/{BBKgmsAl.js → CUt6iXkF.js} +1 -1
  104. package/web/app/immutable/chunks/{Djo4Utna.js → CYfBmNaT.js} +1 -1
  105. package/web/app/immutable/chunks/{C0yADNxK.js → C_-tA5vs.js} +2 -2
  106. package/web/app/immutable/chunks/{D31GMMqw.js → C_VMQN67.js} +1 -1
  107. package/web/app/immutable/chunks/{CjJmucSj.js → C_uqctJM.js} +1 -1
  108. package/web/app/immutable/chunks/{BnoYK4Cg.js → CaibRh-G.js} +1 -1
  109. package/web/app/immutable/chunks/{DOlRZEzP.js → Cavwt8Mn.js} +1 -1
  110. package/web/app/immutable/chunks/{dAdxFhG6.js → CbF4ODHW.js} +1 -1
  111. package/web/app/immutable/chunks/{qVOvfVaw.js → Cdz-CHGd.js} +1 -1
  112. package/web/app/immutable/chunks/{DYFbONVh.js → CenrrJuj.js} +2 -2
  113. package/web/app/immutable/chunks/{B0WURFIt.js → Cf891EVZ.js} +1 -1
  114. package/web/app/immutable/chunks/{ByOlSVuA.js → CfM2ZJef.js} +1 -1
  115. package/web/app/immutable/chunks/{C9KORVFh.js → Cg_QSby7.js} +1 -1
  116. package/web/app/immutable/chunks/{DxZVPzM-.js → Cl5KdYjm.js} +1 -1
  117. package/web/app/immutable/chunks/{GgqVQsTS.js → Cn23SDXY.js} +1 -1
  118. package/web/app/immutable/chunks/{5D7P8R1M.js → Cnlend6s.js} +1 -1
  119. package/web/app/immutable/chunks/{BKBZBubB.js → CqnucWm4.js} +1 -1
  120. package/web/app/immutable/chunks/{lfN_4jdk.js → Crq2Gvaa.js} +1 -1
  121. package/web/app/immutable/chunks/{-j8RilKC.js → CsqCa0Sd.js} +2 -2
  122. package/web/app/immutable/chunks/{DDs4Vg0U.js → CuG6uIIP.js} +1 -1
  123. package/web/app/immutable/chunks/{C6MidKO1.js → Cvg7bd3W.js} +1 -1
  124. package/web/app/immutable/chunks/{waEdGUDl.js → CwnyA6hc.js} +1 -1
  125. package/web/app/immutable/chunks/{DsUUGZq_.js → Cx089QrC.js} +1 -1
  126. package/web/app/immutable/chunks/{BVT8FnwX.js → D-s4Q5GN.js} +1 -1
  127. package/web/app/immutable/chunks/{CqbBHiiS.js → D1IlJCd0.js} +1 -1
  128. package/web/app/immutable/chunks/{C2RKkR8r.js → D2gIe4Fc.js} +1 -1
  129. package/web/app/immutable/chunks/{BVLclYIV.js → D6IXX0lv.js} +1 -1
  130. package/web/app/immutable/chunks/{DR4IMcDF.js → D6Id8WlN.js} +1 -1
  131. package/web/app/immutable/chunks/{CMxICaSn.js → D9hi6Z3O.js} +1 -1
  132. package/web/app/immutable/chunks/D9iN-aHM.js +5 -0
  133. package/web/app/immutable/chunks/{WhG7Bgtb.js → DD1-zRxp.js} +1 -1
  134. package/web/app/immutable/chunks/{DW3NYbCg.js → DE5Smm9m.js} +1 -1
  135. package/web/app/immutable/chunks/{DfZpv0e6.js → DFoGBie-.js} +1 -1
  136. package/web/app/immutable/chunks/{YJmoM74E.js → DG__gHhd.js} +1 -1
  137. package/web/app/immutable/chunks/{CURgPz9A.js → DIlG6FTS.js} +1 -1
  138. package/web/app/immutable/chunks/{DvuFiJGX.js → DK1vbm9l.js} +1 -1
  139. package/web/app/immutable/chunks/{DayXN3MG.js → DKs2ftKN.js} +1 -1
  140. package/web/app/immutable/chunks/{BWAM175S.js → DLoJFSfZ.js} +1 -1
  141. package/web/app/immutable/chunks/{yr_icLi6.js → DMC7qMUv.js} +1 -1
  142. package/web/app/immutable/chunks/{CNsCQ6no.js → DMaQDnJk.js} +1 -1
  143. package/web/app/immutable/chunks/{Dy75eCEg.js → DMcsIxoO.js} +1 -1
  144. package/web/app/immutable/chunks/{BFq_nebX.js → DNmVxfYt.js} +8 -8
  145. package/web/app/immutable/chunks/{D6tg0AFH.js → DOGdTp2m.js} +1 -1
  146. package/web/app/immutable/chunks/{2DcZXs_F.js → DR58OcKC.js} +1 -1
  147. package/web/app/immutable/chunks/{DPaNvpDi.js → DR9205pL.js} +1 -1
  148. package/web/app/immutable/chunks/{CCOyeB8l.js → DTSOJB0e.js} +1 -1
  149. package/web/app/immutable/chunks/{CZL3_4T_.js → DXwDIYHN.js} +1 -1
  150. package/web/app/immutable/chunks/{l4QAkguk.js → DYd7w17e.js} +1 -1
  151. package/web/app/immutable/chunks/{3pZ2C7Oz.js → DYrK-s5W.js} +1 -1
  152. package/web/app/immutable/chunks/{BRFS4VDU.js → DYztlXyW.js} +1 -1
  153. package/web/app/immutable/chunks/{BcN0a7iZ.js → DZ5koqO7.js} +1 -1
  154. package/web/app/immutable/chunks/{iYBu_bIg.js → D_m0iYjs.js} +1 -1
  155. package/web/app/immutable/chunks/{BWaQmmKL.js → DadwIC0R.js} +1 -1
  156. package/web/app/immutable/chunks/{CyAayV8v.js → Dax20l9D.js} +2 -2
  157. package/web/app/immutable/chunks/{BeXyu8S7.js → DbKrZJmS.js} +6 -6
  158. package/web/app/immutable/chunks/{D7tJZDri.js → DbY-sUwj.js} +1 -1
  159. package/web/app/immutable/chunks/{D1mml-OO.js → DcE_Ld1a.js} +1 -1
  160. package/web/app/immutable/chunks/{CeO1YObE.js → DdKmPHVm.js} +1 -1
  161. package/web/app/immutable/chunks/{BL66wtH1.js → DffgEGrv.js} +1 -1
  162. package/web/app/immutable/chunks/{g8wzFaTr.js → DfiXlh8D.js} +1 -1
  163. package/web/app/immutable/chunks/{BmZ0oFC-.js → DgBCXQ71.js} +1 -1
  164. package/web/app/immutable/chunks/{BpS2Zkky.js → DiDcqoCZ.js} +1 -1
  165. package/web/app/immutable/chunks/{TKDyISXm.js → Dj5vfD48.js} +3 -3
  166. package/web/app/immutable/chunks/{B9UG1fIf.js → DjVfE_Ds.js} +1 -1
  167. package/web/app/immutable/chunks/{CbSjEe9c.js → Dkg7fAiD.js} +1 -1
  168. package/web/app/immutable/chunks/{BPC4bZ2e.js → DkibMP99.js} +1 -1
  169. package/web/app/immutable/chunks/{DnSvdDJQ.js → DkraFhXS.js} +1 -1
  170. package/web/app/immutable/chunks/{BXDqRhfc.js → DmtmsOtX.js} +1 -1
  171. package/web/app/immutable/chunks/{AFSjjw3j.js → Do_TqlrK.js} +1 -1
  172. package/web/app/immutable/chunks/{CUPUpXuX.js → Dovmtid-.js} +1 -1
  173. package/web/app/immutable/chunks/{dJdm8RiY.js → DpN6Ybfd.js} +1 -1
  174. package/web/app/immutable/chunks/{CGXAF4r8.js → DrWcQsKJ.js} +1 -1
  175. package/web/app/immutable/chunks/{B23FAgl4.js → DvCCocml.js} +1 -1
  176. package/web/app/immutable/chunks/{2N3bEpgZ.js → DwuPw74E.js} +1 -1
  177. package/web/app/immutable/chunks/{DUb-Rw9h.js → Dz6pz6rM.js} +1 -1
  178. package/web/app/immutable/chunks/{BiyBBgWJ.js → HcVsBsAl.js} +1 -1
  179. package/web/app/immutable/chunks/{BuBWlA2n.js → IISaQsK0.js} +1 -1
  180. package/web/app/immutable/chunks/IJYL54f1.js +1 -0
  181. package/web/app/immutable/chunks/{BoVqnGlE.js → Iu8s0xrk.js} +1 -1
  182. package/web/app/immutable/chunks/{DjJQPfKI.js → LzWIYiXc.js} +1 -1
  183. package/web/app/immutable/chunks/{DzxV-zrJ.js → M8sdbvOT.js} +1 -1
  184. package/web/app/immutable/chunks/{vTk7TgiT.js → McMSPwXq.js} +1 -1
  185. package/web/app/immutable/chunks/{_wdKNOb8.js → NPItrD9R.js} +1 -1
  186. package/web/app/immutable/chunks/{DDDplTKI.js → NlCjCVxn.js} +1 -1
  187. package/web/app/immutable/chunks/{DSoSzq2S.js → NzxBab7c.js} +1 -1
  188. package/web/app/immutable/chunks/{Cl4oF0_T.js → PeSBy6Q3.js} +1 -1
  189. package/web/app/immutable/chunks/{DBYwZc8q.js → PnTDvXOe.js} +1 -1
  190. package/web/app/immutable/chunks/{CYIyfTfT.js → SiYLjuDS.js} +1 -1
  191. package/web/app/immutable/chunks/{1-VabEZ0.js → Syl_OSjA.js} +1 -1
  192. package/web/app/immutable/chunks/{nn-FB5iu.js → TV2_MWXe.js} +1 -1
  193. package/web/app/immutable/chunks/{EZewBOPv.js → TWVlaXcj.js} +1 -1
  194. package/web/app/immutable/chunks/{cF3AJqS4.js → U_cmHtqi.js} +1 -1
  195. package/web/app/immutable/chunks/{D_0pJDZv.js → UakvtOgc.js} +1 -1
  196. package/web/app/immutable/chunks/{Dpront9T.js → UlQNHb3m.js} +1 -1
  197. package/web/app/immutable/chunks/{CkiTXhNV.js → Vwfej_EC.js} +3 -3
  198. package/web/app/immutable/chunks/{C7NJtCoD.js → WL4wAA6m.js} +2 -2
  199. package/web/app/immutable/chunks/{WC951FwE.js → XO84v1Z5.js} +1 -1
  200. package/web/app/immutable/chunks/{txAxF1ra.js → b33seoH7.js} +1 -1
  201. package/web/app/immutable/chunks/{BVnCu4HK.js → dvgX5pbn.js} +1 -1
  202. package/web/app/immutable/chunks/{BPhCmCpT.js → fX819Pv6.js} +1 -1
  203. package/web/app/immutable/chunks/{CJB0AMOQ.js → gMye6h60.js} +2 -2
  204. package/web/app/immutable/chunks/{KoGdyFdq.js → h6ZeyBNW.js} +1 -1
  205. package/web/app/immutable/chunks/{DOpzySCS.js → ljZI5d7y.js} +1 -1
  206. package/web/app/immutable/chunks/{CKXP5Dfl.js → mFLgyCOK.js} +1 -1
  207. package/web/app/immutable/chunks/{DHZp-IFS.js → mNkJFQiA.js} +1 -1
  208. package/web/app/immutable/chunks/{CuGpCjd7.js → oqxFFnht.js} +1 -1
  209. package/web/app/immutable/chunks/{4MuDb8sG.js → pDn0_bm8.js} +1 -1
  210. package/web/app/immutable/chunks/{DEMyUrKD.js → rgnRekX3.js} +1 -1
  211. package/web/app/immutable/chunks/{CwSA3Dwr.js → sgMaD9-D.js} +3 -3
  212. package/web/app/immutable/chunks/{CilxFmmt.js → tzy2FJ3p.js} +1 -1
  213. package/web/app/immutable/chunks/{BTiFAxnk.js → uR5KZKbl.js} +1 -1
  214. package/web/app/immutable/chunks/{igt8MaJ4.js → udwHGMln.js} +1 -1
  215. package/web/app/immutable/chunks/{DB9IAENr.js → ulG7NA7z.js} +1 -1
  216. package/web/app/immutable/chunks/{7L5DlLPB.js → vt-D6r-U.js} +1 -1
  217. package/web/app/immutable/chunks/{f3mINTV_.js → wD4fx_9g.js} +1 -1
  218. package/web/app/immutable/chunks/{Bkny4U08.js → x0rjHUHa.js} +1 -1
  219. package/web/app/immutable/chunks/{CqShCtgy.js → yCx04g4X.js} +1 -1
  220. package/web/app/immutable/chunks/{B2YeO1vq.js → yW4W7htU.js} +1 -1
  221. package/web/app/immutable/entry/{app.MRheiWYu.js → app.CIVLA2a9.js} +2 -2
  222. package/web/app/immutable/entry/start.Cn76ZGVI.js +1 -0
  223. package/web/app/immutable/nodes/{0.CtDeqO-b.js → 0.ACp4Nz4v.js} +1 -1
  224. package/web/app/immutable/nodes/{1.DkbI4cS2.js → 1.DRnQyS6A.js} +1 -1
  225. package/web/app/immutable/nodes/{10.m8CCWmGC.js → 10.CLkVRFBV.js} +1 -1
  226. package/web/app/immutable/nodes/{12.C6vEm_M7.js → 12.CEAVKYuu.js} +1 -1
  227. package/web/app/immutable/nodes/{13.DPA662Yd.js → 13.CJ1HRZcd.js} +1 -1
  228. package/web/app/immutable/nodes/{14.ByaMuLhR.js → 14.9_BXzcxR.js} +1 -1
  229. package/web/app/immutable/nodes/{15.Byubc7Em.js → 15.CZGq0vsg.js} +1 -1
  230. package/web/app/immutable/nodes/{16.BmFYAQ9C.js → 16.BMYUgPNR.js} +2 -2
  231. package/web/app/immutable/nodes/2.d5BGPrjO.js +9 -0
  232. package/web/app/immutable/nodes/{3.C3UUZ7iK.js → 3.0E-ZGvKe.js} +1 -1
  233. package/web/app/immutable/nodes/{4.CtX4qgJE.js → 4.DSO5-jdr.js} +1 -1
  234. package/web/app/immutable/nodes/{5.yLkRrv3R.js → 5.BexFD7jH.js} +1 -1
  235. package/web/app/immutable/nodes/6.CqlyGMy5.js +1 -0
  236. package/web/app/immutable/nodes/{7.DCFEio1e.js → 7.C2XKzJeK.js} +1 -1
  237. package/web/app/immutable/nodes/{8.CGM4vick.js → 8.CMFpn5kb.js} +4 -4
  238. package/web/app/immutable/nodes/{9.V5qvVUf3.js → 9.BolTThFG.js} +4 -4
  239. package/web/app/version.json +1 -1
  240. package/web/index.html +9 -9
  241. package/web/app/immutable/chunks/9A9__2dZ.js +0 -1
  242. package/web/app/immutable/chunks/BqQtQly_.js +0 -5
  243. package/web/app/immutable/chunks/D4Mfx79s.js +0 -227
  244. package/web/app/immutable/chunks/DGR4UUG4.js +0 -1
  245. package/web/app/immutable/chunks/W-gkWrYK.js +0 -1
  246. package/web/app/immutable/entry/start.CSXPreJt.js +0 -1
  247. package/web/app/immutable/nodes/2.B4Inck9s.js +0 -9
  248. package/web/app/immutable/nodes/6.CjUsIDeG.js +0 -1
@@ -1 +1 @@
1
- var Me=Object.defineProperty;var De=(i,s,e)=>s in i?Me(i,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[s]=e;var m=(i,s,e)=>De(i,typeof s!="symbol"?s+"":s,e);import{x as Ne,J as oe,Y as ce,ag as q,ao as Ce}from"./DczZ5XlV.js";import{bM as Le,cK as le,cb as ue,ca as ve}from"./CKXP5Dfl.js";import{Hb as p,A5 as we,bz as be,c as Fe,Je as de,i2 as me,bL as ke,B$ as z,Aw as Ge,f2 as Pe,yD as xe,d_ as Ee,e_ as fe,dZ as _e,z3 as Ve,IU as Ue,uP as Be}from"./WOicJa2k.js";import{aB as Ae,dA as he,A as H,P as ge,ax as K}from"./D24Lh2xV.js";import{ax as $e}from"./CyAayV8v.js";import{c as W}from"./ChTqQfQN.js";import{a as Xe}from"./BJzHxIyr.js";import{n as Q}from"./3cdteGtc.js";import"./B8o4lNgr.js";import{bo as n}from"./yZ5s7S5S.js";import"./D46WSk8U.js";import"./Cb1eroFO.js";import"./BIqUw3gi.js";import{R as Re}from"./Ck8ZjaJh.js";import{L as Ye}from"./D8dE5NKO.js";function We(i,s){return i.some(e=>e.id===s.id)?i.map(e=>e.id===s.id?{...s,...s.author==null&&e.author!==void 0?{author:e.author}:{}}:e):[...i,s]}const Z=typeof performance<"u"?performance:{now:()=>Date.now()},V=new Xe("PerformanceOptimizer"),w=class w{constructor(){m(this,"metricsBuffer");m(this,"metricsIndex",0);m(this,"metricsCount",0);m(this,"MAX_METRICS",500);m(this,"TARGET_RESPONSE_TIME",100);m(this,"memoCache",new Map);m(this,"MEMO_TTL",6e4);m(this,"MAX_CACHE_SIZE",100);m(this,"cacheHits",0);m(this,"cacheMisses",0);m(this,"pendingRequests",new Map);m(this,"requestQueue",[]);m(this,"cleanupInterval",null);this.metricsBuffer=new Array(this.MAX_METRICS).fill(null),this.startCacheCleanup(),V.info("PerformanceOptimizer initialized")}static getInstance(){return w.instance||(w.instance=new w),w.instance}reset(){this.metricsBuffer=new Array(this.MAX_METRICS).fill(null),this.metricsIndex=0,this.metricsCount=0,this.memoCache.clear(),this.pendingRequests.clear(),this.requestQueue=[],this.cacheHits=0,this.cacheMisses=0}clearCache(){this.memoCache.clear(),this.cacheHits=0,this.cacheMisses=0}async processBatch(s,e,t={}){const{batchSize:r=10,concurrency:a=4}=t,l=[];for(let c=0;c<s.length;c+=r){const f=s.slice(c,c+r).map((o,R)=>{const g=Math.floor(R/a)*10;return new Promise(d=>{setTimeout(async()=>{const k=await e(o);d(k)},g)})}),u=await Promise.all(f);l.push(...u)}return l}startCacheCleanup(){this.cleanupInterval=setInterval(()=>{this.cleanupCache()},3e4)}stopCacheCleanup(){this.cleanupInterval&&(clearInterval(this.cleanupInterval),this.cleanupInterval=null)}cleanupCache(){const s=Date.now(),e=[];this.memoCache.forEach((t,r)=>{s-t.timestamp>this.MEMO_TTL&&e.push(r)}),e.forEach(t=>this.memoCache.delete(t)),this.memoCache.size>this.MAX_CACHE_SIZE&&Array.from(this.memoCache.entries()).sort((a,l)=>a[1].hits-l[1].hits||a[1].timestamp-l[1].timestamp).slice(0,this.memoCache.size-this.MAX_CACHE_SIZE).forEach(([a])=>this.memoCache.delete(a))}async track(s,e,t={}){const r=Z.now();try{const a=t.cacheKey||s;if(t.memoize){const f=this.getMemoized(a);if(f!==void 0)return this.cacheHits++,V.debug("Memoized result used",{operation:s,cacheKey:a,hits:this.cacheHits}),f;this.cacheMisses++}if(t.coalesce){const f=this.pendingRequests.get(s);if(f)return V.debug("Request coalesced",{operation:s}),f}let l;t.coalesce?(l=t.timeout?this.withTimeout(e(),t.timeout):e(),this.pendingRequests.set(s,l)):l=t.timeout?this.withTimeout(e(),t.timeout):e();const c=await l;t.memoize&&this.memoize(a,c);const E=Z.now()-r;return this.recordMetric(s,E,!0,{strategy:t.priority||"normal",memoized:t.memoize||!1,coalesced:t.coalesce||!1}),E>this.TARGET_RESPONSE_TIME&&V.warn("Operation exceeded target time",{operation:s,duration:Math.round(E),target:this.TARGET_RESPONSE_TIME}),c}catch(a){const l=Z.now()-r;throw this.recordMetric(s,l,!1,{error:a instanceof Error?a.message:"Unknown error"}),a}finally{t.coalesce&&this.pendingRequests.delete(s)}}getStats(){if(this.metricsCount===0)return{avgResponseTime:0,p95ResponseTime:0,p99ResponseTime:0,successRate:100,slowOperations:[]};const s=[],e=this.metricsCount<this.MAX_METRICS?0:this.metricsIndex;for(let u=0;u<this.metricsCount;u++){const o=this.metricsBuffer[(e+u)%this.MAX_METRICS];o&&s.push(o)}if(s.length===0)return{avgResponseTime:0,p95ResponseTime:0,p99ResponseTime:0,successRate:100,slowOperations:[]};const t=s.sort((u,o)=>u.duration-o.duration);let r=0,a=0;const l=new Set;for(const u of s)a+=u.duration,u.success&&r++,u.duration>this.TARGET_RESPONSE_TIME&&l.add(u.operation);const c=a/s.length,E=Math.floor(t.length*.95),f=Math.floor(t.length*.99);return{avgResponseTime:Math.round(c),p95ResponseTime:Math.round(t[E]?.duration||0),p99ResponseTime:Math.round(t[f]?.duration||0),successRate:r/s.length*100,slowOperations:Array.from(l)}}getCacheStats(){const s=this.cacheHits+this.cacheMisses;return{size:this.memoCache.size,hitRate:s>0?this.cacheHits/s*100:0,hits:this.cacheHits,misses:this.cacheMisses}}getMemoized(s){const e=this.memoCache.get(s);if(e){if(Date.now()-e.timestamp>this.MEMO_TTL){this.memoCache.delete(s);return}return e.hits++,e.value}}memoize(s,e){const t=JSON.stringify(e).length;this.memoCache.set(s,{value:e,timestamp:Date.now(),hits:0,size:t}),this.memoCache.size>this.MAX_CACHE_SIZE&&this.cleanupCache()}async withTimeout(s,e){return Promise.race([s,new Promise((t,r)=>setTimeout(()=>r(new Error(`Operation timed out after ${e}ms`)),e))])}recordMetric(s,e,t,r){this.metricsBuffer[this.metricsIndex]={operation:s,duration:e,timestamp:Date.now(),success:t,metadata:r},this.metricsIndex=(this.metricsIndex+1)%this.MAX_METRICS,this.metricsCount<this.MAX_METRICS&&this.metricsCount++,e>this.TARGET_RESPONSE_TIME&&V.warn("Slow operation detected",{operation:s,duration:`${e.toFixed(2)}ms`,target:`${this.TARGET_RESPONSE_TIME}ms`,metadata:r})}};m(w,"instance");let ee=w;const qe=ee.getInstance(),pe={AGENT_CREATION:"https://docs.example.com/agent-creation",STREAMING:"https://docs.example.com/streaming-issues",STORAGE:"https://docs.example.com/storage-troubleshooting",MEMORY:"https://docs.example.com/memory-management",PROVIDER:"https://docs.example.com/provider-setup",GENERAL:"https://docs.example.com/help"},j={get AGENT_CREATION_FAILED(){return n.errors_catalog_agentCreationFailed_template({agentName:"{agentName}",details:"{details}"})},get AGENT_ALREADY_EXISTS(){return n.errors_catalog_agentAlreadyExists_template({agentName:"{agentName}"})},get INVALID_AGENT_CONFIG(){return n.errors_catalog_invalidAgentConfig_template({details:"{details}"})},get INVALID_CONFIG(){return n.errors_catalog_invalidConfig_template({details:"{details}"})},get SESSION_NOT_FOUND(){return n.errors_catalog_sessionNotFound_template({sessionId:"{sessionId}"})},get SESSION_ALREADY_ACTIVE(){return n.errors_catalog_sessionAlreadyActive_template()},get SESSION_INITIALIZATION_FAILED(){return n.errors_catalog_sessionInitializationFailed_template({details:"{details}"})},get STREAM_CONNECTION_FAILED(){return n.errors_catalog_streamConnectionFailed_template({details:"{details}"})},get STREAM_TIMEOUT(){return n.errors_catalog_streamTimeout_template({timeout:"{timeout}"})},get STREAM_INTERRUPTED(){return n.errors_catalog_streamInterrupted_template({attempt:"{attempt}",maxAttempts:"{maxAttempts}"})},get STREAM_RECOVERY_FAILED(){return n.errors_catalog_streamRecoveryFailed_template({attempts:"{attempts}"})},get MESSAGE_SEND_FAILED(){return n.errors_catalog_messageSendFailed_template({details:"{details}"})},get MESSAGE_VALIDATION_FAILED(){return n.errors_catalog_messageValidationFailed_template({details:"{details}"})},get MESSAGE_TOO_LONG(){return n.errors_catalog_messageTooLong_template({maxLength:"{maxLength}",currentLength:"{currentLength}"})},get PROVIDER_NOT_FOUND(){return n.errors_catalog_providerNotFound_template({provider:"{provider}"})},get PROVIDER_CONNECTION_FAILED(){return n.errors_catalog_providerConnectionFailed_template({provider:"{provider}",details:"{details}"})},get PROVIDER_PROCESS_DIED(){return n.errors_catalog_providerProcessDied_template({provider:"{provider}"})},get STORAGE_READ_FAILED(){return n.errors_catalog_storageReadFailed_template({details:"{details}"})},get STORAGE_WRITE_FAILED(){return n.errors_catalog_storageWriteFailed_template({details:"{details}"})},get STORAGE_CORRUPTED(){return n.errors_catalog_storageCorrupted_template({lastBackup:"{lastBackup}"})},get MEMORY_LIMIT_EXCEEDED(){return n.errors_catalog_memoryLimitExceeded_template({currentUsage:"{currentUsage}",limit:"{limit}"})},get RATE_LIMIT_EXCEEDED(){return n.errors_catalog_rateLimitExceeded_template({count:"{count}",window:"{window}"})},get CONCURRENT_LIMIT_EXCEEDED(){return n.errors_catalog_concurrentLimitExceeded_template({current:"{current}",max:"{max}"})}},ze={get AGENT_CREATION_FAILED(){return n.errors_catalog_agentCreationFailed_friendly()},get AGENT_ALREADY_EXISTS(){return n.errors_catalog_agentAlreadyExists_friendly()},get INVALID_AGENT_CONFIG(){return n.errors_catalog_invalidAgentConfig_friendly()},get INVALID_CONFIG(){return n.errors_catalog_invalidConfig_friendly()},get SESSION_NOT_FOUND(){return n.errors_catalog_sessionNotFound_friendly()},get SESSION_ALREADY_ACTIVE(){return n.errors_catalog_sessionAlreadyActive_friendly()},get SESSION_INITIALIZATION_FAILED(){return n.errors_catalog_sessionInitializationFailed_friendly()},get STREAM_CONNECTION_FAILED(){return n.errors_catalog_streamConnectionFailed_friendly()},get STREAM_TIMEOUT(){return n.errors_catalog_streamTimeout_friendly()},get STREAM_INTERRUPTED(){return n.errors_catalog_streamInterrupted_friendly()},get STREAM_RECOVERY_FAILED(){return n.errors_catalog_streamRecoveryFailed_friendly()},get MESSAGE_SEND_FAILED(){return n.errors_catalog_messageSendFailed_friendly()},get MESSAGE_VALIDATION_FAILED(){return n.errors_catalog_messageValidationFailed_friendly()},get MESSAGE_TOO_LONG(){return n.errors_catalog_messageTooLong_friendly()},get PROVIDER_NOT_FOUND(){return n.errors_catalog_providerNotFound_friendly()},get PROVIDER_CONNECTION_FAILED(){return n.errors_catalog_providerConnectionFailed_friendly()},get PROVIDER_PROCESS_DIED(){return n.errors_catalog_providerProcessDied_friendly()},get STORAGE_READ_FAILED(){return n.errors_catalog_storageReadFailed_friendly()},get STORAGE_WRITE_FAILED(){return n.errors_catalog_storageWriteFailed_friendly()},get STORAGE_CORRUPTED(){return n.errors_catalog_storageCorrupted_friendly()},get MEMORY_LIMIT_EXCEEDED(){return n.errors_catalog_memoryLimitExceeded_friendly()},get RATE_LIMIT_EXCEEDED(){return n.errors_catalog_rateLimitExceeded_friendly()},get CONCURRENT_LIMIT_EXCEEDED(){return n.errors_catalog_concurrentLimitExceeded_friendly()}};function He(i){return(i.match(/{(\w+)}/g)||[]).map(e=>e.slice(1,-1))}function Ke(i,s){return He(i).every(t=>t in s)}function Ie(i,s={}){return i.replace(/{(\w+)}/g,(e,t)=>String(s[t]??e))}function J(i){const s=n.errors_cleanMessage_fallback_error();if(!i)return s;let e=i;return e=e.replace(/^.*?failed(?:\s+to\s+.*?)?\s+after\s+\d+\s+attempts:\s*/i,""),e=e.replace(/^Error invoking remote method '[^']+':(\s*Error:)?\s*/i,""),e=e.replace(/^(Error:\s*)+/i,""),e=e.replace(/\n\s*at .+/g,""),e=e.replace(/\s+/g," ").trim(),e||s}function Qe(i,s){return s&&j[i]&&Ke(j[i],s)?Ie(j[i],s):ze[i]||n.errors_userFriendly_fallback_error()}function Ze(i){const e={AGENT_CREATION_FAILED:"AGENT_CREATION",AGENT_ALREADY_EXISTS:"AGENT_CREATION",INVALID_AGENT_CONFIG:"AGENT_CREATION",STREAM_CONNECTION_FAILED:"STREAMING",STREAM_TIMEOUT:"STREAMING",STREAM_INTERRUPTED:"STREAMING",STREAM_RECOVERY_FAILED:"STREAMING",STORAGE_READ_FAILED:"STORAGE",STORAGE_WRITE_FAILED:"STORAGE",STORAGE_CORRUPTED:"STORAGE",MEMORY_LIMIT_EXCEEDED:"MEMORY",RATE_LIMIT_EXCEEDED:"MEMORY",CONCURRENT_LIMIT_EXCEEDED:"MEMORY",PROVIDER_NOT_FOUND:"PROVIDER",PROVIDER_CONNECTION_FAILED:"PROVIDER",PROVIDER_PROCESS_DIED:"PROVIDER"}[i];return e?pe[e]:pe.GENERAL}const je={AGENT_CREATION_FAILED:[{action:"retry",description:"Try creating the agent again",automatic:!1,priority:"high"},{action:"check-config",description:"Verify agent configuration in settings",automatic:!1,priority:"high"},{action:"check-resources",description:"Ensure sufficient memory and disk space",automatic:!1,priority:"medium"}],AGENT_ALREADY_EXISTS:[{action:"rename",description:"Choose a different name for the agent",automatic:!1,priority:"high"},{action:"delete-existing",description:"Delete the existing agent first",automatic:!1,priority:"medium"}],INVALID_AGENT_CONFIG:[{action:"review-config",description:"Review and correct the configuration",automatic:!1,priority:"high"},{action:"use-defaults",description:"Reset to default configuration",automatic:!1,priority:"medium"}],INVALID_CONFIG:[{action:"review-config",description:"Review and correct the configuration",automatic:!1,priority:"high"},{action:"use-defaults",description:"Reset to default configuration",automatic:!1,priority:"medium"}],SESSION_NOT_FOUND:[{action:"start-new",description:"Start a new agent session",automatic:!1,priority:"high"},{action:"check-history",description:"Check session history for recent sessions",automatic:!1,priority:"medium"}],SESSION_ALREADY_ACTIVE:[{action:"wait",description:"Wait for the current session to complete",automatic:!1,priority:"high"},{action:"cancel",description:"Cancel the active session first",automatic:!1,priority:"high"}],SESSION_INITIALIZATION_FAILED:[{action:"retry",description:"Try initializing the session again",automatic:!1,priority:"high"},{action:"check-resources",description:"Ensure sufficient resources are available",automatic:!1,priority:"medium"}],MESSAGE_SEND_FAILED:[{action:"retry",description:"Try sending the message again",automatic:!1,priority:"high"},{action:"check-connection",description:"Check your network connection",automatic:!1,priority:"high"}],MESSAGE_VALIDATION_FAILED:[{action:"review-config",description:"Review and correct the message format",automatic:!1,priority:"high"},{action:"check-config",description:"Check configuration for valid message format",automatic:!1,priority:"medium"}],MESSAGE_TOO_LONG:[{action:"retry",description:"Shorten the message and try again",automatic:!1,priority:"high"},{action:"batch",description:"Split the message into multiple parts",automatic:!1,priority:"medium"}],PROVIDER_NOT_FOUND:[{action:"check-config",description:"Verify provider is properly configured",automatic:!1,priority:"high"},{action:"recreate",description:"Install or reinstall the provider",automatic:!1,priority:"high"}],PROVIDER_CONNECTION_FAILED:[{action:"retry",description:"Try connecting to the provider again",automatic:!1,priority:"high"},{action:"check-config",description:"Verify provider configuration",automatic:!1,priority:"high"}],STORAGE_READ_FAILED:[{action:"retry",description:"Try reading the data again",automatic:!1,priority:"high"},{action:"restore",description:"Restore from a recent backup",automatic:!1,priority:"medium"}],STORAGE_WRITE_FAILED:[{action:"retry",description:"Try saving again",automatic:!1,priority:"high"},{action:"check-resources",description:"Check available disk space",automatic:!1,priority:"high"}],STREAM_CONNECTION_FAILED:[{action:"retry",description:"Try connecting again",automatic:!1,priority:"high"},{action:"check-connection",description:"Check your network connection",automatic:!1,priority:"high"}],STREAM_RECOVERY_FAILED:[{action:"restart",description:"Restart the agent",automatic:!1,priority:"high"},{action:"check-config",description:"Check error logs for more details",automatic:!1,priority:"medium"}],STREAM_INTERRUPTED:[{action:"reconnect",description:"Attempting automatic reconnection",automatic:!0,priority:"high"},{action:"retry",description:"Retry sending the message",automatic:!1,priority:"high"},{action:"check-connection",description:"Check your internet connection",automatic:!1,priority:"medium"}],STREAM_TIMEOUT:[{action:"wait",description:"Wait for agent to complete processing",automatic:!1,priority:"high"},{action:"cancel",description:"Cancel current operation",automatic:!1,priority:"medium"},{action:"increase-timeout",description:"Increase timeout in settings",automatic:!1,priority:"low"}],PROVIDER_PROCESS_DIED:[{action:"restart",description:"Restart agent process",automatic:!0,priority:"high"},{action:"recreate",description:"Create new agent session",automatic:!1,priority:"high"}],STORAGE_CORRUPTED:[{action:"restore",description:"Restore from backup",automatic:!1,priority:"high"},{action:"reset",description:"Reset agent data",automatic:!1,priority:"medium"}],MEMORY_LIMIT_EXCEEDED:[{action:"cleanup",description:"Close unused agents",automatic:!1,priority:"high"},{action:"increase-limit",description:"Increase memory limit in settings",automatic:!1,priority:"medium"}],RATE_LIMIT_EXCEEDED:[{action:"wait",description:"Wait before making more requests",automatic:!1,priority:"high"},{action:"batch",description:"Batch requests together",automatic:!1,priority:"medium"}],CONCURRENT_LIMIT_EXCEEDED:[{action:"close-agents",description:"Close some running agents",automatic:!1,priority:"high"},{action:"queue",description:"Queue operation for later",automatic:!1,priority:"medium"}]};function Je(i){return je[i]||[{action:"retry",description:"Try the operation again",automatic:!1,priority:"high"}]}var D=(i=>(i.AGENT_CREATION_FAILED="AGENT_CREATION_FAILED",i.AGENT_ALREADY_EXISTS="AGENT_ALREADY_EXISTS",i.INVALID_AGENT_CONFIG="INVALID_AGENT_CONFIG",i.INVALID_CONFIG="INVALID_CONFIG",i.SESSION_NOT_FOUND="SESSION_NOT_FOUND",i.SESSION_ALREADY_ACTIVE="SESSION_ALREADY_ACTIVE",i.SESSION_INITIALIZATION_FAILED="SESSION_INITIALIZATION_FAILED",i.STREAM_CONNECTION_FAILED="STREAM_CONNECTION_FAILED",i.STREAM_TIMEOUT="STREAM_TIMEOUT",i.STREAM_INTERRUPTED="STREAM_INTERRUPTED",i.STREAM_RECOVERY_FAILED="STREAM_RECOVERY_FAILED",i.MESSAGE_SEND_FAILED="MESSAGE_SEND_FAILED",i.MESSAGE_VALIDATION_FAILED="MESSAGE_VALIDATION_FAILED",i.MESSAGE_TOO_LONG="MESSAGE_TOO_LONG",i.PROVIDER_NOT_FOUND="PROVIDER_NOT_FOUND",i.PROVIDER_CONNECTION_FAILED="PROVIDER_CONNECTION_FAILED",i.PROVIDER_PROCESS_DIED="PROVIDER_PROCESS_DIED",i.PROVIDER_UNAVAILABLE="PROVIDER_UNAVAILABLE",i.PROVIDER_ERROR="PROVIDER_ERROR",i.STORAGE_READ_FAILED="STORAGE_READ_FAILED",i.STORAGE_WRITE_FAILED="STORAGE_WRITE_FAILED",i.STORAGE_CORRUPTED="STORAGE_CORRUPTED",i.STORAGE_ERROR="STORAGE_ERROR",i.STORAGE_QUOTA_EXCEEDED="STORAGE_QUOTA_EXCEEDED",i.MEMORY_LIMIT_EXCEEDED="MEMORY_LIMIT_EXCEEDED",i.RATE_LIMIT_EXCEEDED="RATE_LIMIT_EXCEEDED",i.CONCURRENT_LIMIT_EXCEEDED="CONCURRENT_LIMIT_EXCEEDED",i.RESOURCE_NOT_FOUND="RESOURCE_NOT_FOUND",i.RESOURCE_EXHAUSTED="RESOURCE_EXHAUSTED",i.NETWORK_ERROR="NETWORK_ERROR",i.PERMISSION_DENIED="PERMISSION_DENIED",i.OPERATION_FAILED="OPERATION_FAILED",i.VALIDATION_ERROR="VALIDATION_ERROR",i.INVALID_RESPONSE="INVALID_RESPONSE",i.STATE_CORRUPTION="STATE_CORRUPTION",i.CONTEXT_OVERFLOW="CONTEXT_OVERFLOW",i))(D||{});class Y extends Error{constructor(e,t,r={},a){super(e);m(this,"code");m(this,"context");m(this,"recoverySuggestions");m(this,"userMessage");m(this,"isRecoverable");m(this,"cause");this.name="AgentError",this.code=t,this.context={...r,timestamp:new Date,stackTrace:this.stack},this.userMessage=a?.userMessage||this.getDefaultUserMessage(t),this.recoverySuggestions=a?.recoverySuggestions||this.getDefaultRecoverySuggestions(t),this.isRecoverable=a?.isRecoverable??this.isErrorRecoverable(t),a?.cause&&(this.cause=a.cause)}getDefaultUserMessage(e){return Qe(e,this.context)}getDefaultRecoverySuggestions(e){return Je(e)}isErrorRecoverable(e){return["STREAM_INTERRUPTED","STREAM_TIMEOUT","MESSAGE_SEND_FAILED","PROVIDER_PROCESS_DIED","STORAGE_READ_FAILED","STORAGE_WRITE_FAILED"].includes(e)}getHelpLink(){return Ze(this.code)}formatMessage(e){return Ie(e,this.context)}toJSON(){return{name:this.name,code:this.code,message:this.message,userMessage:this.userMessage,context:this.context,recoverySuggestions:this.recoverySuggestions,isRecoverable:this.isRecoverable,helpLink:this.getHelpLink(),stack:this.stack}}}const et={NON_RETRYABLE_ERRORS:["EACCES","EPERM","ENOSPC","EMFILE","permission","memory","fatal","process died","not available on your current plan","agent binary","rate limit","too many requests","hit your limit","you've hit your limit","quota exceeded"]};function ie(i){const s=i.toLowerCase();for(const e of et.NON_RETRYABLE_ERRORS)if(s.includes(e.toLowerCase()))return!0;return!1}const tt="Agent already has an in-flight prompt. Message was not delivered.",v=W("ErrorBoundary"),b=class b{constructor(){}static getInstance(){return b.instance||(b.instance=new b),b.instance}async wrap(s,e,t={}){const{retries:r=Re.DEFAULT_ATTEMPTS,retryDelay:a=Re.BASE_DELAY,exponentialBackoff:l=!0,notify:c=!1,notifyOnRetry:E=!1,context:f={},onError:u,onRetry:o,shouldRetry:R=this.defaultShouldRetry}=t;let g=null,d=0;for(d=1;d<=r+1;d++)try{v.debug(`[${e}] Attempt ${d}/${r+1}`);const h=await s();return d>1&&v.info(`[${e}] Succeeded after ${d} attempts`),h}catch(h){if(g=h,v.error(`[${e}] Attempt ${d} failed`,{error:g.message,attempt:d,maxAttempts:r+1,context:f}),u?.(g,d),d<=r&&R(g)){const C=l?a*Math.pow(2,d-1):a;E&&Q.warning(n.agent_errorBoundary_retrying_message({seconds:C/1e3})),o?.(d),v.info(`[${e}] Retrying in ${C}ms`),await this.sleep(C)}else break}const k=`${e} failed after ${d} attempt${d===1?"":"s"}: ${g?.message}`,P=J(g?.message||n.agent_errorBoundary_generic_error()),N=g?.message?.toLowerCase()||"",$=N.includes("no available models")||N.includes("all models exhausted")||N.includes("all models unavailable");throw c&&!$&&Q.error(P),new Y(P,D.OPERATION_FAILED,{originalError:g?.message,detailedMessage:k,attempts:d,context:f})}async wrapVoid(s,e,t={}){await this.wrap(s,e,t)}wrapSync(s,e,t={}){try{return s()}catch(r){const a=r;throw v.error(`[${e}] Failed`,{error:a.message,context:t.context}),t.notify&&Q.error(J(a.message)),new Y(J(a.message),D.OPERATION_FAILED,t.context)}}defaultShouldRetry(s){const e=s.message.toLowerCase();return ie(s.message)?!1:e.includes("network")||e.includes("timeout")?!0:s instanceof Y?[D.NETWORK_ERROR,D.STREAM_TIMEOUT,D.STREAM_CONNECTION_FAILED,D.PROVIDER_CONNECTION_FAILED,D.PROVIDER_UNAVAILABLE].includes(s.code):!(e.includes("invalid")||e.includes("interrupted")||e.includes("cancel")||e.includes("not found")||e.includes("not available")||e.includes("404")||e.includes("no available models")||e.includes("all models exhausted")||e.includes("all models unavailable")||e.includes("413")||e.includes("too long for the agent")||e.includes("request entity too large")||e.includes("payload too large")||e.includes("content too large")||e.includes("body too large")||e.includes("unauthorized")||e.includes("forbidden")||e.includes("401")||e.includes("403"))}sleep(s){return new Promise(e=>setTimeout(e,s))}async withTimeout(s,e,t){return Promise.race([s(),new Promise((r,a)=>setTimeout(()=>a(new Y(`${t} timed out after ${e}ms`,D.STREAM_TIMEOUT)),e))])}async batchOperations(s,e,t={}){const{concurrency:r=5,continueOnError:a=!0,operationName:l="batch operation"}=t,c=[],E=[];for(let f=0;f<s.length;f+=r){const u=s.slice(f,f+r);(await Promise.allSettled(u.map(R=>e(R)))).forEach((R,g)=>{if(R.status==="fulfilled")c.push(R.value);else{const d=R.reason;if(E.push({item:u[g],error:d}),v.error(`[${l}] Batch item failed`,{item:u[g],error:d.message}),!a)throw d}})}return E.length>0&&v.warn(`[${l}] Completed with ${E.length} errors`),{results:c,errors:E}}};m(b,"instance");let te=b;const st=te.getInstance(),se=W("browser/index"),F=new Map,B=new Map;let U;function it(i,s,e){for(const t of s)try{t(e)}catch(r){se.error("Error in agent subscriber callback",{agentId:i,error:r})}}function rt(){if(U)return;let i=!1;U=p.createSelector(e=>e.agentSessions)().subscribe(()=>{if(!i){i=!0;return}if(F.size===0)return;const e=p.state;for(const[t,r]of F){const a=Ae.select(e,t);B.get(t)!==a&&(B.set(t,a),it(t,r,a))}})}function at(){F.size>0||!U||(U(),U=void 0,B.clear())}function Ct(i,s,e){let t=F.get(i);const r=!t;t||(t=new Set,F.set(i,t)),t.add(s),rt();const a=p.state,l=Ae.select(a,i);return r&&B.set(i,l),l?se.debug("[subscribeToAgent] Initial callback data",{agentId:i,workspaceId:e??"current",hasSession:!0}):se.debug("[subscribeToAgent] No session found",{agentId:i,workspaceId:e??"current"}),s(l),()=>{const c=F.get(i);c&&(c.delete(s),c.size===0&&(F.delete(i),B.delete(i))),at()}}const y=W("ErrorRecovery"),Se={network:{maxRetries:3,initialBackoffMs:1e3,maxBackoffMs:1e4,backoffMultiplier:2,shouldRetry:i=>{const s=i.message.toLowerCase();return s.includes("network")||s.includes("fetch")||s.includes("connection")||s.includes("timeout")}},streaming:{maxRetries:5,initialBackoffMs:500,maxBackoffMs:5e3,backoffMultiplier:1.5,shouldRetry:(i,s)=>{if(s>=5)return!1;const e=i.message.toLowerCase();return e.includes("no available models")||e.includes("all models exhausted")||e.includes("all models unavailable")||ie(i.message)?!1:e.includes("stream")||e.includes("chunk")||e.includes("incomplete")}},persistence:{maxRetries:2,initialBackoffMs:100,maxBackoffMs:1e3,backoffMultiplier:2,shouldRetry:i=>{const s=i.message.toLowerCase();return s.includes("save")||s.includes("write")||s.includes("persist")}},rateLimit:{maxRetries:3,initialBackoffMs:5e3,maxBackoffMs:3e4,backoffMultiplier:2,shouldRetry:i=>{const s=i.message.toLowerCase();return s.includes("rate")||s.includes("limit")||s.includes("429")}}};class nt{constructor(){m(this,"listeners",new Map)}on(s,e){let t=this.listeners.get(s);t||(t=new Set,this.listeners.set(s,t)),t.add(e)}off(s,e){this.listeners.get(s)?.delete(e)}emit(s,...e){this.listeners.get(s)?.forEach(t=>{try{t(...e)}catch(r){y.error(`Error in event listener for ${s}:`,r)}})}removeAllListeners(){this.listeners.clear()}}class ot extends nt{constructor(){super(...arguments);m(this,"activeRecoveries",new Map);m(this,"recoveryStats",new Map)}async executeWithRecovery(e,t=Se.network,r){const a=Date.now(),l=new AbortController;r&&(this.cancelRecovery(r),this.activeRecoveries.set(r,l));let c,E=t.initialBackoffMs,f=0;for(let u=1;u<=t.maxRetries;u++){if(f=u,l.signal.aborted){y.info(`Recovery cancelled for operation ${r}`);break}try{y.debug(`Attempting operation (attempt ${u}/${t.maxRetries})`,{operationId:r});const o=await e();return this.updateStats(r,!0),this.emit("recovery:success",{operationId:r,attempt:u,duration:Date.now()-a}),r&&this.activeRecoveries.delete(r),{success:!0,data:o,attempts:u,totalTime:Date.now()-a}}catch(o){c=o,y.warn(`Operation failed (attempt ${u}/${t.maxRetries})`,{operationId:r,error:c.message});const R=c.message.toLowerCase();if(R.includes("interrupted")||R.includes("cancelled")||R.includes("canceled")){y.debug("User-initiated interruption/cancellation, not retrying",{operationId:r,error:c.message});break}if(R.includes("no available models")||R.includes("all models exhausted")||R.includes("all models unavailable")){y.debug("All models exhausted, not retrying",{operationId:r,error:c.message});break}if(ie(c.message)){y.debug("Fatal error detected, not retrying",{operationId:r,error:c.message});break}if(!t.shouldRetry(c,u)){y.debug("Error not retryable, stopping recovery",{operationId:r,error:c.message});break}if(u<t.maxRetries){const g=Math.random()*.2*E,d=Math.min(E+g,t.maxBackoffMs);t.onRetry?.(u,d),this.emit("recovery:retry",{operationId:r,attempt:u,delay:d,error:c.message}),await this.delay(d,l.signal),E=Math.min(E*t.backoffMultiplier,t.maxBackoffMs)}}}return this.updateStats(r,!1),t.onFailure?.(c,f),this.emit("recovery:failure",{operationId:r,attempts:f,duration:Date.now()-a,error:c?.message}),r&&this.activeRecoveries.delete(r),{success:!1,error:c,attempts:f,totalTime:Date.now()-a}}cancelRecovery(e){const t=this.activeRecoveries.get(e);t&&(t.abort(),this.activeRecoveries.delete(e),y.info(`Cancelled recovery for operation ${e}`))}cancelAllRecoveries(){for(const[e,t]of this.activeRecoveries)t.abort(),y.info(`Cancelled recovery for operation ${e}`);this.activeRecoveries.clear()}getStats(e){if(e)return this.recoveryStats.get(e)||{successes:0,failures:0};const t={};for(const[r,a]of this.recoveryStats)t[r]=a;return t}clearStats(e){e?this.recoveryStats.delete(e):this.recoveryStats.clear()}isRetryable(e,t){const r=e.message.toLowerCase();if(t)switch(t){case"NETWORK":return r.includes("network")||r.includes("fetch");case"TIMEOUT":return r.includes("timeout")||r.includes("timed out");case"RATE_LIMIT":return r.includes("rate")||r.includes("limit")||r.includes("429");case"TEMPORARY":return r.includes("temporary")||r.includes("transient");case"CONFLICT":return r.includes("conflict")||r.includes("concurrent");default:return!1}return this.isRetryable(e,"NETWORK")||this.isRetryable(e,"TIMEOUT")||this.isRetryable(e,"RATE_LIMIT")||this.isRetryable(e,"TEMPORARY")||this.isRetryable(e,"CONFLICT")}delay(e,t){return new Promise((r,a)=>{const l=setTimeout(r,e);if(t){const c=()=>{clearTimeout(l),a(new Error("Delay aborted"))};t.addEventListener("abort",c);const E=r;r=()=>{t.removeEventListener("abort",c),E()}}})}updateStats(e,t){if(!e)return;const r=this.recoveryStats.get(e)||{successes:0,failures:0};t?r.successes++:r.failures++,this.recoveryStats.set(e,r)}dispose(){this.cancelAllRecoveries(),this.recoveryStats.clear(),this.removeAllListeners()}}const ct=new ot,O=new Ye({category:"WorkspaceMetrics"}),lt=100;class ut{constructor(){m(this,"metrics",new Map);m(this,"operations",new Map)}startWorkspaceCreation(s){const e=Date.now();for(this.metrics.delete(s),this.metrics.set(s,{workspaceId:s,creationStarted:e});this.metrics.size>lt;){const t=this.metrics.keys().next().value;if(t===void 0)break;this.metrics.delete(t)}O.info("Started tracking workspace creation",{workspaceId:s})}recordMilestone(s,e){const t=this.metrics.get(s);if(!t){O.warn("No metrics found for workspace",{workspaceId:s,milestone:e});return}const r=Date.now();switch(e){case"optimisticNavigation":t.optimisticNavigation=r;break;case"realWorkspaceCreated":t.realWorkspaceCreated=r;break;case"agentCreated":t.agentCreated=r;break;case"agentReady":t.agentReady=r;break;case"firstMessageSent":t.firstMessageSent=r;break;case"firstResponseReceived":t.firstResponseReceived=r;break;case"firstChunkReceived":t.firstChunkReceived=r;break;case"totalDuration":t.totalDuration=r;break;case"workspaceId":case"creationStarted":O.warn("Cannot update milestone",{milestone:e});return}const a=r-t.creationStarted;O.info(`Milestone: ${e}`,{workspaceId:s,elapsed:`${a}ms`,timestamp:r}),e==="firstResponseReceived"&&(t.totalDuration=r-t.creationStarted,this.logSummary(s))}startOperation(s,e){this.operations.set(s,{startTime:Date.now(),metadata:e})}endOperation(s,e){const t=this.operations.get(s);if(!t)return O.warn("Operation not found",{operationId:s}),null;const r=Date.now();return t.endTime=r,t.duration=r-t.startTime,e&&(t.metadata={...t.metadata,...e}),O.info("Operation completed",{operationId:s,duration:`${t.duration}ms`,metadata:t.metadata}),this.operations.delete(s),t.duration}getMetrics(s){return this.metrics.get(s)}logSummary(s){const e=this.metrics.get(s);if(!e)return;const t={workspaceId:s,totalDuration:`${e.totalDuration}ms`,stages:{optimisticNavigation:e.optimisticNavigation?`${e.optimisticNavigation-e.creationStarted}ms`:"N/A",realWorkspaceCreation:e.realWorkspaceCreated?`${e.realWorkspaceCreated-e.creationStarted}ms`:"N/A",agentCreation:e.agentCreated?`${e.agentCreated-e.creationStarted}ms`:"N/A",agentReady:e.agentReady?`${e.agentReady-e.creationStarted}ms`:"N/A",firstMessage:e.firstMessageSent?`${e.firstMessageSent-e.creationStarted}ms`:"N/A",firstResponse:e.firstResponseReceived?`${e.firstResponseReceived-e.creationStarted}ms`:"N/A"}};O.info("=== Workspace Creation Metrics Summary ===",t),O.info("Workspace Creation Metrics:",t)}clearMetrics(s){this.metrics.delete(s)}incrementAgentCreated(s){const e=this.metrics.get(s);e&&(e.agentCreated=Date.now(),O.info("Agent created",{workspaceId:s}))}incrementMessageSent(s){const e=this.metrics.get(s);e&&!e.firstMessageSent&&(e.firstMessageSent=Date.now(),O.info("First message sent",{workspaceId:s}))}}const dt=new ut,M=W("AgentSend");function A(i){p.dispatch(i)}function Te(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function mt(i){const s=Te(i)&&i.success===!0&&"data"in i?i.data:i;return!Te(s)||s.success!==!1?!1:typeof s.error=="string"&&s.error.includes(tt)}async function Lt(i,s,e,t={}){const r=he.select(p.state,e.id);if(!r)return;const a=Ne(i,e.id),l=t.submission,c=!!l&&Le.select(p.state,l.scope)?.supported===!0,E=(o,R,g=!1)=>{l&&A(Be(l.scope,l.id,o,Date.now(),R,g))};let f=!1;const u=()=>(!l||f||ve.select(p.state,l))&&r===he.select(p.state,e.id)&&a.isCurrent(p.state.agentSessions?.byAgentId[i]?.workspaceId);return qe.track(`sendMessage:${a.key}:${i}:${l?.id??"legacy"}`,async()=>{if(!u())return;M.debug(`Sending message to agent ${i}`,{contentLength:s.length,hasContextReferences:!!t.contextReferences?.length,model:t.model});let o=await p.dispatch(we(e.id,i));if(u()){if(!o)throw new Error(n.agent_streamLifecycle_sessionNotFound_error({agentId:i}));o={...o,isStreaming:o.isStreaming??!1};{if(o&&(o.status==="pending"||!o.id)&&!o.backendSessionId&&o.activationState!==H.ACTIVE&&o.activationState!==H.ACTIVATING){const h=e.id.startsWith("optimistic-"),C=e.worktreePath||e.repositoryPath||e.path;if(!h&&C){M.info("Activating pending session in sendMessage",{agentId:i,status:o.status,activationState:o.activationState,hasBackendSessionId:!!o.backendSessionId});const x=await p.dispatch(be(e.id,i));if(!u())return;x&&(o=x)}else throw M.warn("Cannot activate agent - workspace not ready",{agentId:i,workspaceId:e.id,isOptimistic:h,hasWorktreePath:!!e.worktreePath,hasRepositoryPath:!!e.repositoryPath,hasPath:!!e.path}),new Error(n.agent_streamLifecycle_spaceNotReady_error())}else o&&o.status==="pending"&&o.backendSessionId&&(M.info("Fixing status for already-activated session",{agentId:i,backendSessionId:o.backendSessionId,activationState:o.activationState}),o={...o,status:Fe.Active,activationState:H.ACTIVE},A(de({...o,workspaceId:e.id})));if(!o)throw new Error(`Failed to get or create session for agent ${i}`);A(de({...o,workspaceId:e.id}));const g=[{type:"text",text:s}];if(t.imageBlocks)for(const h of t.imageBlocks)g.push({type:"image",...h.data!==void 0?{data:h.data}:{},...h.mimeType!==void 0?{mimeType:h.mimeType}:{},...h.attachmentId!==void 0?{attachmentId:h.attachmentId}:{}});if(t.fileBlocks)for(const h of t.fileBlocks)g.push({type:"file",attachmentId:h.attachmentId,fileName:h.fileName,...h.mimeType!==void 0?{mimeType:h.mimeType}:{},...h.size!==void 0?{size:h.size}:{}});const d=t.userAppMessageId??oe(),k=t.messageMetadata?.[ge],P={...t.contextReferences?.length?{contextReferences:t.contextReferences}:{},...k!==void 0?{[ge]:k}:{}},N={id:me(le()),appMessageId:d,role:"user",contentBlocks:g,timestamp:new Date().toISOString(),metadata:{...P,...t.messageMetadata??{}}};c||(l&&(E("rejected"),f=!0),A(ke(o.id,N))),A(z(o.id,!0));let $=!1;try{c||await p.dispatch(Ge(e.id,i,!0,{allowTruncation:t.resetHistory}));const h=me(`msg_${le()}`),C=oe(),x=async()=>st.wrap(async()=>{if(!u())return;M.info("Agent Service: Sending message to backend with image and file blocks",{agentId:i,sessionId:o.id,hasImageBlocks:!!t.imageBlocks,imageBlocksCount:t.imageBlocks?.length||0,imageBlockDetails:t.imageBlocks?.map(_=>({type:_.type,mimeType:_.mimeType,dataLength:_.data?.length||0}))||[],hasFileBlocks:!!t.fileBlocks,fileBlocksCount:t.fileBlocks?.length||0,fileBlockDetails:t.fileBlocks?.map(_=>({type:_.type,fileName:_.fileName,mimeType:_.mimeType,attachmentId:_.attachmentId,size:_.size}))||[]});const Oe=t.model??t.modelId??o.model??void 0;A(Pe(i));const ye=ce(i,e.id),ae=p.state.chatState?.byAgentId[i]?.attemptGeneration??0,T=await $e("agent.sendMessage",{agentId:i,...c&&l?{messageId:l.id}:{},workspaceId:e.id,content:s,model:Oe,contextReferences:t.contextReferences,imageBlocks:t.imageBlocks,fileBlocks:t.fileBlocks,noteIds:t.noteIds,stdinContext:t.stdinContext,assistantMessageId:h,userAppMessageId:d,assistantAppMessageId:C,priority:t.priority,...t.messageMetadata?{messageMetadata:t.messageMetadata}:{}}).catch(_=>{if(u())throw _});if(u()){if(mt(T)){M.info("Backend dropped duplicate in-flight prompt",{agentId:i,sessionId:o.id}),E("rejected");return}if(T&&typeof T=="object"&&"success"in T){if(!T.success){const _=T.error,I=typeof _=="string"?_:_?.message;throw $=!0,new Error(I||n.agent_streamLifecycle_sendToBackendFailed_error())}if("queued"in T&&T.queued===!0){if(M.info("sendMessage auto-queued by daemon (mid-turn or turn-startup race)",{agentId:i,sessionId:o.id,queuedMessageId:T.queuedMessage?.id}),(!c||!l||!ue.select(p.state,l))&&A(z(o.id,!1)),c||A(xe(o.id,N.id)),c){const I=T.queuedMessage,G=T.turnId,L=typeof G=="string"?G:I?.turnId;if(I&&typeof L=="string"){const S=Ee(s,t),X=K.select(p.state,i,e.id).find(ne=>ne.id===I.id||ne.turnId===L);A(fe(i,I.id,S,L,_e(X??I,S),!X&&!!l&&ue.select(p.state,l),ae))}E("accepted",I,!0),q(i,e.id);return}const _=T.queuedMessage;if(_){const I=T.turnId,G=typeof I=="string"?I:_.turnId;let L=_;if(u()&&ce(i,e.id)===ye){const S=K.select(p.state,i,e.id),X=We(S,_);A(Ve(i,X,e.id))}else u()&&(M.debug("queued-response queue seed superseded by an authoritative snapshot; reconciling via hydrate",{agentId:i,queuedMessageId:_.id}),await q(i,e.id).catch(()=>{}),L=K.select(p.state,i,e.id).find(S=>S.id===_.id||S.turnId===G));if(u()&&typeof G=="string"){const S=Ee(s,t);A(fe(i,_.id,S,G,_e(L??_,S),!L,ae))}else u()&&M.warn("auto-queued sendMessage response carried no turnId; retry record not parked",{agentId:i,queuedMessageId:_.id})}return}}c&&(E("accepted"),q(i,e.id),Ce(i,e.id)),dt.incrementMessageSent(e.id)}},"send message",{retries:c?0:2,notify:!1,context:{agentId:i,workspace:e.id}}),re=c?await x().then(()=>({success:!0,error:void 0})):await ct.executeWithRecovery(x,Se.streaming,`send-message-${i}`);if(!re.success)throw re.error||new Error(n.agent_streamLifecycle_sendFailed_error())}catch(h){if(!u())return;throw A(z(o.id,!1)),!c&&t.messageMetadata&&A(Ue(o.id,N.id,{metadata:P})),c&&E($?"rejected":"uncertain"),h}}}},{memoize:!1,coalesce:!0,priority:"high"})}export{Ct as a,J as c,We as r,Lt as s};
1
+ var Me=Object.defineProperty;var De=(i,s,e)=>s in i?Me(i,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[s]=e;var m=(i,s,e)=>De(i,typeof s!="symbol"?s+"":s,e);import{x as Ne,J as oe,Y as ce,ag as q,ao as Ce}from"./CEs-7mch.js";import{bM as Le,cK as le,cb as ue,ca as ve}from"./mFLgyCOK.js";import{Hb as p,A5 as we,bz as be,c as Fe,Je as de,i2 as me,bL as ke,B$ as z,Aw as Ge,f2 as Pe,yD as xe,d_ as Ee,e_ as fe,dZ as _e,z3 as Ve,IU as Ue,uP as Be}from"./WOicJa2k.js";import{aB as Ae,dA as he,A as H,P as ge,ax as K}from"./-1vWYJiy.js";import{ax as $e}from"./Dax20l9D.js";import{c as W}from"./ChTqQfQN.js";import{a as Xe}from"./BJzHxIyr.js";import{n as Q}from"./BeRTGLrw.js";import"./B8o4lNgr.js";import{bo as n}from"./yZ5s7S5S.js";import"./D46WSk8U.js";import"./Cb1eroFO.js";import"./BIqUw3gi.js";import{R as Re}from"./Ck8ZjaJh.js";import{L as Ye}from"./D8dE5NKO.js";function We(i,s){return i.some(e=>e.id===s.id)?i.map(e=>e.id===s.id?{...s,...s.author==null&&e.author!==void 0?{author:e.author}:{}}:e):[...i,s]}const Z=typeof performance<"u"?performance:{now:()=>Date.now()},V=new Xe("PerformanceOptimizer"),w=class w{constructor(){m(this,"metricsBuffer");m(this,"metricsIndex",0);m(this,"metricsCount",0);m(this,"MAX_METRICS",500);m(this,"TARGET_RESPONSE_TIME",100);m(this,"memoCache",new Map);m(this,"MEMO_TTL",6e4);m(this,"MAX_CACHE_SIZE",100);m(this,"cacheHits",0);m(this,"cacheMisses",0);m(this,"pendingRequests",new Map);m(this,"requestQueue",[]);m(this,"cleanupInterval",null);this.metricsBuffer=new Array(this.MAX_METRICS).fill(null),this.startCacheCleanup(),V.info("PerformanceOptimizer initialized")}static getInstance(){return w.instance||(w.instance=new w),w.instance}reset(){this.metricsBuffer=new Array(this.MAX_METRICS).fill(null),this.metricsIndex=0,this.metricsCount=0,this.memoCache.clear(),this.pendingRequests.clear(),this.requestQueue=[],this.cacheHits=0,this.cacheMisses=0}clearCache(){this.memoCache.clear(),this.cacheHits=0,this.cacheMisses=0}async processBatch(s,e,t={}){const{batchSize:r=10,concurrency:a=4}=t,l=[];for(let c=0;c<s.length;c+=r){const f=s.slice(c,c+r).map((o,R)=>{const g=Math.floor(R/a)*10;return new Promise(d=>{setTimeout(async()=>{const k=await e(o);d(k)},g)})}),u=await Promise.all(f);l.push(...u)}return l}startCacheCleanup(){this.cleanupInterval=setInterval(()=>{this.cleanupCache()},3e4)}stopCacheCleanup(){this.cleanupInterval&&(clearInterval(this.cleanupInterval),this.cleanupInterval=null)}cleanupCache(){const s=Date.now(),e=[];this.memoCache.forEach((t,r)=>{s-t.timestamp>this.MEMO_TTL&&e.push(r)}),e.forEach(t=>this.memoCache.delete(t)),this.memoCache.size>this.MAX_CACHE_SIZE&&Array.from(this.memoCache.entries()).sort((a,l)=>a[1].hits-l[1].hits||a[1].timestamp-l[1].timestamp).slice(0,this.memoCache.size-this.MAX_CACHE_SIZE).forEach(([a])=>this.memoCache.delete(a))}async track(s,e,t={}){const r=Z.now();try{const a=t.cacheKey||s;if(t.memoize){const f=this.getMemoized(a);if(f!==void 0)return this.cacheHits++,V.debug("Memoized result used",{operation:s,cacheKey:a,hits:this.cacheHits}),f;this.cacheMisses++}if(t.coalesce){const f=this.pendingRequests.get(s);if(f)return V.debug("Request coalesced",{operation:s}),f}let l;t.coalesce?(l=t.timeout?this.withTimeout(e(),t.timeout):e(),this.pendingRequests.set(s,l)):l=t.timeout?this.withTimeout(e(),t.timeout):e();const c=await l;t.memoize&&this.memoize(a,c);const E=Z.now()-r;return this.recordMetric(s,E,!0,{strategy:t.priority||"normal",memoized:t.memoize||!1,coalesced:t.coalesce||!1}),E>this.TARGET_RESPONSE_TIME&&V.warn("Operation exceeded target time",{operation:s,duration:Math.round(E),target:this.TARGET_RESPONSE_TIME}),c}catch(a){const l=Z.now()-r;throw this.recordMetric(s,l,!1,{error:a instanceof Error?a.message:"Unknown error"}),a}finally{t.coalesce&&this.pendingRequests.delete(s)}}getStats(){if(this.metricsCount===0)return{avgResponseTime:0,p95ResponseTime:0,p99ResponseTime:0,successRate:100,slowOperations:[]};const s=[],e=this.metricsCount<this.MAX_METRICS?0:this.metricsIndex;for(let u=0;u<this.metricsCount;u++){const o=this.metricsBuffer[(e+u)%this.MAX_METRICS];o&&s.push(o)}if(s.length===0)return{avgResponseTime:0,p95ResponseTime:0,p99ResponseTime:0,successRate:100,slowOperations:[]};const t=s.sort((u,o)=>u.duration-o.duration);let r=0,a=0;const l=new Set;for(const u of s)a+=u.duration,u.success&&r++,u.duration>this.TARGET_RESPONSE_TIME&&l.add(u.operation);const c=a/s.length,E=Math.floor(t.length*.95),f=Math.floor(t.length*.99);return{avgResponseTime:Math.round(c),p95ResponseTime:Math.round(t[E]?.duration||0),p99ResponseTime:Math.round(t[f]?.duration||0),successRate:r/s.length*100,slowOperations:Array.from(l)}}getCacheStats(){const s=this.cacheHits+this.cacheMisses;return{size:this.memoCache.size,hitRate:s>0?this.cacheHits/s*100:0,hits:this.cacheHits,misses:this.cacheMisses}}getMemoized(s){const e=this.memoCache.get(s);if(e){if(Date.now()-e.timestamp>this.MEMO_TTL){this.memoCache.delete(s);return}return e.hits++,e.value}}memoize(s,e){const t=JSON.stringify(e).length;this.memoCache.set(s,{value:e,timestamp:Date.now(),hits:0,size:t}),this.memoCache.size>this.MAX_CACHE_SIZE&&this.cleanupCache()}async withTimeout(s,e){return Promise.race([s,new Promise((t,r)=>setTimeout(()=>r(new Error(`Operation timed out after ${e}ms`)),e))])}recordMetric(s,e,t,r){this.metricsBuffer[this.metricsIndex]={operation:s,duration:e,timestamp:Date.now(),success:t,metadata:r},this.metricsIndex=(this.metricsIndex+1)%this.MAX_METRICS,this.metricsCount<this.MAX_METRICS&&this.metricsCount++,e>this.TARGET_RESPONSE_TIME&&V.warn("Slow operation detected",{operation:s,duration:`${e.toFixed(2)}ms`,target:`${this.TARGET_RESPONSE_TIME}ms`,metadata:r})}};m(w,"instance");let ee=w;const qe=ee.getInstance(),pe={AGENT_CREATION:"https://docs.example.com/agent-creation",STREAMING:"https://docs.example.com/streaming-issues",STORAGE:"https://docs.example.com/storage-troubleshooting",MEMORY:"https://docs.example.com/memory-management",PROVIDER:"https://docs.example.com/provider-setup",GENERAL:"https://docs.example.com/help"},j={get AGENT_CREATION_FAILED(){return n.errors_catalog_agentCreationFailed_template({agentName:"{agentName}",details:"{details}"})},get AGENT_ALREADY_EXISTS(){return n.errors_catalog_agentAlreadyExists_template({agentName:"{agentName}"})},get INVALID_AGENT_CONFIG(){return n.errors_catalog_invalidAgentConfig_template({details:"{details}"})},get INVALID_CONFIG(){return n.errors_catalog_invalidConfig_template({details:"{details}"})},get SESSION_NOT_FOUND(){return n.errors_catalog_sessionNotFound_template({sessionId:"{sessionId}"})},get SESSION_ALREADY_ACTIVE(){return n.errors_catalog_sessionAlreadyActive_template()},get SESSION_INITIALIZATION_FAILED(){return n.errors_catalog_sessionInitializationFailed_template({details:"{details}"})},get STREAM_CONNECTION_FAILED(){return n.errors_catalog_streamConnectionFailed_template({details:"{details}"})},get STREAM_TIMEOUT(){return n.errors_catalog_streamTimeout_template({timeout:"{timeout}"})},get STREAM_INTERRUPTED(){return n.errors_catalog_streamInterrupted_template({attempt:"{attempt}",maxAttempts:"{maxAttempts}"})},get STREAM_RECOVERY_FAILED(){return n.errors_catalog_streamRecoveryFailed_template({attempts:"{attempts}"})},get MESSAGE_SEND_FAILED(){return n.errors_catalog_messageSendFailed_template({details:"{details}"})},get MESSAGE_VALIDATION_FAILED(){return n.errors_catalog_messageValidationFailed_template({details:"{details}"})},get MESSAGE_TOO_LONG(){return n.errors_catalog_messageTooLong_template({maxLength:"{maxLength}",currentLength:"{currentLength}"})},get PROVIDER_NOT_FOUND(){return n.errors_catalog_providerNotFound_template({provider:"{provider}"})},get PROVIDER_CONNECTION_FAILED(){return n.errors_catalog_providerConnectionFailed_template({provider:"{provider}",details:"{details}"})},get PROVIDER_PROCESS_DIED(){return n.errors_catalog_providerProcessDied_template({provider:"{provider}"})},get STORAGE_READ_FAILED(){return n.errors_catalog_storageReadFailed_template({details:"{details}"})},get STORAGE_WRITE_FAILED(){return n.errors_catalog_storageWriteFailed_template({details:"{details}"})},get STORAGE_CORRUPTED(){return n.errors_catalog_storageCorrupted_template({lastBackup:"{lastBackup}"})},get MEMORY_LIMIT_EXCEEDED(){return n.errors_catalog_memoryLimitExceeded_template({currentUsage:"{currentUsage}",limit:"{limit}"})},get RATE_LIMIT_EXCEEDED(){return n.errors_catalog_rateLimitExceeded_template({count:"{count}",window:"{window}"})},get CONCURRENT_LIMIT_EXCEEDED(){return n.errors_catalog_concurrentLimitExceeded_template({current:"{current}",max:"{max}"})}},ze={get AGENT_CREATION_FAILED(){return n.errors_catalog_agentCreationFailed_friendly()},get AGENT_ALREADY_EXISTS(){return n.errors_catalog_agentAlreadyExists_friendly()},get INVALID_AGENT_CONFIG(){return n.errors_catalog_invalidAgentConfig_friendly()},get INVALID_CONFIG(){return n.errors_catalog_invalidConfig_friendly()},get SESSION_NOT_FOUND(){return n.errors_catalog_sessionNotFound_friendly()},get SESSION_ALREADY_ACTIVE(){return n.errors_catalog_sessionAlreadyActive_friendly()},get SESSION_INITIALIZATION_FAILED(){return n.errors_catalog_sessionInitializationFailed_friendly()},get STREAM_CONNECTION_FAILED(){return n.errors_catalog_streamConnectionFailed_friendly()},get STREAM_TIMEOUT(){return n.errors_catalog_streamTimeout_friendly()},get STREAM_INTERRUPTED(){return n.errors_catalog_streamInterrupted_friendly()},get STREAM_RECOVERY_FAILED(){return n.errors_catalog_streamRecoveryFailed_friendly()},get MESSAGE_SEND_FAILED(){return n.errors_catalog_messageSendFailed_friendly()},get MESSAGE_VALIDATION_FAILED(){return n.errors_catalog_messageValidationFailed_friendly()},get MESSAGE_TOO_LONG(){return n.errors_catalog_messageTooLong_friendly()},get PROVIDER_NOT_FOUND(){return n.errors_catalog_providerNotFound_friendly()},get PROVIDER_CONNECTION_FAILED(){return n.errors_catalog_providerConnectionFailed_friendly()},get PROVIDER_PROCESS_DIED(){return n.errors_catalog_providerProcessDied_friendly()},get STORAGE_READ_FAILED(){return n.errors_catalog_storageReadFailed_friendly()},get STORAGE_WRITE_FAILED(){return n.errors_catalog_storageWriteFailed_friendly()},get STORAGE_CORRUPTED(){return n.errors_catalog_storageCorrupted_friendly()},get MEMORY_LIMIT_EXCEEDED(){return n.errors_catalog_memoryLimitExceeded_friendly()},get RATE_LIMIT_EXCEEDED(){return n.errors_catalog_rateLimitExceeded_friendly()},get CONCURRENT_LIMIT_EXCEEDED(){return n.errors_catalog_concurrentLimitExceeded_friendly()}};function He(i){return(i.match(/{(\w+)}/g)||[]).map(e=>e.slice(1,-1))}function Ke(i,s){return He(i).every(t=>t in s)}function Ie(i,s={}){return i.replace(/{(\w+)}/g,(e,t)=>String(s[t]??e))}function J(i){const s=n.errors_cleanMessage_fallback_error();if(!i)return s;let e=i;return e=e.replace(/^.*?failed(?:\s+to\s+.*?)?\s+after\s+\d+\s+attempts:\s*/i,""),e=e.replace(/^Error invoking remote method '[^']+':(\s*Error:)?\s*/i,""),e=e.replace(/^(Error:\s*)+/i,""),e=e.replace(/\n\s*at .+/g,""),e=e.replace(/\s+/g," ").trim(),e||s}function Qe(i,s){return s&&j[i]&&Ke(j[i],s)?Ie(j[i],s):ze[i]||n.errors_userFriendly_fallback_error()}function Ze(i){const e={AGENT_CREATION_FAILED:"AGENT_CREATION",AGENT_ALREADY_EXISTS:"AGENT_CREATION",INVALID_AGENT_CONFIG:"AGENT_CREATION",STREAM_CONNECTION_FAILED:"STREAMING",STREAM_TIMEOUT:"STREAMING",STREAM_INTERRUPTED:"STREAMING",STREAM_RECOVERY_FAILED:"STREAMING",STORAGE_READ_FAILED:"STORAGE",STORAGE_WRITE_FAILED:"STORAGE",STORAGE_CORRUPTED:"STORAGE",MEMORY_LIMIT_EXCEEDED:"MEMORY",RATE_LIMIT_EXCEEDED:"MEMORY",CONCURRENT_LIMIT_EXCEEDED:"MEMORY",PROVIDER_NOT_FOUND:"PROVIDER",PROVIDER_CONNECTION_FAILED:"PROVIDER",PROVIDER_PROCESS_DIED:"PROVIDER"}[i];return e?pe[e]:pe.GENERAL}const je={AGENT_CREATION_FAILED:[{action:"retry",description:"Try creating the agent again",automatic:!1,priority:"high"},{action:"check-config",description:"Verify agent configuration in settings",automatic:!1,priority:"high"},{action:"check-resources",description:"Ensure sufficient memory and disk space",automatic:!1,priority:"medium"}],AGENT_ALREADY_EXISTS:[{action:"rename",description:"Choose a different name for the agent",automatic:!1,priority:"high"},{action:"delete-existing",description:"Delete the existing agent first",automatic:!1,priority:"medium"}],INVALID_AGENT_CONFIG:[{action:"review-config",description:"Review and correct the configuration",automatic:!1,priority:"high"},{action:"use-defaults",description:"Reset to default configuration",automatic:!1,priority:"medium"}],INVALID_CONFIG:[{action:"review-config",description:"Review and correct the configuration",automatic:!1,priority:"high"},{action:"use-defaults",description:"Reset to default configuration",automatic:!1,priority:"medium"}],SESSION_NOT_FOUND:[{action:"start-new",description:"Start a new agent session",automatic:!1,priority:"high"},{action:"check-history",description:"Check session history for recent sessions",automatic:!1,priority:"medium"}],SESSION_ALREADY_ACTIVE:[{action:"wait",description:"Wait for the current session to complete",automatic:!1,priority:"high"},{action:"cancel",description:"Cancel the active session first",automatic:!1,priority:"high"}],SESSION_INITIALIZATION_FAILED:[{action:"retry",description:"Try initializing the session again",automatic:!1,priority:"high"},{action:"check-resources",description:"Ensure sufficient resources are available",automatic:!1,priority:"medium"}],MESSAGE_SEND_FAILED:[{action:"retry",description:"Try sending the message again",automatic:!1,priority:"high"},{action:"check-connection",description:"Check your network connection",automatic:!1,priority:"high"}],MESSAGE_VALIDATION_FAILED:[{action:"review-config",description:"Review and correct the message format",automatic:!1,priority:"high"},{action:"check-config",description:"Check configuration for valid message format",automatic:!1,priority:"medium"}],MESSAGE_TOO_LONG:[{action:"retry",description:"Shorten the message and try again",automatic:!1,priority:"high"},{action:"batch",description:"Split the message into multiple parts",automatic:!1,priority:"medium"}],PROVIDER_NOT_FOUND:[{action:"check-config",description:"Verify provider is properly configured",automatic:!1,priority:"high"},{action:"recreate",description:"Install or reinstall the provider",automatic:!1,priority:"high"}],PROVIDER_CONNECTION_FAILED:[{action:"retry",description:"Try connecting to the provider again",automatic:!1,priority:"high"},{action:"check-config",description:"Verify provider configuration",automatic:!1,priority:"high"}],STORAGE_READ_FAILED:[{action:"retry",description:"Try reading the data again",automatic:!1,priority:"high"},{action:"restore",description:"Restore from a recent backup",automatic:!1,priority:"medium"}],STORAGE_WRITE_FAILED:[{action:"retry",description:"Try saving again",automatic:!1,priority:"high"},{action:"check-resources",description:"Check available disk space",automatic:!1,priority:"high"}],STREAM_CONNECTION_FAILED:[{action:"retry",description:"Try connecting again",automatic:!1,priority:"high"},{action:"check-connection",description:"Check your network connection",automatic:!1,priority:"high"}],STREAM_RECOVERY_FAILED:[{action:"restart",description:"Restart the agent",automatic:!1,priority:"high"},{action:"check-config",description:"Check error logs for more details",automatic:!1,priority:"medium"}],STREAM_INTERRUPTED:[{action:"reconnect",description:"Attempting automatic reconnection",automatic:!0,priority:"high"},{action:"retry",description:"Retry sending the message",automatic:!1,priority:"high"},{action:"check-connection",description:"Check your internet connection",automatic:!1,priority:"medium"}],STREAM_TIMEOUT:[{action:"wait",description:"Wait for agent to complete processing",automatic:!1,priority:"high"},{action:"cancel",description:"Cancel current operation",automatic:!1,priority:"medium"},{action:"increase-timeout",description:"Increase timeout in settings",automatic:!1,priority:"low"}],PROVIDER_PROCESS_DIED:[{action:"restart",description:"Restart agent process",automatic:!0,priority:"high"},{action:"recreate",description:"Create new agent session",automatic:!1,priority:"high"}],STORAGE_CORRUPTED:[{action:"restore",description:"Restore from backup",automatic:!1,priority:"high"},{action:"reset",description:"Reset agent data",automatic:!1,priority:"medium"}],MEMORY_LIMIT_EXCEEDED:[{action:"cleanup",description:"Close unused agents",automatic:!1,priority:"high"},{action:"increase-limit",description:"Increase memory limit in settings",automatic:!1,priority:"medium"}],RATE_LIMIT_EXCEEDED:[{action:"wait",description:"Wait before making more requests",automatic:!1,priority:"high"},{action:"batch",description:"Batch requests together",automatic:!1,priority:"medium"}],CONCURRENT_LIMIT_EXCEEDED:[{action:"close-agents",description:"Close some running agents",automatic:!1,priority:"high"},{action:"queue",description:"Queue operation for later",automatic:!1,priority:"medium"}]};function Je(i){return je[i]||[{action:"retry",description:"Try the operation again",automatic:!1,priority:"high"}]}var D=(i=>(i.AGENT_CREATION_FAILED="AGENT_CREATION_FAILED",i.AGENT_ALREADY_EXISTS="AGENT_ALREADY_EXISTS",i.INVALID_AGENT_CONFIG="INVALID_AGENT_CONFIG",i.INVALID_CONFIG="INVALID_CONFIG",i.SESSION_NOT_FOUND="SESSION_NOT_FOUND",i.SESSION_ALREADY_ACTIVE="SESSION_ALREADY_ACTIVE",i.SESSION_INITIALIZATION_FAILED="SESSION_INITIALIZATION_FAILED",i.STREAM_CONNECTION_FAILED="STREAM_CONNECTION_FAILED",i.STREAM_TIMEOUT="STREAM_TIMEOUT",i.STREAM_INTERRUPTED="STREAM_INTERRUPTED",i.STREAM_RECOVERY_FAILED="STREAM_RECOVERY_FAILED",i.MESSAGE_SEND_FAILED="MESSAGE_SEND_FAILED",i.MESSAGE_VALIDATION_FAILED="MESSAGE_VALIDATION_FAILED",i.MESSAGE_TOO_LONG="MESSAGE_TOO_LONG",i.PROVIDER_NOT_FOUND="PROVIDER_NOT_FOUND",i.PROVIDER_CONNECTION_FAILED="PROVIDER_CONNECTION_FAILED",i.PROVIDER_PROCESS_DIED="PROVIDER_PROCESS_DIED",i.PROVIDER_UNAVAILABLE="PROVIDER_UNAVAILABLE",i.PROVIDER_ERROR="PROVIDER_ERROR",i.STORAGE_READ_FAILED="STORAGE_READ_FAILED",i.STORAGE_WRITE_FAILED="STORAGE_WRITE_FAILED",i.STORAGE_CORRUPTED="STORAGE_CORRUPTED",i.STORAGE_ERROR="STORAGE_ERROR",i.STORAGE_QUOTA_EXCEEDED="STORAGE_QUOTA_EXCEEDED",i.MEMORY_LIMIT_EXCEEDED="MEMORY_LIMIT_EXCEEDED",i.RATE_LIMIT_EXCEEDED="RATE_LIMIT_EXCEEDED",i.CONCURRENT_LIMIT_EXCEEDED="CONCURRENT_LIMIT_EXCEEDED",i.RESOURCE_NOT_FOUND="RESOURCE_NOT_FOUND",i.RESOURCE_EXHAUSTED="RESOURCE_EXHAUSTED",i.NETWORK_ERROR="NETWORK_ERROR",i.PERMISSION_DENIED="PERMISSION_DENIED",i.OPERATION_FAILED="OPERATION_FAILED",i.VALIDATION_ERROR="VALIDATION_ERROR",i.INVALID_RESPONSE="INVALID_RESPONSE",i.STATE_CORRUPTION="STATE_CORRUPTION",i.CONTEXT_OVERFLOW="CONTEXT_OVERFLOW",i))(D||{});class Y extends Error{constructor(e,t,r={},a){super(e);m(this,"code");m(this,"context");m(this,"recoverySuggestions");m(this,"userMessage");m(this,"isRecoverable");m(this,"cause");this.name="AgentError",this.code=t,this.context={...r,timestamp:new Date,stackTrace:this.stack},this.userMessage=a?.userMessage||this.getDefaultUserMessage(t),this.recoverySuggestions=a?.recoverySuggestions||this.getDefaultRecoverySuggestions(t),this.isRecoverable=a?.isRecoverable??this.isErrorRecoverable(t),a?.cause&&(this.cause=a.cause)}getDefaultUserMessage(e){return Qe(e,this.context)}getDefaultRecoverySuggestions(e){return Je(e)}isErrorRecoverable(e){return["STREAM_INTERRUPTED","STREAM_TIMEOUT","MESSAGE_SEND_FAILED","PROVIDER_PROCESS_DIED","STORAGE_READ_FAILED","STORAGE_WRITE_FAILED"].includes(e)}getHelpLink(){return Ze(this.code)}formatMessage(e){return Ie(e,this.context)}toJSON(){return{name:this.name,code:this.code,message:this.message,userMessage:this.userMessage,context:this.context,recoverySuggestions:this.recoverySuggestions,isRecoverable:this.isRecoverable,helpLink:this.getHelpLink(),stack:this.stack}}}const et={NON_RETRYABLE_ERRORS:["EACCES","EPERM","ENOSPC","EMFILE","permission","memory","fatal","process died","not available on your current plan","agent binary","rate limit","too many requests","hit your limit","you've hit your limit","quota exceeded"]};function ie(i){const s=i.toLowerCase();for(const e of et.NON_RETRYABLE_ERRORS)if(s.includes(e.toLowerCase()))return!0;return!1}const tt="Agent already has an in-flight prompt. Message was not delivered.",v=W("ErrorBoundary"),b=class b{constructor(){}static getInstance(){return b.instance||(b.instance=new b),b.instance}async wrap(s,e,t={}){const{retries:r=Re.DEFAULT_ATTEMPTS,retryDelay:a=Re.BASE_DELAY,exponentialBackoff:l=!0,notify:c=!1,notifyOnRetry:E=!1,context:f={},onError:u,onRetry:o,shouldRetry:R=this.defaultShouldRetry}=t;let g=null,d=0;for(d=1;d<=r+1;d++)try{v.debug(`[${e}] Attempt ${d}/${r+1}`);const h=await s();return d>1&&v.info(`[${e}] Succeeded after ${d} attempts`),h}catch(h){if(g=h,v.error(`[${e}] Attempt ${d} failed`,{error:g.message,attempt:d,maxAttempts:r+1,context:f}),u?.(g,d),d<=r&&R(g)){const C=l?a*Math.pow(2,d-1):a;E&&Q.warning(n.agent_errorBoundary_retrying_message({seconds:C/1e3})),o?.(d),v.info(`[${e}] Retrying in ${C}ms`),await this.sleep(C)}else break}const k=`${e} failed after ${d} attempt${d===1?"":"s"}: ${g?.message}`,P=J(g?.message||n.agent_errorBoundary_generic_error()),N=g?.message?.toLowerCase()||"",$=N.includes("no available models")||N.includes("all models exhausted")||N.includes("all models unavailable");throw c&&!$&&Q.error(P),new Y(P,D.OPERATION_FAILED,{originalError:g?.message,detailedMessage:k,attempts:d,context:f})}async wrapVoid(s,e,t={}){await this.wrap(s,e,t)}wrapSync(s,e,t={}){try{return s()}catch(r){const a=r;throw v.error(`[${e}] Failed`,{error:a.message,context:t.context}),t.notify&&Q.error(J(a.message)),new Y(J(a.message),D.OPERATION_FAILED,t.context)}}defaultShouldRetry(s){const e=s.message.toLowerCase();return ie(s.message)?!1:e.includes("network")||e.includes("timeout")?!0:s instanceof Y?[D.NETWORK_ERROR,D.STREAM_TIMEOUT,D.STREAM_CONNECTION_FAILED,D.PROVIDER_CONNECTION_FAILED,D.PROVIDER_UNAVAILABLE].includes(s.code):!(e.includes("invalid")||e.includes("interrupted")||e.includes("cancel")||e.includes("not found")||e.includes("not available")||e.includes("404")||e.includes("no available models")||e.includes("all models exhausted")||e.includes("all models unavailable")||e.includes("413")||e.includes("too long for the agent")||e.includes("request entity too large")||e.includes("payload too large")||e.includes("content too large")||e.includes("body too large")||e.includes("unauthorized")||e.includes("forbidden")||e.includes("401")||e.includes("403"))}sleep(s){return new Promise(e=>setTimeout(e,s))}async withTimeout(s,e,t){return Promise.race([s(),new Promise((r,a)=>setTimeout(()=>a(new Y(`${t} timed out after ${e}ms`,D.STREAM_TIMEOUT)),e))])}async batchOperations(s,e,t={}){const{concurrency:r=5,continueOnError:a=!0,operationName:l="batch operation"}=t,c=[],E=[];for(let f=0;f<s.length;f+=r){const u=s.slice(f,f+r);(await Promise.allSettled(u.map(R=>e(R)))).forEach((R,g)=>{if(R.status==="fulfilled")c.push(R.value);else{const d=R.reason;if(E.push({item:u[g],error:d}),v.error(`[${l}] Batch item failed`,{item:u[g],error:d.message}),!a)throw d}})}return E.length>0&&v.warn(`[${l}] Completed with ${E.length} errors`),{results:c,errors:E}}};m(b,"instance");let te=b;const st=te.getInstance(),se=W("browser/index"),F=new Map,B=new Map;let U;function it(i,s,e){for(const t of s)try{t(e)}catch(r){se.error("Error in agent subscriber callback",{agentId:i,error:r})}}function rt(){if(U)return;let i=!1;U=p.createSelector(e=>e.agentSessions)().subscribe(()=>{if(!i){i=!0;return}if(F.size===0)return;const e=p.state;for(const[t,r]of F){const a=Ae.select(e,t);B.get(t)!==a&&(B.set(t,a),it(t,r,a))}})}function at(){F.size>0||!U||(U(),U=void 0,B.clear())}function Ct(i,s,e){let t=F.get(i);const r=!t;t||(t=new Set,F.set(i,t)),t.add(s),rt();const a=p.state,l=Ae.select(a,i);return r&&B.set(i,l),l?se.debug("[subscribeToAgent] Initial callback data",{agentId:i,workspaceId:e??"current",hasSession:!0}):se.debug("[subscribeToAgent] No session found",{agentId:i,workspaceId:e??"current"}),s(l),()=>{const c=F.get(i);c&&(c.delete(s),c.size===0&&(F.delete(i),B.delete(i))),at()}}const y=W("ErrorRecovery"),Se={network:{maxRetries:3,initialBackoffMs:1e3,maxBackoffMs:1e4,backoffMultiplier:2,shouldRetry:i=>{const s=i.message.toLowerCase();return s.includes("network")||s.includes("fetch")||s.includes("connection")||s.includes("timeout")}},streaming:{maxRetries:5,initialBackoffMs:500,maxBackoffMs:5e3,backoffMultiplier:1.5,shouldRetry:(i,s)=>{if(s>=5)return!1;const e=i.message.toLowerCase();return e.includes("no available models")||e.includes("all models exhausted")||e.includes("all models unavailable")||ie(i.message)?!1:e.includes("stream")||e.includes("chunk")||e.includes("incomplete")}},persistence:{maxRetries:2,initialBackoffMs:100,maxBackoffMs:1e3,backoffMultiplier:2,shouldRetry:i=>{const s=i.message.toLowerCase();return s.includes("save")||s.includes("write")||s.includes("persist")}},rateLimit:{maxRetries:3,initialBackoffMs:5e3,maxBackoffMs:3e4,backoffMultiplier:2,shouldRetry:i=>{const s=i.message.toLowerCase();return s.includes("rate")||s.includes("limit")||s.includes("429")}}};class nt{constructor(){m(this,"listeners",new Map)}on(s,e){let t=this.listeners.get(s);t||(t=new Set,this.listeners.set(s,t)),t.add(e)}off(s,e){this.listeners.get(s)?.delete(e)}emit(s,...e){this.listeners.get(s)?.forEach(t=>{try{t(...e)}catch(r){y.error(`Error in event listener for ${s}:`,r)}})}removeAllListeners(){this.listeners.clear()}}class ot extends nt{constructor(){super(...arguments);m(this,"activeRecoveries",new Map);m(this,"recoveryStats",new Map)}async executeWithRecovery(e,t=Se.network,r){const a=Date.now(),l=new AbortController;r&&(this.cancelRecovery(r),this.activeRecoveries.set(r,l));let c,E=t.initialBackoffMs,f=0;for(let u=1;u<=t.maxRetries;u++){if(f=u,l.signal.aborted){y.info(`Recovery cancelled for operation ${r}`);break}try{y.debug(`Attempting operation (attempt ${u}/${t.maxRetries})`,{operationId:r});const o=await e();return this.updateStats(r,!0),this.emit("recovery:success",{operationId:r,attempt:u,duration:Date.now()-a}),r&&this.activeRecoveries.delete(r),{success:!0,data:o,attempts:u,totalTime:Date.now()-a}}catch(o){c=o,y.warn(`Operation failed (attempt ${u}/${t.maxRetries})`,{operationId:r,error:c.message});const R=c.message.toLowerCase();if(R.includes("interrupted")||R.includes("cancelled")||R.includes("canceled")){y.debug("User-initiated interruption/cancellation, not retrying",{operationId:r,error:c.message});break}if(R.includes("no available models")||R.includes("all models exhausted")||R.includes("all models unavailable")){y.debug("All models exhausted, not retrying",{operationId:r,error:c.message});break}if(ie(c.message)){y.debug("Fatal error detected, not retrying",{operationId:r,error:c.message});break}if(!t.shouldRetry(c,u)){y.debug("Error not retryable, stopping recovery",{operationId:r,error:c.message});break}if(u<t.maxRetries){const g=Math.random()*.2*E,d=Math.min(E+g,t.maxBackoffMs);t.onRetry?.(u,d),this.emit("recovery:retry",{operationId:r,attempt:u,delay:d,error:c.message}),await this.delay(d,l.signal),E=Math.min(E*t.backoffMultiplier,t.maxBackoffMs)}}}return this.updateStats(r,!1),t.onFailure?.(c,f),this.emit("recovery:failure",{operationId:r,attempts:f,duration:Date.now()-a,error:c?.message}),r&&this.activeRecoveries.delete(r),{success:!1,error:c,attempts:f,totalTime:Date.now()-a}}cancelRecovery(e){const t=this.activeRecoveries.get(e);t&&(t.abort(),this.activeRecoveries.delete(e),y.info(`Cancelled recovery for operation ${e}`))}cancelAllRecoveries(){for(const[e,t]of this.activeRecoveries)t.abort(),y.info(`Cancelled recovery for operation ${e}`);this.activeRecoveries.clear()}getStats(e){if(e)return this.recoveryStats.get(e)||{successes:0,failures:0};const t={};for(const[r,a]of this.recoveryStats)t[r]=a;return t}clearStats(e){e?this.recoveryStats.delete(e):this.recoveryStats.clear()}isRetryable(e,t){const r=e.message.toLowerCase();if(t)switch(t){case"NETWORK":return r.includes("network")||r.includes("fetch");case"TIMEOUT":return r.includes("timeout")||r.includes("timed out");case"RATE_LIMIT":return r.includes("rate")||r.includes("limit")||r.includes("429");case"TEMPORARY":return r.includes("temporary")||r.includes("transient");case"CONFLICT":return r.includes("conflict")||r.includes("concurrent");default:return!1}return this.isRetryable(e,"NETWORK")||this.isRetryable(e,"TIMEOUT")||this.isRetryable(e,"RATE_LIMIT")||this.isRetryable(e,"TEMPORARY")||this.isRetryable(e,"CONFLICT")}delay(e,t){return new Promise((r,a)=>{const l=setTimeout(r,e);if(t){const c=()=>{clearTimeout(l),a(new Error("Delay aborted"))};t.addEventListener("abort",c);const E=r;r=()=>{t.removeEventListener("abort",c),E()}}})}updateStats(e,t){if(!e)return;const r=this.recoveryStats.get(e)||{successes:0,failures:0};t?r.successes++:r.failures++,this.recoveryStats.set(e,r)}dispose(){this.cancelAllRecoveries(),this.recoveryStats.clear(),this.removeAllListeners()}}const ct=new ot,O=new Ye({category:"WorkspaceMetrics"}),lt=100;class ut{constructor(){m(this,"metrics",new Map);m(this,"operations",new Map)}startWorkspaceCreation(s){const e=Date.now();for(this.metrics.delete(s),this.metrics.set(s,{workspaceId:s,creationStarted:e});this.metrics.size>lt;){const t=this.metrics.keys().next().value;if(t===void 0)break;this.metrics.delete(t)}O.info("Started tracking workspace creation",{workspaceId:s})}recordMilestone(s,e){const t=this.metrics.get(s);if(!t){O.warn("No metrics found for workspace",{workspaceId:s,milestone:e});return}const r=Date.now();switch(e){case"optimisticNavigation":t.optimisticNavigation=r;break;case"realWorkspaceCreated":t.realWorkspaceCreated=r;break;case"agentCreated":t.agentCreated=r;break;case"agentReady":t.agentReady=r;break;case"firstMessageSent":t.firstMessageSent=r;break;case"firstResponseReceived":t.firstResponseReceived=r;break;case"firstChunkReceived":t.firstChunkReceived=r;break;case"totalDuration":t.totalDuration=r;break;case"workspaceId":case"creationStarted":O.warn("Cannot update milestone",{milestone:e});return}const a=r-t.creationStarted;O.info(`Milestone: ${e}`,{workspaceId:s,elapsed:`${a}ms`,timestamp:r}),e==="firstResponseReceived"&&(t.totalDuration=r-t.creationStarted,this.logSummary(s))}startOperation(s,e){this.operations.set(s,{startTime:Date.now(),metadata:e})}endOperation(s,e){const t=this.operations.get(s);if(!t)return O.warn("Operation not found",{operationId:s}),null;const r=Date.now();return t.endTime=r,t.duration=r-t.startTime,e&&(t.metadata={...t.metadata,...e}),O.info("Operation completed",{operationId:s,duration:`${t.duration}ms`,metadata:t.metadata}),this.operations.delete(s),t.duration}getMetrics(s){return this.metrics.get(s)}logSummary(s){const e=this.metrics.get(s);if(!e)return;const t={workspaceId:s,totalDuration:`${e.totalDuration}ms`,stages:{optimisticNavigation:e.optimisticNavigation?`${e.optimisticNavigation-e.creationStarted}ms`:"N/A",realWorkspaceCreation:e.realWorkspaceCreated?`${e.realWorkspaceCreated-e.creationStarted}ms`:"N/A",agentCreation:e.agentCreated?`${e.agentCreated-e.creationStarted}ms`:"N/A",agentReady:e.agentReady?`${e.agentReady-e.creationStarted}ms`:"N/A",firstMessage:e.firstMessageSent?`${e.firstMessageSent-e.creationStarted}ms`:"N/A",firstResponse:e.firstResponseReceived?`${e.firstResponseReceived-e.creationStarted}ms`:"N/A"}};O.info("=== Workspace Creation Metrics Summary ===",t),O.info("Workspace Creation Metrics:",t)}clearMetrics(s){this.metrics.delete(s)}incrementAgentCreated(s){const e=this.metrics.get(s);e&&(e.agentCreated=Date.now(),O.info("Agent created",{workspaceId:s}))}incrementMessageSent(s){const e=this.metrics.get(s);e&&!e.firstMessageSent&&(e.firstMessageSent=Date.now(),O.info("First message sent",{workspaceId:s}))}}const dt=new ut,M=W("AgentSend");function A(i){p.dispatch(i)}function Te(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function mt(i){const s=Te(i)&&i.success===!0&&"data"in i?i.data:i;return!Te(s)||s.success!==!1?!1:typeof s.error=="string"&&s.error.includes(tt)}async function Lt(i,s,e,t={}){const r=he.select(p.state,e.id);if(!r)return;const a=Ne(i,e.id),l=t.submission,c=!!l&&Le.select(p.state,l.scope)?.supported===!0,E=(o,R,g=!1)=>{l&&A(Be(l.scope,l.id,o,Date.now(),R,g))};let f=!1;const u=()=>(!l||f||ve.select(p.state,l))&&r===he.select(p.state,e.id)&&a.isCurrent(p.state.agentSessions?.byAgentId[i]?.workspaceId);return qe.track(`sendMessage:${a.key}:${i}:${l?.id??"legacy"}`,async()=>{if(!u())return;M.debug(`Sending message to agent ${i}`,{contentLength:s.length,hasContextReferences:!!t.contextReferences?.length,model:t.model});let o=await p.dispatch(we(e.id,i));if(u()){if(!o)throw new Error(n.agent_streamLifecycle_sessionNotFound_error({agentId:i}));o={...o,isStreaming:o.isStreaming??!1};{if(o&&(o.status==="pending"||!o.id)&&!o.backendSessionId&&o.activationState!==H.ACTIVE&&o.activationState!==H.ACTIVATING){const h=e.id.startsWith("optimistic-"),C=e.worktreePath||e.repositoryPath||e.path;if(!h&&C){M.info("Activating pending session in sendMessage",{agentId:i,status:o.status,activationState:o.activationState,hasBackendSessionId:!!o.backendSessionId});const x=await p.dispatch(be(e.id,i));if(!u())return;x&&(o=x)}else throw M.warn("Cannot activate agent - workspace not ready",{agentId:i,workspaceId:e.id,isOptimistic:h,hasWorktreePath:!!e.worktreePath,hasRepositoryPath:!!e.repositoryPath,hasPath:!!e.path}),new Error(n.agent_streamLifecycle_spaceNotReady_error())}else o&&o.status==="pending"&&o.backendSessionId&&(M.info("Fixing status for already-activated session",{agentId:i,backendSessionId:o.backendSessionId,activationState:o.activationState}),o={...o,status:Fe.Active,activationState:H.ACTIVE},A(de({...o,workspaceId:e.id})));if(!o)throw new Error(`Failed to get or create session for agent ${i}`);A(de({...o,workspaceId:e.id}));const g=[{type:"text",text:s}];if(t.imageBlocks)for(const h of t.imageBlocks)g.push({type:"image",...h.data!==void 0?{data:h.data}:{},...h.mimeType!==void 0?{mimeType:h.mimeType}:{},...h.attachmentId!==void 0?{attachmentId:h.attachmentId}:{}});if(t.fileBlocks)for(const h of t.fileBlocks)g.push({type:"file",attachmentId:h.attachmentId,fileName:h.fileName,...h.mimeType!==void 0?{mimeType:h.mimeType}:{},...h.size!==void 0?{size:h.size}:{}});const d=t.userAppMessageId??oe(),k=t.messageMetadata?.[ge],P={...t.contextReferences?.length?{contextReferences:t.contextReferences}:{},...k!==void 0?{[ge]:k}:{}},N={id:me(le()),appMessageId:d,role:"user",contentBlocks:g,timestamp:new Date().toISOString(),metadata:{...P,...t.messageMetadata??{}}};c||(l&&(E("rejected"),f=!0),A(ke(o.id,N))),A(z(o.id,!0));let $=!1;try{c||await p.dispatch(Ge(e.id,i,!0,{allowTruncation:t.resetHistory}));const h=me(`msg_${le()}`),C=oe(),x=async()=>st.wrap(async()=>{if(!u())return;M.info("Agent Service: Sending message to backend with image and file blocks",{agentId:i,sessionId:o.id,hasImageBlocks:!!t.imageBlocks,imageBlocksCount:t.imageBlocks?.length||0,imageBlockDetails:t.imageBlocks?.map(_=>({type:_.type,mimeType:_.mimeType,dataLength:_.data?.length||0}))||[],hasFileBlocks:!!t.fileBlocks,fileBlocksCount:t.fileBlocks?.length||0,fileBlockDetails:t.fileBlocks?.map(_=>({type:_.type,fileName:_.fileName,mimeType:_.mimeType,attachmentId:_.attachmentId,size:_.size}))||[]});const Oe=t.model??t.modelId??o.model??void 0;A(Pe(i));const ye=ce(i,e.id),ae=p.state.chatState?.byAgentId[i]?.attemptGeneration??0,T=await $e("agent.sendMessage",{agentId:i,...c&&l?{messageId:l.id}:{},workspaceId:e.id,content:s,model:Oe,contextReferences:t.contextReferences,imageBlocks:t.imageBlocks,fileBlocks:t.fileBlocks,noteIds:t.noteIds,stdinContext:t.stdinContext,assistantMessageId:h,userAppMessageId:d,assistantAppMessageId:C,priority:t.priority,...t.messageMetadata?{messageMetadata:t.messageMetadata}:{}}).catch(_=>{if(u())throw _});if(u()){if(mt(T)){M.info("Backend dropped duplicate in-flight prompt",{agentId:i,sessionId:o.id}),E("rejected");return}if(T&&typeof T=="object"&&"success"in T){if(!T.success){const _=T.error,I=typeof _=="string"?_:_?.message;throw $=!0,new Error(I||n.agent_streamLifecycle_sendToBackendFailed_error())}if("queued"in T&&T.queued===!0){if(M.info("sendMessage auto-queued by daemon (mid-turn or turn-startup race)",{agentId:i,sessionId:o.id,queuedMessageId:T.queuedMessage?.id}),(!c||!l||!ue.select(p.state,l))&&A(z(o.id,!1)),c||A(xe(o.id,N.id)),c){const I=T.queuedMessage,G=T.turnId,L=typeof G=="string"?G:I?.turnId;if(I&&typeof L=="string"){const S=Ee(s,t),X=K.select(p.state,i,e.id).find(ne=>ne.id===I.id||ne.turnId===L);A(fe(i,I.id,S,L,_e(X??I,S),!X&&!!l&&ue.select(p.state,l),ae))}E("accepted",I,!0),q(i,e.id);return}const _=T.queuedMessage;if(_){const I=T.turnId,G=typeof I=="string"?I:_.turnId;let L=_;if(u()&&ce(i,e.id)===ye){const S=K.select(p.state,i,e.id),X=We(S,_);A(Ve(i,X,e.id))}else u()&&(M.debug("queued-response queue seed superseded by an authoritative snapshot; reconciling via hydrate",{agentId:i,queuedMessageId:_.id}),await q(i,e.id).catch(()=>{}),L=K.select(p.state,i,e.id).find(S=>S.id===_.id||S.turnId===G));if(u()&&typeof G=="string"){const S=Ee(s,t);A(fe(i,_.id,S,G,_e(L??_,S),!L,ae))}else u()&&M.warn("auto-queued sendMessage response carried no turnId; retry record not parked",{agentId:i,queuedMessageId:_.id})}return}}c&&(E("accepted"),q(i,e.id),Ce(i,e.id)),dt.incrementMessageSent(e.id)}},"send message",{retries:c?0:2,notify:!1,context:{agentId:i,workspace:e.id}}),re=c?await x().then(()=>({success:!0,error:void 0})):await ct.executeWithRecovery(x,Se.streaming,`send-message-${i}`);if(!re.success)throw re.error||new Error(n.agent_streamLifecycle_sendFailed_error())}catch(h){if(!u())return;throw A(z(o.id,!1)),!c&&t.messageMetadata&&A(Ue(o.id,N.id,{metadata:P})),c&&E($?"rejected":"uncertain"),h}}}},{memoize:!1,coalesce:!0,priority:"high"})}export{Ct as a,J as c,We as r,Lt as s};
@@ -1,3 +1,3 @@
1
- import{fC as B,Hb as r,n2 as U,lw as F,ln as G,s2 as K}from"./WOicJa2k.js";import{f as j,F as q,dL as V,cD as E,dk as w,dw as L,dG as N,cy as Y,aA as $}from"./D24Lh2xV.js";import{l as z,R as J,E as Q}from"./CWKAugar.js";function X(e){return!e.retiredAt&&!e.pendingDeleteAt&&e.status!=="deleted"}function m(e){const t=new Date(e.lastActivity??e.updatedAt??e.createdAt).getTime()||0,s=e.messages.at(-1)?.timestamp,n=s&&new Date(s).getTime()||0;return Math.max(t,n)}function we(e){const t=e.filter(X).map(s=>({agent:s,activity:m(s),created:new Date(s.createdAt).getTime()||0})).sort((s,n)=>n.activity-s.activity||n.created-s.created||String(s.agent.id).localeCompare(String(n.agent.id)));return t.find(({agent:s})=>B(s)==="topLevel")?.agent??t[0]?.agent??null}const p="__chief__",M="New chat";function Z(e){const t=e?.trim();return!t||t===M||t==="New chat with Assistant"||t==="New chat with Intent"||t==="Chief of Staff"||t.startsWith("New thread ")}function ee(e){const t=e.name?.trim();if(e.nameExplicitlySet&&t)return t;const n=e.messages.find(l=>l.role==="user")??e.messages[0],c=n?j(n).trim():"";return!t||Z(t)?c||M:c||t}const te="chief-of-staff",se=6,T="## Assistant Runtime Identity\n\nYou are Intent's built-in Assistant. Operate at the app level with `ws.app.*` tools: manage workspaces, settings, specialists, navigation, and cross-workspace agents. You are not a repository coding agent. Treat generic coding-agent, workspace, spec, task, and delegation instructions as subordinate to this role.\n\nWhen the user requests repository work, create or open the appropriate workspace and hand the work to the appropriate specialist. Once you have enough repository or PR information, act through the app-level proposal flow instead of merely promising to verify, prepare, or hand off the work.\n\nShow workspaces, notes, files, agent conversations and repository links beside your conversation when they help the user. Share ordinary Markdown links to notes (intent://local/note/<noteId> or intent://local/<workspaceId>/note/<noteId>) workspace links (intent://local/workspace/<workspaceId>), workspace file and agent links, and HTTPS repository URLs; clicking opens a closable content panel while keeping chat visible. To show content automatically, call `ws.app.ui.navigate` with the same link or /workspace/<workspaceId>. Calling `ws.app.workspaces.open` also shows that workspace beside chat unless the user requests a new window. Each conversation has its own panel history. Workspaces show the same detail and agent chat as Home’s Workspaces tab. Earlier content remains available in that conversation’s panel header picker. Creating a note alone does not open it: explicitly navigate when you want to show it.\n\nWhen the user asks to transfer a project between devices, find the source workspace with `ws.app.workspaces.list` and call `ws.app.workspaces.transfer(id, { destination })`. Pass the user's destination name as the hint, or omit it so they can choose a saved device in the inline card. The source is the device serving this assistant conversation. The tool only proposes the transfer: wait for approval or cancellation in the card, and report completion only after the proposal is applied.";function be(e){const t=e?.trim();return t?`${T}
1
+ import{fC as B,Hb as r,n2 as U,lw as F,ln as G,s2 as K}from"./WOicJa2k.js";import{f as j,F as q,dL as V,cD as E,dk as w,dw as L,dG as N,cy as Y,aA as $}from"./-1vWYJiy.js";import{l as z,R as J,E as Q}from"./CWKAugar.js";function X(e){return!e.retiredAt&&!e.pendingDeleteAt&&e.status!=="deleted"}function m(e){const t=new Date(e.lastActivity??e.updatedAt??e.createdAt).getTime()||0,s=e.messages.at(-1)?.timestamp,n=s&&new Date(s).getTime()||0;return Math.max(t,n)}function we(e){const t=e.filter(X).map(s=>({agent:s,activity:m(s),created:new Date(s.createdAt).getTime()||0})).sort((s,n)=>n.activity-s.activity||n.created-s.created||String(s.agent.id).localeCompare(String(n.agent.id)));return t.find(({agent:s})=>B(s)==="topLevel")?.agent??t[0]?.agent??null}const p="__chief__",M="New chat";function Z(e){const t=e?.trim();return!t||t===M||t==="New chat with Assistant"||t==="New chat with Intent"||t==="Chief of Staff"||t.startsWith("New thread ")}function ee(e){const t=e.name?.trim();if(e.nameExplicitlySet&&t)return t;const n=e.messages.find(l=>l.role==="user")??e.messages[0],c=n?j(n).trim():"";return!t||Z(t)?c||M:c||t}const te="chief-of-staff",se=6,T="## Assistant Runtime Identity\n\nYou are Intent's built-in Assistant. Operate at the app level with `ws.app.*` tools: manage workspaces, settings, specialists, navigation, and cross-workspace agents. You are not a repository coding agent. Treat generic coding-agent, workspace, spec, task, and delegation instructions as subordinate to this role.\n\nWhen the user requests repository work, create or open the appropriate workspace and hand the work to the appropriate specialist. Once you have enough repository or PR information, act through the app-level proposal flow instead of merely promising to verify, prepare, or hand off the work.\n\nShow workspaces, notes, files, agent conversations and repository links beside your conversation when they help the user. Share ordinary Markdown links to notes (intent://local/note/<noteId> or intent://local/<workspaceId>/note/<noteId>) workspace links (intent://local/workspace/<workspaceId>), workspace file and agent links, and HTTPS repository URLs; clicking opens a closable content panel while keeping chat visible. To show content automatically, call `ws.app.ui.navigate` with the same link or /workspace/<workspaceId>. Calling `ws.app.workspaces.open` also shows that workspace beside chat unless the user requests a new window. Each conversation has its own panel history. Workspaces show the same detail and agent chat as Home’s Workspaces tab. Earlier content remains available in that conversation’s panel header picker. Creating a note alone does not open it: explicitly navigate when you want to show it.\n\nWhen the user asks to transfer a project between devices, find the source workspace with `ws.app.workspaces.list` and call `ws.app.workspaces.transfer(id, { destination })`. Pass the user's destination name as the hint, or omit it so they can choose a saved device in the inline card. The source is the device serving this assistant conversation. The tool only proposes the transfer: wait for approval or cancellation in the card, and report completion only after the proposal is applied.";function be(e){const t=e?.trim();return t?`${T}
2
2
 
3
3
  ${t}`:T}const ne=r.createSelector((e,t)=>{const s=e.backgroundHooks?.byWorkspaceId?.[t];return s?U(s.hooks):[]}),re=r.createSelector((e,t)=>e.backgroundHooks?.byWorkspaceId?.[t]?.snapshotStatus??"loading"),O=r.createSelector((e,t)=>e.scriptMonitor?.byWorkspaceId[t]??F),Ae=r.createSelector((e,t,s)=>{const n=O.select(e,t);return n.status==="unsupported"?[]:n.monitors.filter(c=>c.agentId===s)}),u=r.createSelector((e,t,s)=>{const n=K(t,s);return e.agentSubscriptionUI.entries[n]??G}),oe=r.createSelector((e,t,s)=>u.select(e,t,s).subscriptions),ae=r.createSelector((e,t,s)=>u.select(e,t,s).eventSubscriptions??[]),ce=r.createSelector((e,t,s)=>u.select(e,t,s).delegationGroups),ve=r.createSelector((e,t,s)=>u.select(e,t,s).agentStatuses),ye=r.createSelector((e,t,s)=>u.select(e,t,s).waitingState),Ce=r.createSelector((e,t,s)=>u.select(e,t,s).wokenUpInfo);function ie(e){return[...new Set(e.filter(Boolean))]}const We=r.createSelector((e,t,s)=>{const n=u.select(e,t,s),c=[],l=new Set,i=o=>{for(const a of ie(o))l.has(a)||(l.add(a),c.push(a))},h=[...n.subscriptions].sort((o,a)=>o.createdAt.localeCompare(a.createdAt)||o.id.localeCompare(a.id));for(const o of h)o.delegationGroup?.awaitMode!=="all"&&i(o.actorIds);const g=new Map;for(const o of n.delegationGroups)o.awaitMode==="all"&&g.set(o.groupId,o);for(const o of g.values())i(o.expectedAgentIds);for(const o of h){const a=o.delegationGroup;a?.awaitMode==="all"&&!g.has(a.groupId)&&i(a.expectedAgentIds)}const d=new Set;for(const o of n.delegationGroups){for(const a of o.completedAgentIds)d.add(a);for(const a of o.deletedAgentIds)d.add(a);for(const[a,f]of Object.entries(o.agentStatuses))f==="completed"&&d.add(a)}for(const[o,a]of Object.entries(n.agentStatuses))a==="completed"&&d.add(o);const A=e.agentSessions?.byAgentId??{},v=new Set([...d].filter(o=>{const a=A[o];return!a||!q(V(a))})),y=new Map(c.map((o,a)=>[o,a])),C=o=>{const a=A[o];if(!a)return 2;if(a.attentionRequestKind==="blocker")return 0;if(a.attentionRequestKind==="discussion")return 1;if(v.has(o))return 4;const f=String(a.status).toLowerCase();return f==="responding"||f==="active"||f==="processing"?2:3},W=c.filter(o=>!v.has(o)).sort((o,a)=>C(o)-C(a)||(y.get(o)??0)-(y.get(a)??0));return{visible:n.snapshotStatus==="failed"||n.waitingState==="completed"||c.length>0||n.wokenUpInfo!==null,count:W.length,participantAgentIds:W}}),Te=r.createSelector((e,t,s)=>u.select(e,t,s).snapshotStatus),Ee=r.createSelector((e,t)=>{const s=`${t}:`,n=[];for(const c of Object.keys(e.agentSubscriptionUI.entries))c.startsWith(s)&&n.push(c.slice(s.length));return n});r.createSelector((e,t,s)=>{const n=ce.select(e,t,s);let c=0,l=0;for(const i of n)c+=i.expectedAgentIds.length,l+=i.completedAgentIds.length+i.deletedAgentIds.length;return{total:c,completed:l}});const Le=r.createSelector(e=>{const t=z.select(e);if(!t||!J.select(e))return[];const s=new Set;for(const n of Q.select(e,t)){const c=n.panes.find(l=>l.id===n.activePaneId);c?.type==="agent"&&c.agentId&&s.add(c.agentId)}return[...s].map(n=>({wsId:t,agentId:n}))}),P="pinned",le=64;function I(e){return e.trim().toLocaleLowerCase()}function _(e){return e===P}function Ne(e,t){const s=e.trim();if(s.length===0)return{ok:!1,error:"empty"};if([...s].length>le)return{ok:!1,error:"tooLong"};const n=I(s);return n===P?{ok:!1,error:"reserved"}:t.some(c=>I(c)===n)?{ok:!1,error:"duplicate"}:{ok:!0,label:s}}function de(e){const t=new Map;for(const s of e){if(typeof s!="string"||_(s))continue;const n=s.trim();if(n.length===0)continue;const c=I(n);t.has(c)||t.set(c,s)}return[...t.values()].sort((s,n)=>s.localeCompare(n,void 0,{sensitivity:"base"}))}function R(e){const s=e.workspaceAgents?.byWorkspaceId?.[p]?.agentIds,n=s&&s.length>0?new Set(s.map(i=>String(i))):null,c=e.agentSessions?.agentIdsByWorkspace?.[p]??[],l=c.length>0?c.map(i=>e.agentSessions?.byAgentId?.[i]).filter(i=>!!i):Object.values(e.agentSessions?.byAgentId??{}).filter(i=>i.workspaceId===p);return n?l.filter(i=>n.has(String(i.id))):l}function D(e){return e.metadata?.specialist===te&&e.metadata?.chiefPromptVersion===se}function H(e){return Math.max(e.messages.length,e.messageCount??0)}function S(e){return{agentId:e.id,title:ee(e),isActive:e.isStreaming===!0||e.isProcessing===!0||e.isResponding===!0,messageCount:H(e),pinned:e.pinned===!0,retired:!!e.retiredAt}}function b(e){return R(e).filter(t=>!t.retiredAt)}function k(e,t){return m(t)-m(e)}const Me=r.createSelector(e=>e.sidebarNav.panelItem),Oe=r.createSelector(e=>e.sidebarNav.onboardingActive),Pe=r.createSelector(e=>e.sidebarNav.showCreateModal),x=r.createSelector(e=>E.select(e)?.capabilities.workspaceLabels===1),_e=r.createSelector((e,t)=>w.select(e,t)?.label??null),Re=r.createSelector(e=>de(L.select(e).map(t=>t.label))),pe=["id","label"],De=r.createSelector((e,t)=>x.select(e)&&N.select(e,t,pe)!==null),ue=r.createSelector(e=>E.select(e)?.capabilities.workspaceAutoArchiveOptOut===1),ge=r.createSelector(e=>(e.sidebarNav.autoArchiveIdleAfterDays??0)>0),He=r.createSelector((e,t)=>w.select(e,t)?.autoArchiveDisabled===!0),fe=["id","autoArchiveDisabled"],xe=r.createSelector((e,t)=>{if(!ue.select(e)||!ge.select(e))return!1;const s=w.select(e,t);return!s||s.isRemote===!0||s.environmentConfig?.type==="remote"?!1:N.select(e,t,fe)!==null}),Be=r.createSelector(e=>e.sidebarNav.pinnedWorkspaceIds),Ue=r.createSelector(e=>x.select(e)?L.select(e).filter(t=>_(t.label)).map(t=>t.id):e.sidebarNav.pinnedWorkspaceIds),Fe=r.createSelector((e,t)=>e.sidebarNav.multiSelectSelectedTabIdsByWorkspaceId[t]??["overview"]),Ge=r.createSelector((e,t)=>e.sidebarNav.noteOrderByWorkspaceId[t]??[]),Ke=r.createSelector((e,t)=>e.sidebarNav.collapsedNoteIdsByWorkspaceId[t]??[]),je=r.createSelector((e,t)=>e.sidebarNav.expandedNoteIdsByWorkspaceId?.[t]??[]),qe=r.createSelector(e=>e.sidebarNav.chiefActiveAgentId),Ve=r.createSelector((e,t)=>{const s=e.agentSessions.byAgentId[t];if(s?.workspaceId!==p)return{hooks:0,monitors:0,subscriptions:0};const n=re.select(e,p)==="ready"?ne.select(e,p).filter(d=>d.agentId===t&&(d.state==="scheduled"||d.state==="running")).length:s.waitingOnHooks?.length??0,c=Y.select(e,p)==="ready"?$.select(e,p,t).filter(d=>d.state==="active").length:s.waitingOnPrMonitors?.length??0,l=O.select(e,p),i=l.status==="unsupported"?0:l.status==="ready"?l.monitors.filter(d=>d.agentId===t&&d.state==="active").length:s.waitingOnScriptMonitors?.length??0,h=s.isWaitingForOtherAgents===!1?0:s.waitingForAgentIds?.length??(oe.select(e,p,t).length||(s.isWaitingForOtherAgents?1:0)),g=ae.select(e,p,t).filter(d=>d.subscriberAgentId===t).length;return{hooks:n,monitors:c+i,subscriptions:h+g}}),Ye=r.createSelector(e=>e.sidebarNav.statsOverlayOpen),he=r.createSelector(e=>b(e).sort((t,s)=>+(s.pinned===!0)-+(t.pinned===!0)||k(t,s)).map(S)),Se=r.createSelector(e=>R(e).filter(t=>!!t.retiredAt).sort(k).map(S)),$e=r.createSelector(e=>[...he.select(e),...Se.select(e)]),ze=r.createSelector(e=>{const t=b(e).filter(D).sort(k)[0];return t?S(t):null}),Je=r.createSelector(e=>{const t=b(e).filter(s=>H(s)===0&&!s.lastMessageId&&D(s)).sort(k)[0];return t?S(t):null});export{Ue as A,Se as B,se as C,M as D,Je as E,O as F,Pe as G,Ye as H,Te as I,Ee as J,ye as K,Ce as L,He as M,Ke as N,je as O,P,_e as Q,Re as R,Ge as S,Ne as T,le as W,te as a,p as b,be as c,X as d,We as e,ve as f,oe as g,$e as h,_ as i,Ve as j,ne as k,re as l,xe as m,De as n,qe as o,he as p,ze as q,we as r,Ae as s,ce as t,Le as u,x as v,Be as w,Fe as x,Oe as y,Me as z};