@intent-hq/web 2.315.0 → 2.316.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 (263) hide show
  1. package/package.json +1 -1
  2. package/web/app/immutable/chunks/{CzzsK_z0.js → -4NpXDFA.js} +1 -1
  3. package/web/app/immutable/chunks/-JijlOOI.js +1 -0
  4. package/web/app/immutable/chunks/{B36kU0RI.js → 1glN8WZR.js} +1 -1
  5. package/web/app/immutable/chunks/{CIkNpS3P.js → 4GOFpkFz.js} +1 -1
  6. package/web/app/immutable/chunks/{B6o2T7JU.js → 4OYv1x7m.js} +1 -1
  7. package/web/app/immutable/chunks/{BzVDQRgL.js → 5Qkq80VH.js} +1 -1
  8. package/web/app/immutable/chunks/{bS-VFUYb.js → 5doW_7tI.js} +1 -1
  9. package/web/app/immutable/chunks/{Cuq9exmb.js → 62Z5FdlR.js} +1 -1
  10. package/web/app/immutable/chunks/{BA8g-07b.js → 6TqymR4w.js} +1 -1
  11. package/web/app/immutable/chunks/{Dvap-Bcg.js → 6b0rgNvc.js} +2 -2
  12. package/web/app/immutable/chunks/{ZaCkwnYl.js → 74ywEOg9.js} +1 -1
  13. package/web/app/immutable/chunks/{DEmaG7Ya.js → 8mzXJxUW.js} +1 -1
  14. package/web/app/immutable/chunks/{CpELl9t1.js → AXIAXE42.js} +3 -3
  15. package/web/app/immutable/chunks/{DTsLO4aV.js → B-QbT_QZ.js} +1 -1
  16. package/web/app/immutable/chunks/{DDIYUGOD.js → B1LQECzz.js} +1 -1
  17. package/web/app/immutable/chunks/{BsB-PCKs.js → B3RA9kXa.js} +1 -1
  18. package/web/app/immutable/chunks/{Swkg1pRS.js → B4r7cJNO.js} +1 -1
  19. package/web/app/immutable/chunks/{IIdGbw6g.js → B5CAnWhZ.js} +1 -1
  20. package/web/app/immutable/chunks/{BDIALQgX.js → B5JU_-gP.js} +1 -1
  21. package/web/app/immutable/chunks/{C3vS1byi.js → B666jmxV.js} +1 -1
  22. package/web/app/immutable/chunks/{D60vJvLR.js → B89nEuF-.js} +1 -1
  23. package/web/app/immutable/chunks/{Csa9LtrA.js → B8NcRhEG.js} +1 -1
  24. package/web/app/immutable/chunks/{9GP6SafJ.js → B8W3QKCn.js} +1 -1
  25. package/web/app/immutable/chunks/{B1h0QCy7.js → B9HMXORu.js} +1 -1
  26. package/web/app/immutable/chunks/{BS-r7N3W.js → B9Y6nB-h.js} +1 -1
  27. package/web/app/immutable/chunks/{BwdewdLu.js → BAMIlwbq.js} +1 -1
  28. package/web/app/immutable/chunks/{Dj42fWMH.js → BAm6Imyt.js} +1 -1
  29. package/web/app/immutable/chunks/{CTKJUmq_.js → BDA1Ugkc.js} +1 -1
  30. package/web/app/immutable/chunks/{CZBUuakO.js → BDPSecFd.js} +2 -2
  31. package/web/app/immutable/chunks/{D22I-TIV.js → BELPi3nC.js} +1 -1
  32. package/web/app/immutable/chunks/{CtO7SsM-.js → BEZid-wN.js} +1 -1
  33. package/web/app/immutable/chunks/{eYob4ynm.js → BEm-LQiN.js} +1 -1
  34. package/web/app/immutable/chunks/{CUjmBXfD.js → BErHxpt7.js} +1 -1
  35. package/web/app/immutable/chunks/{BoXSGPEf.js → BI_3dcBJ.js} +2 -2
  36. package/web/app/immutable/chunks/{dyJEvFNA.js → BJHfEwR6.js} +1 -1
  37. package/web/app/immutable/chunks/{PeOOhaLn.js → BJjB6NZq.js} +1 -1
  38. package/web/app/immutable/chunks/{DE0RJrWM.js → BKNCuPkO.js} +1 -1
  39. package/web/app/immutable/chunks/{wc9xM_2L.js → BM8QRBST.js} +1 -1
  40. package/web/app/immutable/chunks/{CfHhYnBc.js → BPGcNKLB.js} +1 -1
  41. package/web/app/immutable/chunks/{BGkYz2ud.js → BQ8tXdZu.js} +1 -1
  42. package/web/app/immutable/chunks/{DrxYPSVr.js → BSwRALVr.js} +1 -1
  43. package/web/app/immutable/chunks/{hUiIfi2t.js → BTNnUZgK.js} +1 -1
  44. package/web/app/immutable/chunks/{45Qi4YFf.js → BThHq8_S.js} +1 -1
  45. package/web/app/immutable/chunks/{D1h8l9Ve.js → BVGPFX9W.js} +1 -1
  46. package/web/app/immutable/chunks/{BI7cYdMD.js → BZ779J0V.js} +3 -3
  47. package/web/app/immutable/chunks/{BM62R-OM.js → BZyiigVh.js} +1 -1
  48. package/web/app/immutable/chunks/{JchQH-Q8.js → B_-HLIzl.js} +1 -1
  49. package/web/app/immutable/chunks/{jn5owXje.js → B_Lm5gCD.js} +1 -1
  50. package/web/app/immutable/chunks/{Clc6wozH.js → B_Uva0b1.js} +1 -1
  51. package/web/app/immutable/chunks/BaBfwkQ0.js +4 -0
  52. package/web/app/immutable/chunks/{ZpSdOcUX.js → BdGv2V1p.js} +1 -1
  53. package/web/app/immutable/chunks/{C8LKnqUt.js → BdtaGGP-.js} +1 -1
  54. package/web/app/immutable/chunks/{cE62vW_i.js → Be4GIdcx.js} +2 -2
  55. package/web/app/immutable/chunks/{17xFUwtQ.js → BeqM5XE9.js} +2 -2
  56. package/web/app/immutable/chunks/{etKulcEH.js → Bffmk8mK.js} +1 -1
  57. package/web/app/immutable/chunks/{DbrsPlQk.js → BhFD9JDw.js} +1 -1
  58. package/web/app/immutable/chunks/{C7ilG2WB.js → BiJhyKRr.js} +1 -1
  59. package/web/app/immutable/chunks/{CMMABWQi.js → BiLRO_7d.js} +1 -1
  60. package/web/app/immutable/chunks/{D441f0lY.js → Bj5FOIMp.js} +43 -43
  61. package/web/app/immutable/chunks/{CzdJ5DN4.js → BkPvaENa.js} +1 -1
  62. package/web/app/immutable/chunks/{Czd6tfZA.js → BlBXbDCF.js} +1 -1
  63. package/web/app/immutable/chunks/{qmO_2WOw.js → Bl_mdtS5.js} +1 -1
  64. package/web/app/immutable/chunks/{BTxL9if-.js → BnY3EDnN.js} +3 -3
  65. package/web/app/immutable/chunks/{DXHWw6vt.js → BodsW_pQ.js} +2 -2
  66. package/web/app/immutable/chunks/{DnMKNs0X.js → BqCXmi6V.js} +3 -3
  67. package/web/app/immutable/chunks/{CBRfvExq.js → BqUqwkFB.js} +1 -1
  68. package/web/app/immutable/chunks/{B6MVuluU.js → BqZ5K73B.js} +1 -1
  69. package/web/app/immutable/chunks/{D5arKTNF.js → Bqva_xpl.js} +1 -1
  70. package/web/app/immutable/chunks/{DxI6kRYN.js → Bs8Qb-17.js} +1 -1
  71. package/web/app/immutable/chunks/{Bjzk9M3D.js → BszyP2Xm.js} +1 -1
  72. package/web/app/immutable/chunks/{ja3pdsid.js → Bt8I_YBy.js} +1 -1
  73. package/web/app/immutable/chunks/{DbHbiWFj.js → BuJ6T8t6.js} +1 -1
  74. package/web/app/immutable/chunks/{DGvAL7MJ.js → BuNSu9iM.js} +1 -1
  75. package/web/app/immutable/chunks/{BP6KtsDA.js → BxgdFxC5.js} +1 -1
  76. package/web/app/immutable/chunks/{BHJ90Mf-.js → Byx47MBL.js} +1 -1
  77. package/web/app/immutable/chunks/{B2jOlwPp.js → BzbMU544.js} +1 -1
  78. package/web/app/immutable/chunks/{CjCXWRTy.js → C-b2TnYk.js} +1 -1
  79. package/web/app/immutable/chunks/{DcBvBE74.js → C010Rrz_.js} +1 -1
  80. package/web/app/immutable/chunks/{D0UrvUQM.js → C0GDF9vt.js} +1 -1
  81. package/web/app/immutable/chunks/{DZhHioOL.js → C2Inz1MA.js} +1 -1
  82. package/web/app/immutable/chunks/{Cufik1EG.js → C2WXNTdR.js} +1 -1
  83. package/web/app/immutable/chunks/{BW4yj8m7.js → C3HkPZ8G.js} +1 -1
  84. package/web/app/immutable/chunks/{CFrKPVp-.js → C4RhwIf-.js} +1 -1
  85. package/web/app/immutable/chunks/{D2QAvk7S.js → C4u6LQEf.js} +1 -1
  86. package/web/app/immutable/chunks/{1r2-2NoO.js → C53cDHO_.js} +1 -1
  87. package/web/app/immutable/chunks/{DM1ZHS3Y.js → C5_6YJsU.js} +1 -1
  88. package/web/app/immutable/chunks/{Deg5jWhG.js → C74GZ40P.js} +1 -1
  89. package/web/app/immutable/chunks/{dUOQ5AaY.js → C8iHXc33.js} +1 -1
  90. package/web/app/immutable/chunks/{B-8kHUzd.js → C9Fu7eOC.js} +1 -1
  91. package/web/app/immutable/chunks/{BMMcARVk.js → C9I4tasT.js} +1 -1
  92. package/web/app/immutable/chunks/{CjGoJ5M9.js → C9mX4U8C.js} +2 -2
  93. package/web/app/immutable/chunks/{DUjsEo3X.js → CB7NczxA.js} +1 -1
  94. package/web/app/immutable/chunks/{-EpgQj88.js → CB__zD5M.js} +1 -1
  95. package/web/app/immutable/chunks/{DNFEdIdv.js → CCIM6To3.js} +1 -1
  96. package/web/app/immutable/chunks/{AStlTL_B.js → CD9NMDLt.js} +1 -1
  97. package/web/app/immutable/chunks/{Cpn3qWfd.js → CDKknk7B.js} +1 -1
  98. package/web/app/immutable/chunks/{CEoXgs7Q.js → CEB_6XsH.js} +1 -1
  99. package/web/app/immutable/chunks/{B-P4veSb.js → CH1mzr4Y.js} +1 -1
  100. package/web/app/immutable/chunks/{BlQxdvN2.js → CI2w5V5f.js} +1 -1
  101. package/web/app/immutable/chunks/{BZmsmL8P.js → CK7B4YgF.js} +1 -1
  102. package/web/app/immutable/chunks/{C5-HTPPK.js → CKMm3ui8.js} +1 -1
  103. package/web/app/immutable/chunks/{i8qNDIdz.js → CQGNrQKX.js} +1 -1
  104. package/web/app/immutable/chunks/{CPS8yuKp.js → CRB8gnRr.js} +1 -1
  105. package/web/app/immutable/chunks/{D43c7AFS.js → CT6OoS2U.js} +1 -1
  106. package/web/app/immutable/chunks/{DQ13AkOA.js → CU7uaRH8.js} +1 -1
  107. package/web/app/immutable/chunks/{Cso7NntT.js → CUsBvtcm.js} +1 -1
  108. package/web/app/immutable/chunks/{D56XXK4f.js → CVRU8SPX.js} +1 -1
  109. package/web/app/immutable/chunks/{B-2_r0A5.js → CVUE3R4M.js} +1 -1
  110. package/web/app/immutable/chunks/{DRONnAVY.js → CVaZI97u.js} +1 -1
  111. package/web/app/immutable/chunks/{H0ZjbDhN.js → CXBZySXz.js} +1 -1
  112. package/web/app/immutable/chunks/{2UOzeX2M.js → CXfuXg3I.js} +1 -1
  113. package/web/app/immutable/chunks/{CrskbTlC.js → CXrMqMyA.js} +1 -1
  114. package/web/app/immutable/chunks/{D90jQ3ZZ.js → CZbq2yCl.js} +1 -1
  115. package/web/app/immutable/chunks/{DQHfY0wY.js → C_jLGOhH.js} +1 -1
  116. package/web/app/immutable/chunks/{dRknRrDn.js → CaC6IVGK.js} +1 -1
  117. package/web/app/immutable/chunks/{BPhG_Xtj.js → CaW-fRmu.js} +2 -2
  118. package/web/app/immutable/chunks/{CTX2aXUF.js → Cdke6HGe.js} +1 -1
  119. package/web/app/immutable/chunks/{ChLTaT6L.js → CeJ1IeC2.js} +1 -1
  120. package/web/app/immutable/chunks/{BsZr4pOk.js → CeQqxeYw.js} +1 -1
  121. package/web/app/immutable/chunks/{DyHgOFFg.js → CesSZmjL.js} +1 -1
  122. package/web/app/immutable/chunks/{2j5TR93A.js → CfZC2MEi.js} +1 -1
  123. package/web/app/immutable/chunks/{DnouAZbM.js → Ch1H5x_J.js} +1 -1
  124. package/web/app/immutable/chunks/{B9pexpLt.js → Cj4zs9c7.js} +1 -1
  125. package/web/app/immutable/chunks/{CMqLPRJh.js → CkCqJfhq.js} +1 -1
  126. package/web/app/immutable/chunks/{uDDQZzPe.js → CkfN0rvh.js} +1 -1
  127. package/web/app/immutable/chunks/{HpMdkrj7.js → ClUXFe3K.js} +1 -1
  128. package/web/app/immutable/chunks/{DW_tfZdS.js → CmLKusq1.js} +3 -3
  129. package/web/app/immutable/chunks/{AJN9mSFe.js → CnKV6OJ6.js} +1 -1
  130. package/web/app/immutable/chunks/{C-jm3uXv.js → CnQHIa4H.js} +6 -6
  131. package/web/app/immutable/chunks/{j-Hd81da.js → CnnMkIrL.js} +1 -1
  132. package/web/app/immutable/chunks/{BhfbTmVQ.js → CokmOrrP.js} +1 -1
  133. package/web/app/immutable/chunks/{hYDzZ9as.js → CqJpu93-.js} +1 -1
  134. package/web/app/immutable/chunks/{B-7spAu4.js → CsEnNURD.js} +1 -1
  135. package/web/app/immutable/chunks/{DsRw0NLx.js → CsSJgs0M.js} +2 -2
  136. package/web/app/immutable/chunks/{Q95-G3Tv.js → Csc1-9uJ.js} +1 -1
  137. package/web/app/immutable/chunks/{CVr9pwFM.js → Cscrr3Bj.js} +1 -1
  138. package/web/app/immutable/chunks/{D38Ru3z6.js → Csm7pADB.js} +1 -1
  139. package/web/app/immutable/chunks/{gIgvBwPt.js → CtZ1ayFi.js} +1 -1
  140. package/web/app/immutable/chunks/{82qiqofo.js → Ctd97c_e.js} +1 -1
  141. package/web/app/immutable/chunks/{D9Da4bYx.js → Cu6U4_SW.js} +1 -1
  142. package/web/app/immutable/chunks/{DV6UkZ5a.js → CvEWlZlD.js} +1 -1
  143. package/web/app/immutable/chunks/CvwAJPbw.js +175 -0
  144. package/web/app/immutable/chunks/{6Rt8MvWn.js → Cvz2UPkQ.js} +1 -1
  145. package/web/app/immutable/chunks/{tVfn9CHP.js → Cx_Gtduu.js} +1 -1
  146. package/web/app/immutable/chunks/{CZikPtVV.js → Cy5dtLUp.js} +1 -1
  147. package/web/app/immutable/chunks/{DJZIU3cR.js → Cy_Sd6l-.js} +1 -1
  148. package/web/app/immutable/chunks/{CD3v15Ti.js → CyaBhv0M.js} +1 -1
  149. package/web/app/immutable/chunks/{Dd-BRJYG.js → Cyi8qA9K.js} +1 -1
  150. package/web/app/immutable/chunks/{Br9IA-Ja.js → Czwx3NuT.js} +1 -1
  151. package/web/app/immutable/chunks/{r3MPkSU0.js → D-zBZCIk.js} +1 -1
  152. package/web/app/immutable/chunks/{CpnUYFMu.js → D0vQQfVr.js} +1 -1
  153. package/web/app/immutable/chunks/{_pUPWAkF.js → D2F-bT-3.js} +1 -1
  154. package/web/app/immutable/chunks/{C5DgMO0u.js → D3KzRi1O.js} +3 -3
  155. package/web/app/immutable/chunks/{yJa3kvR1.js → D3wKW8Yy.js} +1 -1
  156. package/web/app/immutable/chunks/{Co0AVCAv.js → D5eIiHgJ.js} +1 -1
  157. package/web/app/immutable/chunks/D5sm9-9m.js +1 -0
  158. package/web/app/immutable/chunks/D9vinIDW.js +1 -0
  159. package/web/app/immutable/chunks/{6vbvyEDW.js → DB72_jij.js} +1 -1
  160. package/web/app/immutable/chunks/{DLueLf8l.js → DBctQLOE.js} +1 -1
  161. package/web/app/immutable/chunks/{DdHsJ0nA.js → DCER3gcM.js} +1 -1
  162. package/web/app/immutable/chunks/DDa1LTyW.js +271 -0
  163. package/web/app/immutable/chunks/{CoJeJSLc.js → DIAJO_LS.js} +1 -1
  164. package/web/app/immutable/chunks/{fKsoycU6.js → DKJ-ClwC.js} +1 -1
  165. package/web/app/immutable/chunks/{B9xm9DK7.js → DMMQmvHP.js} +1 -1
  166. package/web/app/immutable/chunks/{CXnUJFR2.js → DRnZS8vr.js} +1 -1
  167. package/web/app/immutable/chunks/{Bg4RpIu7.js → DSuQ3pnp.js} +1 -1
  168. package/web/app/immutable/chunks/{C4C2GjZ7.js → DYFYZyyQ.js} +1 -1
  169. package/web/app/immutable/chunks/{CqSXeJtk.js → DYpVqbU_.js} +1 -1
  170. package/web/app/immutable/chunks/{CJzNuuJO.js → DZjJzG_y.js} +1 -1
  171. package/web/app/immutable/chunks/{DhZDbKoP.js → Da50wjjU.js} +1 -1
  172. package/web/app/immutable/chunks/{BkDFndY7.js → Da5VtqHi.js} +1 -1
  173. package/web/app/immutable/chunks/{D0UXbQbI.js → DaGonLMu.js} +1 -1
  174. package/web/app/immutable/chunks/{9CybJbHN.js → DczjFzGu.js} +1 -1
  175. package/web/app/immutable/chunks/{BbGlxyDx.js → DghTaRWn.js} +1 -1
  176. package/web/app/immutable/chunks/{UWOPR8uY.js → DjGSED-U.js} +2 -2
  177. package/web/app/immutable/chunks/{DaCSSt4n.js → Dkd8TC3I.js} +1 -1
  178. package/web/app/immutable/chunks/{BKJB_6oY.js → DlnJ95sD.js} +4 -4
  179. package/web/app/immutable/chunks/{WVbSHjXl.js → DmeizJnp.js} +1 -1
  180. package/web/app/immutable/chunks/{BQupMMp-.js → Dp10o7PT.js} +1 -1
  181. package/web/app/immutable/chunks/{DXYkWPe_.js → DrGaWKZY.js} +1 -1
  182. package/web/app/immutable/chunks/Ds24foTJ.js +1 -0
  183. package/web/app/immutable/chunks/Dw9SO8pk.js +324 -0
  184. package/web/app/immutable/chunks/{DCdW5wmG.js → DwfAZy2c.js} +1 -1
  185. package/web/app/immutable/chunks/{CLGCkXvY.js → DwojjmdS.js} +1 -1
  186. package/web/app/immutable/chunks/{daoeIyG_.js → DwsOsy09.js} +1 -1
  187. package/web/app/immutable/chunks/{CiJSzLSf.js → Dz1YFuOh.js} +1 -1
  188. package/web/app/immutable/chunks/{h8IoI-w7.js → DzNB7FSW.js} +1 -1
  189. package/web/app/immutable/chunks/E2zwcBGL.js +1 -0
  190. package/web/app/immutable/chunks/{BWdRpmh3.js → EysdqQlI.js} +1 -1
  191. package/web/app/immutable/chunks/{Cwy3o6zK.js → GsTyZvYk.js} +1 -1
  192. package/web/app/immutable/chunks/{CLSvSGMY.js → HJiWQ3CH.js} +1 -1
  193. package/web/app/immutable/chunks/{E-3i0Fur.js → HSaJqWy-.js} +3 -3
  194. package/web/app/immutable/chunks/{DmYZE-MO.js → IgS40dps.js} +3 -3
  195. package/web/app/immutable/chunks/{4GsjZWx0.js → LnIYdbx4.js} +1 -1
  196. package/web/app/immutable/chunks/{QihShgnK.js → M2l9pCLN.js} +1 -1
  197. package/web/app/immutable/chunks/{DWhtEEhJ.js → McgjWRB8.js} +1 -1
  198. package/web/app/immutable/chunks/{DCPTVyDU.js → NYl-wMGf.js} +21 -21
  199. package/web/app/immutable/chunks/{DBOoSzzw.js → Rv7yxoLs.js} +1 -1
  200. package/web/app/immutable/chunks/{D-b9zJlt.js → SwYsdc6L.js} +1 -1
  201. package/web/app/immutable/chunks/{BcI-R0js.js → TskFxLe9.js} +1 -1
  202. package/web/app/immutable/chunks/{B7ZHl5_Y.js → UoGzAf2x.js} +1 -1
  203. package/web/app/immutable/chunks/{ClgzRlxs.js → Z1oQcFDn.js} +1 -1
  204. package/web/app/immutable/chunks/{D8NOVJ50.js → _1A-m7jq.js} +1 -1
  205. package/web/app/immutable/chunks/{BLyNH-U9.js → a9OghpUZ.js} +1 -1
  206. package/web/app/immutable/chunks/{CLkwa_R_.js → b8R7ytjh.js} +1 -1
  207. package/web/app/immutable/chunks/{Dr41JWYu.js → cHqVrdKP.js} +1 -1
  208. package/web/app/immutable/chunks/{BYevJ1Pj.js → d-ok7Yxa.js} +1 -1
  209. package/web/app/immutable/chunks/de735paS.js +1 -0
  210. package/web/app/immutable/chunks/{DSyGSHPH.js → fcbuovVV.js} +1 -1
  211. package/web/app/immutable/chunks/{CV9PEzoB.js → fsEhp3Sj.js} +1 -1
  212. package/web/app/immutable/chunks/{BS1nq856.js → hr4poPaj.js} +1 -1
  213. package/web/app/immutable/chunks/{DIYS_mcw.js → jnCaD4Bx.js} +1 -1
  214. package/web/app/immutable/chunks/{BL1pyapR.js → kUVtufTg.js} +1 -1
  215. package/web/app/immutable/chunks/{Cti1rV_x.js → kWExXPwX.js} +1 -1
  216. package/web/app/immutable/chunks/{CS74N62e.js → m9sL96bw.js} +1 -1
  217. package/web/app/immutable/chunks/{BX6Kopvz.js → nTZUlaQp.js} +1 -1
  218. package/web/app/immutable/chunks/{CwR0GP6W.js → opTS8jo1.js} +1 -1
  219. package/web/app/immutable/chunks/{DYlSkPA-.js → qj_I7waa.js} +1 -1
  220. package/web/app/immutable/chunks/{CHXEA9Fi.js → r5hLdwbG.js} +4 -4
  221. package/web/app/immutable/chunks/{CnodaVJ0.js → rnl2fV5A.js} +2 -2
  222. package/web/app/immutable/chunks/{Pb7J418u.js → udwlX3ME.js} +1 -1
  223. package/web/app/immutable/chunks/{DNOlba2e.js → vF7or5DB.js} +1 -1
  224. package/web/app/immutable/chunks/{DMKbkua9.js → wJdL3Qov.js} +1 -1
  225. package/web/app/immutable/chunks/wvJp1htg.js +2 -0
  226. package/web/app/immutable/chunks/{Ch8MPJbT.js → yU3kgZB6.js} +1 -1
  227. package/web/app/immutable/chunks/{CIOSdkrK.js → zP47CxCg.js} +1 -1
  228. package/web/app/immutable/chunks/{Uxor6krE.js → zaRHhPuE.js} +2 -2
  229. package/web/app/immutable/chunks/{BW4xwD_u.js → zpc-7Jr1.js} +1 -1
  230. package/web/app/immutable/entry/{app.rwgCwLre.js → app.Co-UnKY3.js} +3 -3
  231. package/web/app/immutable/entry/start.L8HMvb6x.js +1 -0
  232. package/web/app/immutable/nodes/{0.CAiwn7VU.js → 0.DNQpr_j7.js} +1 -1
  233. package/web/app/immutable/nodes/{1.4C-qOEjD.js → 1.hY0sxeHr.js} +1 -1
  234. package/web/app/immutable/nodes/{10.CSnI2pUC.js → 10.FFAOp7ps.js} +1 -1
  235. package/web/app/immutable/nodes/{11.DeNilyai.js → 11.CIaPPQvs.js} +1 -1
  236. package/web/app/immutable/nodes/{12.ySK4H8-2.js → 12.CO3XhA4p.js} +1 -1
  237. package/web/app/immutable/nodes/{13._q8cT7vQ.js → 13.x3qcbpU-.js} +3 -3
  238. package/web/app/immutable/nodes/{14.BVMi0m8a.js → 14.DRR_Z9jI.js} +3 -3
  239. package/web/app/immutable/nodes/{15.DZYm8wgy.js → 15.CQMgeYc5.js} +1 -1
  240. package/web/app/immutable/nodes/{16.2kka0tX2.js → 16.DGSRuzAc.js} +2 -2
  241. package/web/app/immutable/nodes/{2.BOqim1UO.js → 2.BfMkmqW-.js} +4 -4
  242. package/web/app/immutable/nodes/{3.rvoF1b9l.js → 3.DYbcbl8p.js} +1 -1
  243. package/web/app/immutable/nodes/{4.COWGFPUE.js → 4.BtnV0fM4.js} +1 -1
  244. package/web/app/immutable/nodes/{5.ClB4PiMc.js → 5.C4rvV3jr.js} +2 -2
  245. package/web/app/immutable/nodes/{6.B09HHXQ8.js → 6.cOtVQuzJ.js} +1 -1
  246. package/web/app/immutable/nodes/{7.ivApEpSz.js → 7.BS2-LdIc.js} +1 -1
  247. package/web/app/immutable/nodes/{8.BSIvYD1L.js → 8.C3ZiMMw0.js} +12 -12
  248. package/web/app/immutable/nodes/{9.C9K9J_Xm.js → 9.sLOao7gK.js} +5 -5
  249. package/web/app/version.json +1 -1
  250. package/web/generated/paraglide.js +49 -49
  251. package/web/index.html +18 -18
  252. package/web/app/immutable/chunks/B3iaLYr6.js +0 -1
  253. package/web/app/immutable/chunks/BLUkoS8T.js +0 -2
  254. package/web/app/immutable/chunks/CA0a6eNp.js +0 -1
  255. package/web/app/immutable/chunks/CPxyG9KJ.js +0 -271
  256. package/web/app/immutable/chunks/DHNO0898.js +0 -175
  257. package/web/app/immutable/chunks/DMkYHym4.js +0 -324
  258. package/web/app/immutable/chunks/DhLTyNrj.js +0 -1
  259. package/web/app/immutable/chunks/DsAKyTjw.js +0 -4
  260. package/web/app/immutable/chunks/DuQiXW7a.js +0 -1
  261. package/web/app/immutable/chunks/FAATYx56.js +0 -1
  262. package/web/app/immutable/chunks/ye8JXfxU.js +0 -1
  263. package/web/app/immutable/entry/start.CHX_XseY.js +0 -1
@@ -1,8 +1,8 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["/app/immutable/chunks/BZmsmL8P.js","/app/immutable/chunks/DYlSkPA-.js","/app/immutable/chunks/B3iaLYr6.js","/app/immutable/chunks/DYhIMPy1.js","/app/immutable/chunks/DEmaG7Ya.js","/app/immutable/chunks/UyBYtOpv.js","/app/immutable/assets/spinner.D_TRo5Hy.css","/app/immutable/chunks/CpELl9t1.js","/app/immutable/chunks/hUiIfi2t.js","/app/immutable/chunks/BaIAhI85.js","/app/immutable/chunks/Dj42fWMH.js","/app/immutable/chunks/CBRfvExq.js","/app/immutable/chunks/B9pexpLt.js","/app/immutable/chunks/BlOn95cv.js","/app/immutable/assets/button.-yaUNjRS.css","/app/immutable/chunks/6Rt8MvWn.js","/app/immutable/chunks/D0UrvUQM.js","/app/immutable/chunks/h8IoI-w7.js","/app/immutable/chunks/WFvSJ9zU.js","/app/immutable/chunks/ChTqQfQN.js","/app/immutable/chunks/D5B1sycf.js","/app/immutable/chunks/DfxQWSVU.js","/app/immutable/chunks/dUOQ5AaY.js","/app/immutable/chunks/BWYr8u9e.js","/app/immutable/assets/notify.BeL_JB6L.css","/app/immutable/chunks/DbHbiWFj.js","/app/immutable/chunks/CMiilI_P.js","/app/immutable/chunks/BM62R-OM.js","/app/immutable/chunks/CMMABWQi.js","/app/immutable/chunks/BvFAWM27.js","/app/immutable/chunks/BJzHxIyr.js","/app/immutable/chunks/CtO7SsM-.js","/app/immutable/chunks/DypB-Dwi.js","/app/immutable/chunks/ChLTaT6L.js"])))=>i.map(i=>d[i]);
2
- import{z as se,N as re,dC as O,cD as T,dm as oe,ak as ae,a$ as V,y as ie,dO as ue}from"./Cti1rV_x.js";import{_ as R,bo as S}from"./B3iaLYr6.js";import{uV as ce,AE as q,n4 as f,uX as le,BR as W,Hp as c,cA as de,cB as fe,n5 as G,mT as me,c as k,fA as pe,g as ge,lj as he,cI as Se}from"./h8IoI-w7.js";import{bU as ye}from"./DCPTVyDU.js";import{x as Ae,J as be,ai as we,ar as Me}from"./DmYZE-MO.js";import{a as B}from"./DypB-Dwi.js";import{v as Ie}from"./DLueLf8l.js";import{by as _e}from"./CpELl9t1.js";import{C as Ce}from"./BvFAWM27.js";import{q as ve,v as Te}from"./6Rt8MvWn.js";import{i as Re}from"./DQHfY0wY.js";function $e(e){try{return new URL(e.pageUrl).hostname||e.pageUrl}catch{return e.pageUrl}}function wt(e,t){return e.targetAgentId===t}function Mt(e){const t=e.element,n=e.viewport,s=$e(e),r=t?`<${t.tagName.toLowerCase()}> · ${s}`:e.title||s,o=["<browser-element-capture>",`Page URL: ${e.pageUrl}`,`Page title: ${e.title}`,...t?[`DOM path: ${t.domPath}`,`CSS selector: ${t.selector}`,`Text snippet: ${t.textSnippet}`,...t.sourceRef?[`Source ref: ${t.sourceRef}`]:[],...n?[`Viewport: ${n.width}×${n.height}`]:[],`Element bounds: ${t.rect.width}×${t.rect.height} at (${t.rect.x}, ${t.rect.y})`]:[],"</browser-element-capture>"].join(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["/app/immutable/chunks/CK7B4YgF.js","/app/immutable/chunks/qj_I7waa.js","/app/immutable/chunks/E2zwcBGL.js","/app/immutable/chunks/DYhIMPy1.js","/app/immutable/chunks/8mzXJxUW.js","/app/immutable/chunks/UyBYtOpv.js","/app/immutable/assets/spinner.D_TRo5Hy.css","/app/immutable/chunks/AXIAXE42.js","/app/immutable/chunks/BTNnUZgK.js","/app/immutable/chunks/BaIAhI85.js","/app/immutable/chunks/BAm6Imyt.js","/app/immutable/chunks/BqUqwkFB.js","/app/immutable/chunks/Cj4zs9c7.js","/app/immutable/chunks/BlOn95cv.js","/app/immutable/assets/button.-yaUNjRS.css","/app/immutable/chunks/Cvz2UPkQ.js","/app/immutable/chunks/C0GDF9vt.js","/app/immutable/chunks/DzNB7FSW.js","/app/immutable/chunks/WFvSJ9zU.js","/app/immutable/chunks/ChTqQfQN.js","/app/immutable/chunks/D5B1sycf.js","/app/immutable/chunks/DfxQWSVU.js","/app/immutable/chunks/C8iHXc33.js","/app/immutable/chunks/BWYr8u9e.js","/app/immutable/assets/notify.BeL_JB6L.css","/app/immutable/chunks/BuJ6T8t6.js","/app/immutable/chunks/CMiilI_P.js","/app/immutable/chunks/BZyiigVh.js","/app/immutable/chunks/BiLRO_7d.js","/app/immutable/chunks/BvFAWM27.js","/app/immutable/chunks/BJzHxIyr.js","/app/immutable/chunks/BEZid-wN.js","/app/immutable/chunks/DypB-Dwi.js","/app/immutable/chunks/CeJ1IeC2.js"])))=>i.map(i=>d[i]);
2
+ import{z as se,N as re,dC as O,cD as T,dm as oe,ak as ae,a$ as V,y as ie,dO as ue}from"./kWExXPwX.js";import{_ as R,bo as S}from"./E2zwcBGL.js";import{uV as ce,AE as q,n4 as f,uX as le,BR as W,Hp as c,cA as de,cB as fe,n5 as G,mT as me,c as k,fA as pe,g as ge,lj as he,cI as Se}from"./DzNB7FSW.js";import{bU as ye}from"./NYl-wMGf.js";import{x as Ae,J as be,ai as we,ar as Me}from"./IgS40dps.js";import{a as B}from"./DypB-Dwi.js";import{v as Ie}from"./DBctQLOE.js";import{by as _e}from"./AXIAXE42.js";import{C as Ce}from"./BvFAWM27.js";import{q as ve,v as Te}from"./Cvz2UPkQ.js";import{i as Re}from"./C_jLGOhH.js";function $e(e){try{return new URL(e.pageUrl).hostname||e.pageUrl}catch{return e.pageUrl}}function wt(e,t){return e.targetAgentId===t}function Mt(e){const t=e.element,n=e.viewport,s=$e(e),r=t?`<${t.tagName.toLowerCase()}> · ${s}`:e.title||s,o=["<browser-element-capture>",`Page URL: ${e.pageUrl}`,`Page title: ${e.title}`,...t?[`DOM path: ${t.domPath}`,`CSS selector: ${t.selector}`,`Text snippet: ${t.textSnippet}`,...t.sourceRef?[`Source ref: ${t.sourceRef}`]:[],...n?[`Viewport: ${n.width}×${n.height}`]:[],`Element bounds: ${t.rect.width}×${t.rect.height} at (${t.rect.x}, ${t.rect.y})`]:[],"</browser-element-capture>"].join(`
3
3
  `);return[{id:`${e.id}-image`,type:"file",label:r,imageData:e.image.data,imageMimeType:e.image.mimeType},{id:`${e.id}-context`,type:"selection",label:r,content:o}]}function Ee(e,t){const n=t.filter(s=>s.type==="selection").flatMap(s=>s.content?.trim()?[s.content.trim()]:[]);return[e.trim(),...n].filter(Boolean).join(`
4
4
  `)}function ke(e){const t=e.filter(s=>(s.imageData||s.attachmentId)&&s.imageMimeType).map(s=>s.attachmentId?{type:"image",attachmentId:s.attachmentId,...s.imageMimeType.includes("/")?{mimeType:s.imageMimeType}:{}}:{type:"image",data:s.imageData,mimeType:s.imageMimeType,...s.placementFileName?{placementFileName:s.placementFileName}:{}}),n=e.filter(s=>s.attachmentId&&!s.imageMimeType).map(s=>({type:"file",attachmentId:s.attachmentId,fileName:s.label,...s.attachmentMimeType?{mimeType:s.attachmentMimeType}:{},...s.attachmentSize!==void 0?{size:s.attachmentSize}:{}}));return{imageBlocks:t,fileBlocks:n}}function Le(e=[],t=[],n=[]){const s=[];for(const r of t)r.type==="file"&&r.filePath?s.push(`[Currently viewing file: ${r.filePath}]`):r.type==="diff"&&r.filePath?s.push(`[Currently viewing diff for: ${r.filePath}]`):r.type==="note"&&r.noteId?s.push(`[Currently viewing note: "${r.label}" (ID: ${r.noteId}). Read it with ws.note.read("${r.noteId}").]`):r.type==="spec"?s.push("[Currently viewing: Spec]"):r.type==="browser"&&r.browserUrl&&s.push(`[Currently viewing browser: ${r.browserUrl}]`);for(const r of n){const o=r.text.trim(),a=o.length>500?o.substring(0,500)+"...":o,i=r.sourceLabel?` from ${r.sourceLabel}`:"";s.push(`[Selected text${i}:
5
5
  \`\`\`
6
6
  ${a}
7
7
  \`\`\`]`)}return Ee(s.join(`
8
- `),e)}function It(e,t,n){if(e==="suggested-prompt")return{fields:{},hasAttachments:!1,cleanup:{clearInput:!1,followBottom:!0,historyText:null}};const s=n(),{imageBlocks:r,fileBlocks:o}=ke(s.contextItems);return{fields:{contextItems:s.contextItems,workspaceContextStr:Le(s.contextItems,s.checkedPanels,s.checkedSelections),noteIds:s.noteIds,...r.length>0?{imageBlocks:r}:{},...o.length>0?{fileBlocks:o}:{},...s.pickedMentions?{messageMetadata:s.pickedMentions}:{}},hasAttachments:r.length>0||o.length>0,cleanup:{clearInput:!0,followBottom:!0,historyText:t}}}function _t(e,t){if(e)return e.model}function xe({messages:e,pendingInitialPrompt:t,pendingContextReferenceCount:n=0}){return e.length>0||!!t||n>0}function Ct({session:e,messages:t,pendingInitialPrompt:n,pendingContextReferenceCount:s=0}){return!(e?se(e):!1)&&!xe({messages:t,pendingInitialPrompt:n,pendingContextReferenceCount:s})}function vt(e){return re(e.messageMetadata)}function He(e){return{id:e.id,appMessageId:e.appMessageId,role:"user",timestamp:new Date(e.createdAt??0).toISOString(),contentBlocks:[...e.content?[{type:"text",text:e.content}]:[],...e.imageBlocks??[],...e.fileBlocks??[]],metadata:e.messageMetadata,...e.author!==void 0?{author:e.author}:{}}}function Tt(e){return He({...e,createdAt:Date.parse(e.queuedAt)})}const Pe="chat-read:",y=new Map,$=new Set;function Rt(e,t){let n=y.get(e);n||(n=new Set,y.set(e,n)),n.add(t)}function $t(e,t){const n=y.get(e);if(!(!n||!n.delete(t))&&n.size===0){y.delete(e);for(const s of[...$])s(e)}}function Et(e){return $.add(e),()=>$.delete(e)}function kt(e){return y.has(e)}function Lt(e){const t=y.get(e);if(!t)return!1;for(const n of t)if(!n.startsWith(Pe))return!0;return!1}function De(e,t,n){const s=e.state.pendingSubmissions.byAgentId[t.agentId];if(!s||!q(s.scope,t))return null;const r={...structuredClone(n),id:crypto.randomUUID(),createdAt:Date.now()};e.dispatch(le(t,r));const o=e.state.pendingSubmissions.byAgentId[t.agentId];return o&&f(o.submissions,r.id)?r:null}function Oe(e,t,n,s,r){const o=O.select(e.state,n),a=T.select(e.state)?.principal.id,i=B(e.state);if(!o||!a||!i)return null;const u=Ae(t,n),l={agentId:t,workspaceId:n,principalId:a,participation:o,authority:i,owner:u.key,lifetime:e.state.pendingSubmissions.byAgentId[t]?.scope.lifetime??crypto.randomUUID()},m=()=>u.isCurrent(e.state.agentSessions?.byAgentId[t]?.workspaceId)&&O.select(e.state,n)===o&&T.select(e.state)?.principal.id===a&&B(e.state)===i;if(!m())return null;e.dispatch(ce(l,s,oe.select(e.state,n)));const d=De(e,l,r);return d?{scope:l,submission:d,isCurrent:()=>{const h=e.state.pendingSubmissions.byAgentId[t];return m()&&!!h&&q(h.scope,l)&&(!!f(h.operations,d.id)||!!f(h.submissions,d.id))}}:null}function E(e,t,n){if(!n.text.trim()&&!n.imageBlocks?.length&&!n.fileBlocks?.length)return null;const s=n.userAppMessageId??be();return Oe(e,t,n.wsId,T.select(e.state)?.capabilities.submissionCorrelation,{content:n.text.trim(),appMessageId:s,destination:!n.forceSubmit&&ae.select(e.state,t)?"queue":"conversation",contextItems:n.contextItems,imageBlocks:n.imageBlocks,fileBlocks:n.fileBlocks,messageMetadata:n.messageMetadata})}function Be(e,t,n){const s=E(e,t,n);return s?(e.dispatch(W(t,{...n,userAppMessageId:s.submission.appMessageId,submission:{scope:s.scope,id:s.submission.id}})),!0):!1}async function Ue(e,t,n,s){const r=n.submission;if(!r)return"legacy";const o=r.reference,a=()=>o.scope.agentId===e&&o.scope.workspaceId===t&&V.select(c.state,e)===n?ye.select(c.state,o.scope):void 0,i=a();if(!i)return null;if(!i.supported)return"legacy";const u={wsId:t,text:n.text,imageBlocks:n.options?.imageBlocks,fileBlocks:n.options?.fileBlocks,noteIds:n.options?.noteIds,messageMetadata:n.options?.messageMetadata,model:s??n.options?.model};if(r.outcome==="rejected"){const p=f(i.tombstones,o.id);return f(i.submissions,o.id)||p&&p.reason!=="rejected"?null:E(c,e,u)}if(r.outcome==="accepted")return E(c,e,u);await Promise.all([we(e,t).catch(()=>{}),Me(e,t).catch(()=>{})]);const l=a();if(!l||f(l.submissions,o.id)?.status!=="uncertain")return null;const{notify:m}=await R(async()=>{const{notify:p}=await import("./BZmsmL8P.js").then(ne=>ne.i);return{notify:p}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24]),import.meta.url);if(a()!==l)return null;let d=!1;const h=()=>{d=!0};return m.warning(S.agent_chatSend_uncertainRetry_description(),{key:`submission-retry:${t}:${e}:${o.id}`,duration:Number.POSITIVE_INFINITY,action:{label:S.agent_chatSend_resend_label(),onClick:()=>{if(d)return;d=!0;const p=a();!p||p.generation!==l.generation||p.submissions!==l.submissions||p.observationVersion!==l.observationVersion||f(p.submissions,o.id)?.status!=="uncertain"||Be(c,e,u)}},cancel:{label:S.chat_richInput_cancel_label(),onClick:h},onDismiss:h}),null}async function xt(e,t,n){const s=V.select(c.state,e),r=s?.submission?await Ue(e,t,s,n):"legacy";if(r){if(r==="legacy"){await c.dispatch(n===void 0?de(e,t):fe(e,t,n));return}!r.isCurrent()||!s||c.dispatch(W(e,{wsId:t,text:s.text,imageBlocks:s.options?.imageBlocks,fileBlocks:s.options?.fileBlocks,noteIds:s.options?.noteIds,messageMetadata:s.options?.messageMetadata,model:n??s.options?.model,userAppMessageId:r.submission.appMessageId,submission:{scope:r.scope,id:r.submission.id}}))}}const Ht=c.createSelector((e,t)=>{const n=f(e.chatDrafts.owners,t);return n?{restore:n.restore,saves:G(n.saves)}:void 0});function Ne(e,t){return t.workspaceId===e&&!t.retiredAt&&!t.pendingDeleteAt&&t.status!==k.Deleted&&!t.notificationsMuted&&pe(t)==="topLevel"}function Fe(e){const t=e.metadata?.pendingQuestionsMessageId;return typeof t=="string"&&t.length>0&&!Ie(e.metadata,t)?t:null}function Ve(e){return e.status===k.Error&&!ie(ue(e))}function Pt(e,t){return t.filter(n=>Ne(e,n)).flatMap(n=>{const s=me(n),r=Fe(n),o=n.status===k.Error;if(!s&&!r&&!o)return[];const a=s?.timestamp??(o?n.stopReasonTimestamp:void 0);return[{agentId:n.id,agentName:n.name,kind:s?.kind??(o?"failed":"question"),reason:s?.reason,timestamp:a&&Number.isFinite(Date.parse(a))?a:void 0,questionMessageId:r,canRetry:Ve(n)}]})}function Dt(e){return e.displayStatus==="failed"?"failed":e.displayStatus==="blocked"?"blocked":e.attention==="review_required"?"review":e.displayStatus==="needs_attention"?"question":e.activity==="agent_running"||e.displayStatus==="in_progress"?"running":e.scriptsRunning===!0?"scripts_running":e.backgroundTasksRunning===!0?"background_tasks_running":e.displayStatus==="pr_ready"?"pr_ready":e.displayStatus==="pr_merged"?"merged":e.displayStatus==="complete"?"complete":e.attention==="unread"?"unread":e.displayStatus==="pr_open"||e.displayStatus==="pr_queued"?e.displayStatus:"idle"}function Ot(e){const t=e.kind==="prs"?e.organization?.trim().toLowerCase():void 0;return{key:JSON.stringify([e.kind,e.workspaceId,t||null,[...new Set((t?[]:e.repositories).map(n=>JSON.stringify([n.key,n.owner,n.name])))].sort()]),hasGitHubRepositories:!!t||e.repositories.some(n=>!!n.owner),hasLocalRepositories:!t&&e.repositories.some(n=>!n.owner)}}function L(e){const t=_e(e);if(t?.kind!=="pr"||!Number.isSafeInteger(t.number)||t.number<=0)return null;const n=t.owner.toLowerCase(),s=t.repo.toLowerCase();return{owner:n,repo:s,number:t.number,id:`${n}/${s}#${t.number}`,url:`https://github.com/${n}/${s}/pull/${t.number}`}}function Bt(e,t,n,s){const r=e.filter(o=>s?s.includes(o.id):n?o.repositoryOwner?.toLowerCase()===n.toLowerCase():t.some(a=>a.owner?.toLowerCase()===o.repositoryOwner?.toLowerCase()&&a.name.toLowerCase()===o.repositoryName?.toLowerCase()));return[...new Map(r.flatMap(o=>[...(o.pullRequests??[]).map(a=>a.url),o.activePullRequest?.url,o.prUrl]).flatMap(o=>{const a=o?L(o):null;return a?[[a.id,{owner:a.owner,repo:a.repo,number:a.number}]]:[]})).values()].sort((o,a)=>`${o.owner}/${o.repo}#${o.number}`.localeCompare(`${a.owner}/${a.repo}#${a.number}`))}function Ut(e,t){const[n]=t;return t.length!==1||e.owner?.toLowerCase()!==n?.owner?.toLowerCase()||e.repo?.toLowerCase()!==n?.name.toLowerCase()}const Nt=c.createSelector(e=>e.homeIntegrations),Ft=c.createSelector(e=>{const t=e.homeIntegrations;return!t.linkedItems||!Object.keys(t.linkedItems).length?t:{...t,items:[...new Map([...Object.values(t.linkedItems),...t.items].map(n=>[n.id,n])).values()].sort((n,s)=>(s.updatedAt??"").localeCompare(n.updatedAt??""))}}),K=c.createSelector(e=>G(e.workspace.workspaces).flatMap(t=>[...(t.pullRequests??[]).map(n=>n.url),t.activePullRequest?.url,t.prUrl].filter(n=>!!n).map(n=>({url:L(n)?.url??n.replace(/\/$/,"").toLowerCase(),workspaceId:t.id,name:t.title||t.id})))),Vt=c.createSelector(e=>{const t=e.homeIntegrations.detail?.url,n=t?L(t)?.url??t.replace(/\/$/,"").toLowerCase():void 0;return K.select(e).find(s=>s.url===n)??null}),qt=c.createSelector(e=>K.select(e).map(t=>t.url));let I=null;function Wt(e){return I=e,()=>{I===e&&(I=null)}}function Gt(){return I}function Kt(e){return[...e.groups.length>0?e.groups.filter(n=>n.expanded).flatMap(n=>n.items):e.workspaces,...e.asideExpanded?e.aside:[]].map(n=>n.id)}function jt(e,t,n){if(e.length===0)return null;const s=t===null?-1:e.indexOf(t);return s===-1?e[0]:e[s+(n==="clockwise"?1:-1)]??null}let _=null;function zt(e){return _=e,()=>{_===e&&(_=null)}}function Yt(){return _}function Qt(e){return Te(e)}function qe(e){return ve(e)}function We(e,t){return!e||!t?!1:e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function M(e){if(e.length===0)return[];const t=[];let n=null;for(const s of e){const r=s.timestamp?typeof s.timestamp=="string"?new Date(s.timestamp):s.timestamp:new Date;(!n||!We(n.date,r))&&(n={date:r,label:qe(r),messages:[]},t.push(n)),n.messages.push(s)}return t}function Xt(e){const t=new Map;return e.map(({date:n})=>{const s=`${n.getFullYear()}-${n.getMonth()+1}-${n.getDate()}`,r=t.get(s)??0;return t.set(s,r+1),r===0?s:`${s}#${r}`})}function Jt(e,t){const n=new Map;let s=t?null:void 0;for(const[r,o]of e.groups.entries()){r===e.gapBeforeGroupIndex&&(s=void 0);for(const a of o.messages)s!==void 0&&n.set(a.id,s),a.role==="user"&&!Re(a)&&(s=a)}return n}function Ge(e){return`${e.getFullYear()}-${e.getMonth()+1}-${e.getDate()}`}function v(e,t){const n=new Map;return e.map(s=>{const r=`${t}-${Ge(s.date)}`,o=(n.get(r)??0)+1;return n.set(r,o),{...s,groupKey:o===1?r:`${r}-${o}`}})}function Ke(e,t){if(e.length===0||t.length===0)return e;const n=new Set(t.map(o=>o.id)),s=new Set(t.map(o=>o.appMessageId).filter(o=>typeof o=="string"&&o.length>0)),r=e.filter(o=>!n.has(o.id)&&!(typeof o.appMessageId=="string"&&o.appMessageId.length>0&&s.has(o.appMessageId)));return r.length===e.length?e:r}function Zt(e,t,n){if(e=Ke(e,t),e.length===0)return{groups:M(t),gapBeforeGroupIndex:null};if(!n)return{groups:v(M([...e,...t]),"d"),gapBeforeGroupIndex:null};const s=v(M(e),"h"),r=v(M(t),"t");return{groups:[...s,...r],gapBeforeGroupIndex:s.length}}function en(e){const{scrollTop:t,threshold:n,fetching:s,exhausted:r,historyCount:o,tailCount:a,tailTruncated:i,totalMessages:u,spacerAbove:l=0}=e;return t>n+l||s||r?!1:o>0||i||u>a+o}const tn=300;function nn(e){const{fetching:t,chainEvaluationPending:n,visible:s,hideArmed:r}=e;return t||n?s&&!r?"none":"show":s&&!r?"arm-hide":"none"}const U=24,je=320;function x(e){return Number.isFinite(e)?Math.min(je,Math.max(U,e)):U}const ze=.2,Ye=.12;function Qe(e,t,n=ze){const s=x(t);return e===null||!Number.isFinite(e)?s:e+n*(s-e)}function sn(e,t){const n=x(t??Number.NaN);return{above:Math.round(Math.max(0,e.above)*n),below:Math.round(Math.max(0,e.below)*n)}}function rn(e){const{totalMessages:t,residentCount:n,exhausted:s,residentContentHeight:r,currentSpacerHeight:o,viewportHeight:a}=e;let i=e.rowHeightEma;n>0&&r>0&&(i=Qe(i,r/n));const u=e.unloadedRows??t-n,m=s||t<=0||n<=0||u<=0||i===null?0:Math.round(u*i),d=Math.abs(m-o);return d===0?{spacerHeight:o,rowHeightEma:i,applied:!1,scrollTopDelta:0}:m===0||o===0||d>o*Ye||a>0&&d>a?{spacerHeight:m,rowHeightEma:i,applied:!0,scrollTopDelta:m-o}:{spacerHeight:o,rowHeightEma:i,applied:!1,scrollTopDelta:0}}const Xe=Ce,Je=2;function on(e){const{scrollTop:t,spacerAboveHeight:n,rowHeightEstimate:s,pageSize:r=Xe,nearPages:o=Je}=e;if(n<=0||t>=n)return"serial";const a=x(s??Number.NaN);return(n-Math.max(0,t))/a>o*r?"seek":"serial"}const j=200,Ze=1;function an(e,t,n=j){const s=t.timestamp-n;return[...e.filter(r=>r.timestamp>=s),t]}function un(e){const{samples:t,viewportHeight:n,windowMs:s=j,viewportFactor:r=Ze}=e;if(n<=0||t.length<2)return"gentle";const o=t[t.length-1].timestamp-s,a=t.filter(u=>u.timestamp>=o);if(a.length<2)return"gentle";let i=0;for(let u=1;u<a.length;u+=1)i+=Math.abs(a[u].scrollTop-a[u-1].scrollTop);return i>n*r?"rapid":"gentle"}function cn(e){const{scrollTop:t,spacerAboveHeight:n,unloadedRowsAbove:s}=e;if(s<=0||n<=0)return 0;const r=Math.min(1,Math.max(0,t/n));return Math.min(s-1,Math.max(0,Math.floor(r*s)))}function ln(e){const{totalMessages:t,residentCount:n,exhausted:s,startOrdinalEstimate:r,gapToTail:o}=e,a=Math.max(0,t-n);if(a===0)return{above:0,below:0};if(!o)return{above:s?0:a,below:0};if(s)return{above:0,below:a};if(r!==null){const u=Math.min(a,Math.max(0,Math.round(r)));return{above:u,below:a-u}}const i=Math.min(a,Math.max(0,Math.round(e.holeRowsEstimate??0)));return{above:a-i,below:i}}function dn(e){const{exhausted:t,historyCount:n,tailCount:s,tailTruncated:r,totalMessages:o}=e;return t?!0:n>0?!1:!r&&o<=s}const z=new Map;function Y(e,t){return`${e}\0${t}`}function fn(e,t){return z.get(Y(e,t))}function mn(e,t,n){z.set(Y(e,t),n)}const pn=c.createSelector((e,t,n)=>{const s=e.chatPanelUi.byWorkspaceId[t];return s?f(s.userMessageIndexes,n):void 0}),gn=c.createSelector((e,t,n)=>{const s=e.chatPanelUi.byWorkspaceId[t];return s?f(s.retryAgents,n):void 0});function et(e){e=Math.max(0,e);const t=Math.floor(e/1e3);if(t<10){const o=e/1e3,a=o.toFixed(1);return a.endsWith(".0")?`${Math.round(o)}s`:`${a}s`}if(t<60)return`${t}s`;const n=Math.floor(t/3600),s=Math.floor(t%3600/60),r=t%60;return n>0?`${n}h ${s}m ${r}s`:`${s}m ${r}s`}function hn(e){return et(Math.max(1e3,Math.round(e/1e3)*1e3))}const tt=new Set(["launch","init","session-create","session-load","prompt"]),nt=new Set(["tool-call","tool-waiting"]);function st(e){let t=null;for(const n of e)(!t||n.timestamp>=t.timestamp)&&(t=n);return t}function Sn(e){return e&&tt.has(e)?"pulse":e&&nt.has(e)?"twist":"bloom"}const Q="stalled";function yn(e,t){const n=st(e);return!n||n.phase!==Q||typeof t=="number"&&t>n.timestamp?null:n}function An(e){let t=null;for(const n of e)n.phase!==Q&&(!t||n.timestamp>=t.timestamp)&&(t=n);return t}const N={get title(){return S.chat_streamingStatus_sessionCorrupted_title()},get message(){return S.chat_streamingStatus_sessionCorrupted_message()}};function bn(e,t){return e?t===!0?{corrupted:!0,title:N.title,message:N.message,detail:e}:{corrupted:!1,title:S.chat_streamingStatus_responseFailed_label(),message:e,detail:null}:null}const wn=c.createSelector((e,t)=>e.unreadTracking.dividerSessionByAgentId[t]??null),Mn=c.createSelector(e=>e.unreadTracking.currentlyViewedAgentId),In=c.createSelector(e=>{const t=[];for(const o of Object.values(e.panelLayout.byWorkspaceId))for(const a of Object.values(o.panels))for(const i of a.tabs)i.type==="agent"&&i.agentId&&t.push(i.agentId);const n=Object.keys(e.unreadTracking.dividerSessionByAgentId),s=new Set(e.agentSessions.agentIdsByWorkspace[ge]??[]);return{chiefCardVisible:e.sidebarNav.panelItem==="chief",chiefSessionAgentIds:n.filter(o=>s.has(o)),dividerSessionAgentIds:n,openAgentTabIds:t}}),_n=c.createSelector((e,t)=>f(e.questionUi.consumers,t)),rt=3e4,b=new Map;function Cn(e,t){const n=b.get(e);n&&clearTimeout(n.timer);const s=setTimeout(()=>b.delete(e),rt);b.set(e,{value:t,timer:s})}function vn(e){const t=b.get(e);if(t)return clearTimeout(t.timer),b.delete(e),t.value}const X=c.createSelector((e,t,n)=>e.agentWorkers?.byKey[Se(t,n)]??he),ot=c.createSelector((e,t,n)=>{const s=X.select(e,t,n);return s.status==="unsupported"?[]:(s.snapshot?.workers??[]).filter(r=>r.status==="running"||r.status==="unknown")}),Tn=c.createSelector((e,t,n)=>{const s=X.select(e,t,n);return s.status==="failed"?!0:s.status!=="ready"||!s.snapshot?!1:s.snapshot.truncated?!0:s.snapshot.support.status!=="supported"&&ot.select(e,t,n).length>0}),at=1e3,J={requireViewedAndFocused:!0,requireAssistantTail:!0},w=new Map,g=new Map;let A=null;function H(e){(e===void 0||A===e)&&(A=null)}const it=200;function ut(e,t){if(g.delete(e),g.set(e,t),g.size>it){const n=g.keys().next().value;n!==void 0&&g.delete(n)}}function Z(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(!n.isStreaming&&typeof n.id=="string"&&n.id.length>0)return n}return null}function Rn(e){return Z(e)?.id??null}function $n(e){P(e,{requireViewedAndFocused:!0})}function En(e){P(e,{requireViewedAndFocused:!1})}function kn(e){H(),P(e,J)}function Ln(e){A===e&&(w.has(e)||(A=null,D(e,J)))}function xn(e){for(const t of e)typeof t!="string"||t.length===0||(ee(t),H(t),D(t,{requireViewedAndFocused:!1}))}function ee(e){const t=w.get(e);t&&(clearTimeout(t.timer),w.delete(e))}function P(e,t){ee(e),H(e);const n=setTimeout(()=>{w.delete(e),D(e,t)},at);w.set(e,{timer:n,gates:t})}let F=null;function ct(){return F??=Promise.all([R(()=>import("./DbHbiWFj.js"),__vite__mapDeps([25,17,18,3,19,20,13,5,8,2,11,26,27]),import.meta.url),R(()=>import("./CMMABWQi.js").then(e=>e.Z),__vite__mapDeps([28,29,2,3,17,18,19,20,13,5,8,11,7,4,6,9,10,12,14,30,31,32,33]),import.meta.url)]).then(([e,t])=>({appStore:e.store,appClient:t.appClient})),F}async function D(e,t){let n=null;try{const{appStore:s,appClient:r}=await ct(),o=s.state;if(t.requireViewedAndFocused&&(o.unreadTracking?.currentlyViewedAgentId!==e||typeof document<"u"&&!document.hasFocus()))return;const a=o.agentSessions?.byAgentId[e];if(!a)return;const i=typeof a.workspaceId=="string"?a.workspaceId:"";if(i.length===0)return;if(t.requireAssistantTail&&o.chatState?.byAgentId[e]?.initialHistoryPending){A=e;return}const u=Z(a.messages??[]);if(!u){t.requireAssistantTail&&(A=e);return}if(t.requireAssistantTail&&u.role!=="assistant")return;const l=u.id;if(g.get(e)===l)return;ut(e,l),n=l,!(await r.agents.markSeen({workspaceId:i,agentId:e,messageId:l})).success&&g.get(e)===n&&g.delete(e)}catch{n!==null&&g.get(e)===n&&g.delete(e)}}const C=new Map;function te(e,t){return`${e}\0${t}`}function Hn(e,t){return C.get(te(e,t))}function Pn(e,t,n){C.set(te(e,t),n)}function Dn(e){if(e.length===0)return;const t=new Set(e);for(const n of[...C.keys()]){const s=n.slice(n.indexOf("\0")+1);t.has(s)&&C.delete(n)}}export{rn as $,An as A,Sn as B,kt as C,Lt as D,Kt as E,Jt as F,dn as G,Pe as H,vt as I,cn as J,xn as K,Ln as L,at as M,$n as N,tn as O,En as P,kn as Q,j as R,Rn as S,nn as T,Et as U,U as V,He as W,It as X,Ue as Y,Tt as Z,zt as _,Rt as a,Wt as a0,$t as a1,H as a2,xt as a3,_t as a4,sn as a5,ot as a6,X as a7,Tn as a8,Ht as a9,Mn as aa,In as ab,wn as ac,Nt as ad,Vt as ae,Ft as af,qt as ag,K as ah,_n as ai,gn as aj,pn as ak,Pn as al,mn as am,en as an,Ut as ao,ln as ap,Cn as aq,jt as ar,Be as as,vn as at,E as b,an as c,wt as d,Mt as e,Xt as f,Le as g,Ct as h,un as i,on as j,Dn as k,Bt as l,Zt as m,bn as n,Ot as o,Ke as p,ke as q,hn as r,Qt as s,yn as t,Hn as u,fn as v,Yt as w,Pt as x,Gt as y,Dt as z};
8
+ `),e)}function It(e,t,n){if(e==="suggested-prompt")return{fields:{},hasAttachments:!1,cleanup:{clearInput:!1,followBottom:!0,historyText:null}};const s=n(),{imageBlocks:r,fileBlocks:o}=ke(s.contextItems);return{fields:{contextItems:s.contextItems,workspaceContextStr:Le(s.contextItems,s.checkedPanels,s.checkedSelections),noteIds:s.noteIds,...r.length>0?{imageBlocks:r}:{},...o.length>0?{fileBlocks:o}:{},...s.pickedMentions?{messageMetadata:s.pickedMentions}:{}},hasAttachments:r.length>0||o.length>0,cleanup:{clearInput:!0,followBottom:!0,historyText:t}}}function _t(e,t){if(e)return e.model}function xe({messages:e,pendingInitialPrompt:t,pendingContextReferenceCount:n=0}){return e.length>0||!!t||n>0}function Ct({session:e,messages:t,pendingInitialPrompt:n,pendingContextReferenceCount:s=0}){return!(e?se(e):!1)&&!xe({messages:t,pendingInitialPrompt:n,pendingContextReferenceCount:s})}function vt(e){return re(e.messageMetadata)}function He(e){return{id:e.id,appMessageId:e.appMessageId,role:"user",timestamp:new Date(e.createdAt??0).toISOString(),contentBlocks:[...e.content?[{type:"text",text:e.content}]:[],...e.imageBlocks??[],...e.fileBlocks??[]],metadata:e.messageMetadata,...e.author!==void 0?{author:e.author}:{}}}function Tt(e){return He({...e,createdAt:Date.parse(e.queuedAt)})}const Pe="chat-read:",y=new Map,$=new Set;function Rt(e,t){let n=y.get(e);n||(n=new Set,y.set(e,n)),n.add(t)}function $t(e,t){const n=y.get(e);if(!(!n||!n.delete(t))&&n.size===0){y.delete(e);for(const s of[...$])s(e)}}function Et(e){return $.add(e),()=>$.delete(e)}function kt(e){return y.has(e)}function Lt(e){const t=y.get(e);if(!t)return!1;for(const n of t)if(!n.startsWith(Pe))return!0;return!1}function De(e,t,n){const s=e.state.pendingSubmissions.byAgentId[t.agentId];if(!s||!q(s.scope,t))return null;const r={...structuredClone(n),id:crypto.randomUUID(),createdAt:Date.now()};e.dispatch(le(t,r));const o=e.state.pendingSubmissions.byAgentId[t.agentId];return o&&f(o.submissions,r.id)?r:null}function Oe(e,t,n,s,r){const o=O.select(e.state,n),a=T.select(e.state)?.principal.id,i=B(e.state);if(!o||!a||!i)return null;const u=Ae(t,n),l={agentId:t,workspaceId:n,principalId:a,participation:o,authority:i,owner:u.key,lifetime:e.state.pendingSubmissions.byAgentId[t]?.scope.lifetime??crypto.randomUUID()},m=()=>u.isCurrent(e.state.agentSessions?.byAgentId[t]?.workspaceId)&&O.select(e.state,n)===o&&T.select(e.state)?.principal.id===a&&B(e.state)===i;if(!m())return null;e.dispatch(ce(l,s,oe.select(e.state,n)));const d=De(e,l,r);return d?{scope:l,submission:d,isCurrent:()=>{const h=e.state.pendingSubmissions.byAgentId[t];return m()&&!!h&&q(h.scope,l)&&(!!f(h.operations,d.id)||!!f(h.submissions,d.id))}}:null}function E(e,t,n){if(!n.text.trim()&&!n.imageBlocks?.length&&!n.fileBlocks?.length)return null;const s=n.userAppMessageId??be();return Oe(e,t,n.wsId,T.select(e.state)?.capabilities.submissionCorrelation,{content:n.text.trim(),appMessageId:s,destination:!n.forceSubmit&&ae.select(e.state,t)?"queue":"conversation",contextItems:n.contextItems,imageBlocks:n.imageBlocks,fileBlocks:n.fileBlocks,messageMetadata:n.messageMetadata})}function Be(e,t,n){const s=E(e,t,n);return s?(e.dispatch(W(t,{...n,userAppMessageId:s.submission.appMessageId,submission:{scope:s.scope,id:s.submission.id}})),!0):!1}async function Ue(e,t,n,s){const r=n.submission;if(!r)return"legacy";const o=r.reference,a=()=>o.scope.agentId===e&&o.scope.workspaceId===t&&V.select(c.state,e)===n?ye.select(c.state,o.scope):void 0,i=a();if(!i)return null;if(!i.supported)return"legacy";const u={wsId:t,text:n.text,imageBlocks:n.options?.imageBlocks,fileBlocks:n.options?.fileBlocks,noteIds:n.options?.noteIds,messageMetadata:n.options?.messageMetadata,model:s??n.options?.model};if(r.outcome==="rejected"){const p=f(i.tombstones,o.id);return f(i.submissions,o.id)||p&&p.reason!=="rejected"?null:E(c,e,u)}if(r.outcome==="accepted")return E(c,e,u);await Promise.all([we(e,t).catch(()=>{}),Me(e,t).catch(()=>{})]);const l=a();if(!l||f(l.submissions,o.id)?.status!=="uncertain")return null;const{notify:m}=await R(async()=>{const{notify:p}=await import("./CK7B4YgF.js").then(ne=>ne.i);return{notify:p}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24]),import.meta.url);if(a()!==l)return null;let d=!1;const h=()=>{d=!0};return m.warning(S.agent_chatSend_uncertainRetry_description(),{key:`submission-retry:${t}:${e}:${o.id}`,duration:Number.POSITIVE_INFINITY,action:{label:S.agent_chatSend_resend_label(),onClick:()=>{if(d)return;d=!0;const p=a();!p||p.generation!==l.generation||p.submissions!==l.submissions||p.observationVersion!==l.observationVersion||f(p.submissions,o.id)?.status!=="uncertain"||Be(c,e,u)}},cancel:{label:S.chat_richInput_cancel_label(),onClick:h},onDismiss:h}),null}async function xt(e,t,n){const s=V.select(c.state,e),r=s?.submission?await Ue(e,t,s,n):"legacy";if(r){if(r==="legacy"){await c.dispatch(n===void 0?de(e,t):fe(e,t,n));return}!r.isCurrent()||!s||c.dispatch(W(e,{wsId:t,text:s.text,imageBlocks:s.options?.imageBlocks,fileBlocks:s.options?.fileBlocks,noteIds:s.options?.noteIds,messageMetadata:s.options?.messageMetadata,model:n??s.options?.model,userAppMessageId:r.submission.appMessageId,submission:{scope:r.scope,id:r.submission.id}}))}}const Ht=c.createSelector((e,t)=>{const n=f(e.chatDrafts.owners,t);return n?{restore:n.restore,saves:G(n.saves)}:void 0});function Ne(e,t){return t.workspaceId===e&&!t.retiredAt&&!t.pendingDeleteAt&&t.status!==k.Deleted&&!t.notificationsMuted&&pe(t)==="topLevel"}function Fe(e){const t=e.metadata?.pendingQuestionsMessageId;return typeof t=="string"&&t.length>0&&!Ie(e.metadata,t)?t:null}function Ve(e){return e.status===k.Error&&!ie(ue(e))}function Pt(e,t){return t.filter(n=>Ne(e,n)).flatMap(n=>{const s=me(n),r=Fe(n),o=n.status===k.Error;if(!s&&!r&&!o)return[];const a=s?.timestamp??(o?n.stopReasonTimestamp:void 0);return[{agentId:n.id,agentName:n.name,kind:s?.kind??(o?"failed":"question"),reason:s?.reason,timestamp:a&&Number.isFinite(Date.parse(a))?a:void 0,questionMessageId:r,canRetry:Ve(n)}]})}function Dt(e){return e.displayStatus==="failed"?"failed":e.displayStatus==="blocked"?"blocked":e.attention==="review_required"?"review":e.displayStatus==="needs_attention"?"question":e.activity==="agent_running"||e.displayStatus==="in_progress"?"running":e.scriptsRunning===!0?"scripts_running":e.backgroundTasksRunning===!0?"background_tasks_running":e.displayStatus==="pr_ready"?"pr_ready":e.displayStatus==="pr_merged"?"merged":e.displayStatus==="complete"?"complete":e.attention==="unread"?"unread":e.displayStatus==="pr_open"||e.displayStatus==="pr_queued"?e.displayStatus:"idle"}function Ot(e){const t=e.kind==="prs"?e.organization?.trim().toLowerCase():void 0;return{key:JSON.stringify([e.kind,e.workspaceId,t||null,[...new Set((t?[]:e.repositories).map(n=>JSON.stringify([n.key,n.owner,n.name])))].sort()]),hasGitHubRepositories:!!t||e.repositories.some(n=>!!n.owner),hasLocalRepositories:!t&&e.repositories.some(n=>!n.owner)}}function L(e){const t=_e(e);if(t?.kind!=="pr"||!Number.isSafeInteger(t.number)||t.number<=0)return null;const n=t.owner.toLowerCase(),s=t.repo.toLowerCase();return{owner:n,repo:s,number:t.number,id:`${n}/${s}#${t.number}`,url:`https://github.com/${n}/${s}/pull/${t.number}`}}function Bt(e,t,n,s){const r=e.filter(o=>s?s.includes(o.id):n?o.repositoryOwner?.toLowerCase()===n.toLowerCase():t.some(a=>a.owner?.toLowerCase()===o.repositoryOwner?.toLowerCase()&&a.name.toLowerCase()===o.repositoryName?.toLowerCase()));return[...new Map(r.flatMap(o=>[...(o.pullRequests??[]).map(a=>a.url),o.activePullRequest?.url,o.prUrl]).flatMap(o=>{const a=o?L(o):null;return a?[[a.id,{owner:a.owner,repo:a.repo,number:a.number}]]:[]})).values()].sort((o,a)=>`${o.owner}/${o.repo}#${o.number}`.localeCompare(`${a.owner}/${a.repo}#${a.number}`))}function Ut(e,t){const[n]=t;return t.length!==1||e.owner?.toLowerCase()!==n?.owner?.toLowerCase()||e.repo?.toLowerCase()!==n?.name.toLowerCase()}const Nt=c.createSelector(e=>e.homeIntegrations),Ft=c.createSelector(e=>{const t=e.homeIntegrations;return!t.linkedItems||!Object.keys(t.linkedItems).length?t:{...t,items:[...new Map([...Object.values(t.linkedItems),...t.items].map(n=>[n.id,n])).values()].sort((n,s)=>(s.updatedAt??"").localeCompare(n.updatedAt??""))}}),K=c.createSelector(e=>G(e.workspace.workspaces).flatMap(t=>[...(t.pullRequests??[]).map(n=>n.url),t.activePullRequest?.url,t.prUrl].filter(n=>!!n).map(n=>({url:L(n)?.url??n.replace(/\/$/,"").toLowerCase(),workspaceId:t.id,name:t.title||t.id})))),Vt=c.createSelector(e=>{const t=e.homeIntegrations.detail?.url,n=t?L(t)?.url??t.replace(/\/$/,"").toLowerCase():void 0;return K.select(e).find(s=>s.url===n)??null}),qt=c.createSelector(e=>K.select(e).map(t=>t.url));let I=null;function Wt(e){return I=e,()=>{I===e&&(I=null)}}function Gt(){return I}function Kt(e){return[...e.groups.length>0?e.groups.filter(n=>n.expanded).flatMap(n=>n.items):e.workspaces,...e.asideExpanded?e.aside:[]].map(n=>n.id)}function jt(e,t,n){if(e.length===0)return null;const s=t===null?-1:e.indexOf(t);return s===-1?e[0]:e[s+(n==="clockwise"?1:-1)]??null}let _=null;function zt(e){return _=e,()=>{_===e&&(_=null)}}function Yt(){return _}function Qt(e){return Te(e)}function qe(e){return ve(e)}function We(e,t){return!e||!t?!1:e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function M(e){if(e.length===0)return[];const t=[];let n=null;for(const s of e){const r=s.timestamp?typeof s.timestamp=="string"?new Date(s.timestamp):s.timestamp:new Date;(!n||!We(n.date,r))&&(n={date:r,label:qe(r),messages:[]},t.push(n)),n.messages.push(s)}return t}function Xt(e){const t=new Map;return e.map(({date:n})=>{const s=`${n.getFullYear()}-${n.getMonth()+1}-${n.getDate()}`,r=t.get(s)??0;return t.set(s,r+1),r===0?s:`${s}#${r}`})}function Jt(e,t){const n=new Map;let s=t?null:void 0;for(const[r,o]of e.groups.entries()){r===e.gapBeforeGroupIndex&&(s=void 0);for(const a of o.messages)s!==void 0&&n.set(a.id,s),a.role==="user"&&!Re(a)&&(s=a)}return n}function Ge(e){return`${e.getFullYear()}-${e.getMonth()+1}-${e.getDate()}`}function v(e,t){const n=new Map;return e.map(s=>{const r=`${t}-${Ge(s.date)}`,o=(n.get(r)??0)+1;return n.set(r,o),{...s,groupKey:o===1?r:`${r}-${o}`}})}function Ke(e,t){if(e.length===0||t.length===0)return e;const n=new Set(t.map(o=>o.id)),s=new Set(t.map(o=>o.appMessageId).filter(o=>typeof o=="string"&&o.length>0)),r=e.filter(o=>!n.has(o.id)&&!(typeof o.appMessageId=="string"&&o.appMessageId.length>0&&s.has(o.appMessageId)));return r.length===e.length?e:r}function Zt(e,t,n){if(e=Ke(e,t),e.length===0)return{groups:M(t),gapBeforeGroupIndex:null};if(!n)return{groups:v(M([...e,...t]),"d"),gapBeforeGroupIndex:null};const s=v(M(e),"h"),r=v(M(t),"t");return{groups:[...s,...r],gapBeforeGroupIndex:s.length}}function en(e){const{scrollTop:t,threshold:n,fetching:s,exhausted:r,historyCount:o,tailCount:a,tailTruncated:i,totalMessages:u,spacerAbove:l=0}=e;return t>n+l||s||r?!1:o>0||i||u>a+o}const tn=300;function nn(e){const{fetching:t,chainEvaluationPending:n,visible:s,hideArmed:r}=e;return t||n?s&&!r?"none":"show":s&&!r?"arm-hide":"none"}const U=24,je=320;function x(e){return Number.isFinite(e)?Math.min(je,Math.max(U,e)):U}const ze=.2,Ye=.12;function Qe(e,t,n=ze){const s=x(t);return e===null||!Number.isFinite(e)?s:e+n*(s-e)}function sn(e,t){const n=x(t??Number.NaN);return{above:Math.round(Math.max(0,e.above)*n),below:Math.round(Math.max(0,e.below)*n)}}function rn(e){const{totalMessages:t,residentCount:n,exhausted:s,residentContentHeight:r,currentSpacerHeight:o,viewportHeight:a}=e;let i=e.rowHeightEma;n>0&&r>0&&(i=Qe(i,r/n));const u=e.unloadedRows??t-n,m=s||t<=0||n<=0||u<=0||i===null?0:Math.round(u*i),d=Math.abs(m-o);return d===0?{spacerHeight:o,rowHeightEma:i,applied:!1,scrollTopDelta:0}:m===0||o===0||d>o*Ye||a>0&&d>a?{spacerHeight:m,rowHeightEma:i,applied:!0,scrollTopDelta:m-o}:{spacerHeight:o,rowHeightEma:i,applied:!1,scrollTopDelta:0}}const Xe=Ce,Je=2;function on(e){const{scrollTop:t,spacerAboveHeight:n,rowHeightEstimate:s,pageSize:r=Xe,nearPages:o=Je}=e;if(n<=0||t>=n)return"serial";const a=x(s??Number.NaN);return(n-Math.max(0,t))/a>o*r?"seek":"serial"}const j=200,Ze=1;function an(e,t,n=j){const s=t.timestamp-n;return[...e.filter(r=>r.timestamp>=s),t]}function un(e){const{samples:t,viewportHeight:n,windowMs:s=j,viewportFactor:r=Ze}=e;if(n<=0||t.length<2)return"gentle";const o=t[t.length-1].timestamp-s,a=t.filter(u=>u.timestamp>=o);if(a.length<2)return"gentle";let i=0;for(let u=1;u<a.length;u+=1)i+=Math.abs(a[u].scrollTop-a[u-1].scrollTop);return i>n*r?"rapid":"gentle"}function cn(e){const{scrollTop:t,spacerAboveHeight:n,unloadedRowsAbove:s}=e;if(s<=0||n<=0)return 0;const r=Math.min(1,Math.max(0,t/n));return Math.min(s-1,Math.max(0,Math.floor(r*s)))}function ln(e){const{totalMessages:t,residentCount:n,exhausted:s,startOrdinalEstimate:r,gapToTail:o}=e,a=Math.max(0,t-n);if(a===0)return{above:0,below:0};if(!o)return{above:s?0:a,below:0};if(s)return{above:0,below:a};if(r!==null){const u=Math.min(a,Math.max(0,Math.round(r)));return{above:u,below:a-u}}const i=Math.min(a,Math.max(0,Math.round(e.holeRowsEstimate??0)));return{above:a-i,below:i}}function dn(e){const{exhausted:t,historyCount:n,tailCount:s,tailTruncated:r,totalMessages:o}=e;return t?!0:n>0?!1:!r&&o<=s}const z=new Map;function Y(e,t){return`${e}\0${t}`}function fn(e,t){return z.get(Y(e,t))}function mn(e,t,n){z.set(Y(e,t),n)}const pn=c.createSelector((e,t,n)=>{const s=e.chatPanelUi.byWorkspaceId[t];return s?f(s.userMessageIndexes,n):void 0}),gn=c.createSelector((e,t,n)=>{const s=e.chatPanelUi.byWorkspaceId[t];return s?f(s.retryAgents,n):void 0});function et(e){e=Math.max(0,e);const t=Math.floor(e/1e3);if(t<10){const o=e/1e3,a=o.toFixed(1);return a.endsWith(".0")?`${Math.round(o)}s`:`${a}s`}if(t<60)return`${t}s`;const n=Math.floor(t/3600),s=Math.floor(t%3600/60),r=t%60;return n>0?`${n}h ${s}m ${r}s`:`${s}m ${r}s`}function hn(e){return et(Math.max(1e3,Math.round(e/1e3)*1e3))}const tt=new Set(["launch","init","session-create","session-load","prompt"]),nt=new Set(["tool-call","tool-waiting"]);function st(e){let t=null;for(const n of e)(!t||n.timestamp>=t.timestamp)&&(t=n);return t}function Sn(e){return e&&tt.has(e)?"pulse":e&&nt.has(e)?"twist":"bloom"}const Q="stalled";function yn(e,t){const n=st(e);return!n||n.phase!==Q||typeof t=="number"&&t>n.timestamp?null:n}function An(e){let t=null;for(const n of e)n.phase!==Q&&(!t||n.timestamp>=t.timestamp)&&(t=n);return t}const N={get title(){return S.chat_streamingStatus_sessionCorrupted_title()},get message(){return S.chat_streamingStatus_sessionCorrupted_message()}};function bn(e,t){return e?t===!0?{corrupted:!0,title:N.title,message:N.message,detail:e}:{corrupted:!1,title:S.chat_streamingStatus_responseFailed_label(),message:e,detail:null}:null}const wn=c.createSelector((e,t)=>e.unreadTracking.dividerSessionByAgentId[t]??null),Mn=c.createSelector(e=>e.unreadTracking.currentlyViewedAgentId),In=c.createSelector(e=>{const t=[];for(const o of Object.values(e.panelLayout.byWorkspaceId))for(const a of Object.values(o.panels))for(const i of a.tabs)i.type==="agent"&&i.agentId&&t.push(i.agentId);const n=Object.keys(e.unreadTracking.dividerSessionByAgentId),s=new Set(e.agentSessions.agentIdsByWorkspace[ge]??[]);return{chiefCardVisible:e.sidebarNav.panelItem==="chief",chiefSessionAgentIds:n.filter(o=>s.has(o)),dividerSessionAgentIds:n,openAgentTabIds:t}}),_n=c.createSelector((e,t)=>f(e.questionUi.consumers,t)),rt=3e4,b=new Map;function Cn(e,t){const n=b.get(e);n&&clearTimeout(n.timer);const s=setTimeout(()=>b.delete(e),rt);b.set(e,{value:t,timer:s})}function vn(e){const t=b.get(e);if(t)return clearTimeout(t.timer),b.delete(e),t.value}const X=c.createSelector((e,t,n)=>e.agentWorkers?.byKey[Se(t,n)]??he),ot=c.createSelector((e,t,n)=>{const s=X.select(e,t,n);return s.status==="unsupported"?[]:(s.snapshot?.workers??[]).filter(r=>r.status==="running"||r.status==="unknown")}),Tn=c.createSelector((e,t,n)=>{const s=X.select(e,t,n);return s.status==="failed"?!0:s.status!=="ready"||!s.snapshot?!1:s.snapshot.truncated?!0:s.snapshot.support.status!=="supported"&&ot.select(e,t,n).length>0}),at=1e3,J={requireViewedAndFocused:!0,requireAssistantTail:!0},w=new Map,g=new Map;let A=null;function H(e){(e===void 0||A===e)&&(A=null)}const it=200;function ut(e,t){if(g.delete(e),g.set(e,t),g.size>it){const n=g.keys().next().value;n!==void 0&&g.delete(n)}}function Z(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(!n.isStreaming&&typeof n.id=="string"&&n.id.length>0)return n}return null}function Rn(e){return Z(e)?.id??null}function $n(e){P(e,{requireViewedAndFocused:!0})}function En(e){P(e,{requireViewedAndFocused:!1})}function kn(e){H(),P(e,J)}function Ln(e){A===e&&(w.has(e)||(A=null,D(e,J)))}function xn(e){for(const t of e)typeof t!="string"||t.length===0||(ee(t),H(t),D(t,{requireViewedAndFocused:!1}))}function ee(e){const t=w.get(e);t&&(clearTimeout(t.timer),w.delete(e))}function P(e,t){ee(e),H(e);const n=setTimeout(()=>{w.delete(e),D(e,t)},at);w.set(e,{timer:n,gates:t})}let F=null;function ct(){return F??=Promise.all([R(()=>import("./BuJ6T8t6.js"),__vite__mapDeps([25,17,18,3,19,20,13,5,8,2,11,26,27]),import.meta.url),R(()=>import("./BiLRO_7d.js").then(e=>e.Z),__vite__mapDeps([28,29,2,3,17,18,19,20,13,5,8,11,7,4,6,9,10,12,14,30,31,32,33]),import.meta.url)]).then(([e,t])=>({appStore:e.store,appClient:t.appClient})),F}async function D(e,t){let n=null;try{const{appStore:s,appClient:r}=await ct(),o=s.state;if(t.requireViewedAndFocused&&(o.unreadTracking?.currentlyViewedAgentId!==e||typeof document<"u"&&!document.hasFocus()))return;const a=o.agentSessions?.byAgentId[e];if(!a)return;const i=typeof a.workspaceId=="string"?a.workspaceId:"";if(i.length===0)return;if(t.requireAssistantTail&&o.chatState?.byAgentId[e]?.initialHistoryPending){A=e;return}const u=Z(a.messages??[]);if(!u){t.requireAssistantTail&&(A=e);return}if(t.requireAssistantTail&&u.role!=="assistant")return;const l=u.id;if(g.get(e)===l)return;ut(e,l),n=l,!(await r.agents.markSeen({workspaceId:i,agentId:e,messageId:l})).success&&g.get(e)===n&&g.delete(e)}catch{n!==null&&g.get(e)===n&&g.delete(e)}}const C=new Map;function te(e,t){return`${e}\0${t}`}function Hn(e,t){return C.get(te(e,t))}function Pn(e,t,n){C.set(te(e,t),n)}function Dn(e){if(e.length===0)return;const t=new Set(e);for(const n of[...C.keys()]){const s=n.slice(n.indexOf("\0")+1);t.has(s)&&C.delete(n)}}export{rn as $,An as A,Sn as B,kt as C,Lt as D,Kt as E,Jt as F,dn as G,Pe as H,vt as I,cn as J,xn as K,Ln as L,at as M,$n as N,tn as O,En as P,kn as Q,j as R,Rn as S,nn as T,Et as U,U as V,He as W,It as X,Ue as Y,Tt as Z,zt as _,Rt as a,Wt as a0,$t as a1,H as a2,xt as a3,_t as a4,sn as a5,ot as a6,X as a7,Tn as a8,Ht as a9,Mn as aa,In as ab,wn as ac,Nt as ad,Vt as ae,Ft as af,qt as ag,K as ah,_n as ai,gn as aj,pn as ak,Pn as al,mn as am,en as an,Ut as ao,ln as ap,Cn as aq,jt as ar,Be as as,vn as at,E as b,an as c,wt as d,Mt as e,Xt as f,Le as g,Ct as h,un as i,on as j,Dn as k,Bt as l,Zt as m,bn as n,Ot as o,Ke as p,ke as q,hn as r,Qt as s,yn as t,Hn as u,fn as v,Yt as w,Pt as x,Gt as y,Dt as z};
@@ -1 +1 @@
1
- import{aR as q,aP as z,b4 as Q,a0 as Z}from"./DYhIMPy1.js";import{B as J}from"./B3iaLYr6.js";import{s as i,o as E,c as u,_ as T,n as w,l as h,u as ee,r as te,e as U,b as y,d as oe}from"./UyBYtOpv.js";const se=Symbol("NaN");function we(e,t,s){q&&z();var o=new J(e),n=!Q();Z(()=>{var a=t();a!==a&&(a=se),n&&a!==null&&typeof a=="object"&&(a={}),o.ensure(a,s)})}const ne="0.0.0-browser";function ae(e){const t=e?.electronAPI;return!t||t.versions?.electron===ne?"web":"electron"}function H(){return typeof window>"u"?"web":ae(window)}function ke(){return H()==="electron"}function re(e){const t=e==="electron";return{windowChrome:t,nativeDialogs:t,shellIntegration:t,externalEditors:t,browserPanel:t,autoUpdate:t,deeplinks:t,nativeNotifications:t,ssh:t}}function ie(){return re(H())}function Ge(e){return ie()[e]}const Pe={DEV_CONSOLE:{OPEN:"dev-console:open",CONNECT:"dev-console:connect",READ:"dev-console:read",RECORD:"dev-console:record",CLEAR:"dev-console:clear",SELECT:"dev-console:select",LINKS_STATUS:"dev-console:links-status",LINKS_START:"dev-console:links-start",LINKS_STOP:"dev-console:links-stop",LINKS_READ:"dev-console:links-read",LINKS_RECORD:"dev-console:links-record"},WORKSPACE:{LIST:"workspace:list",CREATE:"workspace:create",GET:"workspace:get",GET_CURRENT:"workspace:get-current",GET_BY_ID:"workspace:get-by-id",GET_ROOT:"workspace:get-root",OPEN:"workspace:open",CLOSE:"workspace:close",SAVE:"workspace:save",UPDATE:"workspace:update",DELETE:"workspace:delete",ACTIVATE:"workspace:activate",ARCHIVE:"workspace:archive",UNARCHIVE:"workspace:unarchive",CLEANUP:"workspace:cleanup",RENAME:"workspace:rename",EXPORT:"workspace:export",IMPORT:"workspace:import",GET_METADATA:"workspace:get-metadata",UPDATE_METADATA:"workspace:update-metadata",GET_RECENT:"workspace:get-recent",CLEAR_RECENT:"workspace:clear-recent",GET_STATS:"workspace:get-stats",VALIDATE:"workspace:validate",REPAIR:"workspace:repair",BACKUP:"workspace:backup",RESTORE:"workspace:restore",GET_SETTINGS:"workspace:get-settings",UPDATE_SETTINGS:"workspace:update-settings",TRIGGER_CHECK:"workspace:trigger-check",LIST_FILES:"workspace:list-files",TEST_WATCHER:"workspace:test-watcher",FIND_REPOSITORIES:"workspace:find-repositories",UPDATE_SPEC_WATCHER_TIMESTAMP:"workspace:update-spec-watcher-timestamp",UPDATE_CURRENT_CONTEXT:"workspace:update-current-context",SEARCH_IN_FILES:"workspace:search-in-files",GET_RECENT_REPOSITORIES:"workspace:get-recent-repositories",ADD_RECENT_REPOSITORY:"workspace:add-recent-repository",CLEAR_RECENT_REPOSITORIES:"workspace:clear-recent-repositories",REMOVE_RECENT_REPOSITORY:"workspace:remove-recent-repository",UPDATE_GIT_INFO:"workspace:update_git_info",GET_SETTINGS_ALT:"workspace:getSettings",UPDATE_SETTINGS_ALT:"workspace:updateSettings",LOAD_RULES:"workspace:load-rules",RENAME_BRANCH:"workspace:rename-branch",GET_HOVER_STATUS:"workspace:get-hover-status",GET_DIFF_SUMMARY:"workspace:get-diff-summary",GET_GIT_SUMMARY:"workspace:get-git-summary",GET_TASKS:"workspace:get-tasks"},AGENT:{LOAD_INITIAL_CONFIG:"agent:load-initial-config",AVAILABLE:"agent:available",RESUME:"agent:resume",CLEANUP:"agent:cleanup",GET_USER_RULES:"agent:get-user-rules",GET_SPECIALIZATION_RULES:"agent:get-specialization-rules",TRACK_STARTED:"agent:track-started",TRACK_COMPLETED:"agent:track-completed",TRACK_ERROR:"agent:track-error",CREATE:"agent:create",CIRCUIT_BREAKER_RESET:"agent:circuit-breaker:reset",SEND_MESSAGE:"agent:send-message",STOP:"agent:stop",SEND:"agent:send",GET_SESSION:"agent:get-session",LIST_SESSIONS:"agent:list-sessions",DELETE_SESSION:"agent:delete-session",RENAME:"agent:rename",SET_PRIORITY:"agent:set-priority",SUBSCRIBE_UPDATES:"agent:subscribe-updates",UNSUBSCRIBE_UPDATES:"agent:unsubscribe-updates",GET_SUGGESTIONS:"agent:get-suggestions",APPLY_SUGGESTION:"agent:apply-suggestion",GET_COMPLETIONS:"agent:get-completions",VALIDATE_INPUT:"agent:validate-input",FORMAT_OUTPUT:"agent:format-output",GET_SHORTCUTS:"agent:get-shortcuts",ADD_SHORTCUT:"agent:add-shortcut",REMOVE_SHORTCUT:"agent:remove-shortcut",EXECUTE_SHORTCUT:"agent:execute-shortcut",GET_PLUGINS:"agent:get-plugins",INSTALL_PLUGIN:"agent:install-plugin",UNINSTALL_PLUGIN:"agent:uninstall-plugin",ENABLE_PLUGIN:"agent:enable-plugin",DISABLE_PLUGIN:"agent:disable-plugin",GET_PLUGIN_SETTINGS:"agent:get-plugin-settings",UPDATE_PLUGIN_SETTINGS:"agent:update-plugin-settings",EXECUTE_PLUGIN_ACTION:"agent:execute-plugin-action",GET_WEBHOOKS:"agent:get-webhooks",ADD_WEBHOOK:"agent:add-webhook",REMOVE_WEBHOOK:"agent:remove-webhook",TEST_WEBHOOK:"agent:test-webhook",GET_INTEGRATIONS:"agent:get-integrations",CONNECT_INTEGRATION:"agent:connect-integration",DISCONNECT_INTEGRATION:"agent:disconnect-integration",SYNC_INTEGRATION:"agent:sync-integration",GET_INTEGRATION_STATUS:"agent:get-integration-status",GET_INTEGRATION_DATA:"agent:get-integration-data",UPDATE_INTEGRATION_SETTINGS:"agent:update-integration-settings",TEST_INTEGRATION:"agent:test-integration",GET_WORKFLOWS:"agent:get-workflows",CREATE_WORKFLOW:"agent:create-workflow",UPDATE_WORKFLOW:"agent:update-workflow",DELETE_WORKFLOW:"agent:delete-workflow",EXECUTE_WORKFLOW:"agent:execute-workflow",PAUSE_WORKFLOW:"agent:pause-workflow",RESUME_WORKFLOW:"agent:resume-workflow",CANCEL_WORKFLOW:"agent:cancel-workflow",GET_WORKFLOW_STATUS:"agent:get-workflow-status",GET_WORKFLOW_HISTORY:"agent:get-workflow-history",EXPORT_WORKFLOW:"agent:export-workflow",IMPORT_WORKFLOW:"agent:import-workflow",VALIDATE_WORKFLOW:"agent:validate-workflow",OPTIMIZE_WORKFLOW:"agent:optimize-workflow",GET_WORKFLOW_METRICS:"agent:get-workflow-metrics",GET_WORKFLOW_LOGS:"agent:get-workflow-logs",CLEAR_WORKFLOW_LOGS:"agent:clear-workflow-logs",SCHEDULE_WORKFLOW:"agent:schedule-workflow",UNSCHEDULE_WORKFLOW:"agent:unschedule-workflow",GET_SCHEDULED_WORKFLOWS:"agent:get-scheduled-workflows",GET_WORKFLOW_TRIGGERS:"agent:get-workflow-triggers",ADD_WORKFLOW_TRIGGER:"agent:add-workflow-trigger",REMOVE_WORKFLOW_TRIGGER:"agent:remove-workflow-trigger",TEST_WORKFLOW_TRIGGER:"agent:test-workflow-trigger",GET_WORKFLOW_VARIABLES:"agent:get-workflow-variables",SET_WORKFLOW_VARIABLES:"agent:set-workflow-variables",GET_WORKFLOW_DEPENDENCIES:"agent:get-workflow-dependencies",RESOLVE_WORKFLOW_DEPENDENCIES:"agent:resolve-workflow-dependencies",GET_WORKFLOW_PERMISSIONS:"agent:get-workflow-permissions",SET_WORKFLOW_PERMISSIONS:"agent:set-workflow-permissions",SHARE_WORKFLOW:"agent:share-workflow",UNSHARE_WORKFLOW:"agent:unshare-workflow",CLONE_WORKFLOW:"agent:clone-workflow",MERGE_WORKFLOWS:"agent:merge-workflows",DIFF_WORKFLOWS:"agent:diff-workflows",GET_WORKFLOW_VERSIONS:"agent:get-workflow-versions",RESTORE_WORKFLOW_VERSION:"agent:restore-workflow-version",TAG_WORKFLOW_VERSION:"agent:tag-workflow-version",GET_WORKFLOW_TAGS:"agent:get-workflow-tags",REMOVE_WORKFLOW_TAG:"agent:remove-workflow-tag",SET_MODEL:"agent:set-model"},EVENTS:{QUERY:"events:query",SUBSCRIBE:"events:subscribe",UNSUBSCRIBE:"events:unsubscribe",EMIT:"events:emit",GET_LAST_EVENT:"events:getLastEvent",GET_STATISTICS:"events:getStatistics",GET_AGENT_SUBSCRIPTIONS:"events:get-agent-subscriptions",UNSUBSCRIBE_AGENT:"events:unsubscribe-agent"},AUGGIE:{INSTALL:"auggie:install",AUTHENTICATE:"auggie:authenticate",GET_MODELS:"auggie:get-models",GET_CONFIG:"auggie:get-config",UPDATE_CONFIG:"auggie:update-config",GET_LATEST_SESSION:"auggie:get-latest-session",EXTRACT_FILE_CHANGES:"auggie:extract-file-changes",GET_PATH:"auggie:get-path",GET_USER_INFO:"auggie:get-user-info",UNINSTALL_MCP_CLAUDE_CODE:"auggie:uninstall-mcp-claude-code",UNINSTALL_MCP_CODEX:"auggie:uninstall-mcp-codex",UNINSTALL_MCP_OPENCODE:"auggie:uninstall-mcp-opencode",UNINSTALL_MCP_CORTEX:"auggie:uninstall-mcp-cortex",UNINSTALL_MCP_PI:"auggie:uninstall-mcp-pi",UNINSTALL_MCP_DROID:"auggie:uninstall-mcp-droid"},OPENCODE:{GET_MODELS:"opencode:get-models"},CLAUDE_CODE:{GET_MODELS:"claude-code:get-models"},CODEX:{GET_MODELS:"codex:get-models"},CORTEX:{GET_MODELS:"cortex:get-models"},PI:{GET_MODELS:"pi:get-models"},DROID:{GET_MODELS:"droid:get-models"},GROK:{GET_MODELS:"grok:get-models"},UNSLOTH:{GET_MODELS:"unsloth:get-models"},ANTIGRAVITY:{GET_MODELS:"antigravity:get-models"},PROVIDERS:{GET_AVAILABILITY:"providers:get-availability",PREPARE_ADAPTERS:"providers:prepare-adapters",GET_PATHS:"providers:get-paths",CHECK_SINGLE:"providers:check-single"},FILE:{READ:"file:read",READ_CHUNK:"file:read-chunk",HASH:"file:hash",WRITE:"file:write",DELETE:"file:delete",EXISTS:"file:exists",LIST:"file:list",COPY:"file:copy",MOVE:"file:move",GET_INFO:"file:get-info",READ_DIR_WITH_STATS:"file:readDirWithStats",GET_GITIGNORE_PATTERNS:"file:getGitignorePatterns",READ_BATCH:"file:read-batch",MKDIR:"file:mkdir",GET_GIT_STATUS:"file:getGitStatus",GET_TREE_WITH_SIZES:"file:getTreeWithSizes",GET_DIRECTORY_STATUS:"file:getDirectoryStatus",DOWNLOAD:"file:download",DOWNLOAD_ATTACHMENT:"file:download-attachment"},PRIMITIVES:{CODEBASE_SEARCH:"codebase:search",TERMINAL_RUN:"terminal:runCommand",TERMINAL_KILL:"terminal:killProcess",TERMINAL_SUBSCRIBE:"terminal:subscribeOutput",AGENT_RUN:"agent:runAction"},SYSTEM:{GET_INFO:"system:get-info",GET_RESOURCES:"system:get-resources",OPEN_EXTERNAL:"system:open-external",SHOW_ITEM_IN_FOLDER:"system:show-item-in-folder",WRITE_CLIPBOARD:"system:write-clipboard",BEEP:"system:beep",HOME_DIRECTORY:"system:home-directory",EXECUTE_COMMAND:"system:execute-command",EXECUTE_COMMAND_STREAMING:"system:execute-command-streaming",CHECK_GIT:"system:check-git",CHECK_NODE:"system:check-node",CHECK_GH:"system:check-gh",CHECK_RTK:"system:check-rtk",LIST_FONTS:"system:list-fonts"},APP:{SET_BADGE:"app:set-badge",SET_LANGUAGE_PREFERENCE:"app:set-language-preference",VERSION:"app:version",GET_VERSION:"app:get-version",NAME:"app:name",PATH:"app:path",ROOT:"app:root",UI_NAVIGATE:"app:ui:navigate",UI_HIGHLIGHT:"app:ui:highlight",HISTORY_NAVIGATE:"app:history-navigate"},QUIT_CONFIRMATION:{SHOW:"quit-confirmation:show",ACK:"quit-confirmation:ack",RESPONSE:"quit-confirmation:response",DISMISS:"quit-confirmation:dismiss"},COLLABORATION_AUTH:{POLICY:"collaboration-auth:policy",OPEN:"collaboration-auth:open",SHOW:"collaboration-auth:show",ACTION:"collaboration-auth:action",DISMISS:"collaboration-auth:dismiss"},INVITE_CONSENT:{SHOW:"invite-consent:show",ACK:"invite-consent:ack",RESPONSE:"invite-consent:response",DISMISS:"invite-consent:dismiss"},INVITE_PROGRESS:{SHOW:"invite-progress:show",UPDATE:"invite-progress:update",ACK:"invite-progress:ack",RESPONSE:"invite-progress:response",DISMISS:"invite-progress:dismiss"},INVITE_NOTICE:{SHOW:"invite-notice:show",ACK:"invite-notice:ack",RESPONSE:"invite-notice:response",DISMISS:"invite-notice:dismiss"},WINDOW:{RELOAD:"window:reload",TOGGLE_DEVTOOLS:"window:toggle-devtools",MINIMIZE:"window:minimize",MAXIMIZE:"window:maximize",CLOSE:"window:close",CREATE:"window:create",OPEN_NEW:"window:open-new",SET_THEME:"window:set-theme",SET_TRANSLUCENCY:"window:set-translucency",GET_ZOOM_FACTOR:"window:get-zoom-factor",SET_TITLE:"window:set-title",SET_IN_WORKSPACE:"window:set-in-workspace",SET_OPEN_WORKSPACE_TABS:"window:set-open-workspace-tabs",SET_BROWSER_FOCUSED:"window:set-browser-focused",SET_FULL_SCREEN:"window:set-full-screen",GET_FULL_SCREEN:"window:get-full-screen",SET_DOCK_POINTER_REGION:"window:set-dock-pointer-region",FOCUS_DOCK:"window:focus-dock",GET_DOCK_PLACEMENT:"window:get-dock-placement",UPDATE_DOCK_PLACEMENT:"window:update-dock-placement",SHOW_DOCK_MENU:"window:show-dock-menu",SWITCH_DOCK_BACKEND:"window:switch-dock-backend",DOCK_BACKEND_SWITCH_FAILED:"window:dock-backend-switch-failed",DOCK_PLACEMENT_CHANGED:"window:dock-placement-changed",DOCK_POINTER_PRESENCE_CHANGED:"window:dock-pointer-presence-changed",DOCK_RENDERER_READY:"window:dock-renderer-ready",GET_DOCK_LAB:"window:get-dock-lab",SET_DOCK_LAB:"window:set-dock-lab",DOCK_LAB_CHANGED:"window:dock-lab-changed",CYCLE_FOCUS:"window:cycle-focus"},DOCK_EVIDENCE:{BEGIN:"dock-evidence:begin",CAPTURE:"dock-evidence:capture",CANCEL:"dock-evidence:cancel",CONTROL:"dock-evidence:control",EVENT:"dock-evidence:event"},DOCK_ANNOTATION:{READY:"dock-annotation:ready",POINTER:"dock-annotation:pointer",GESTURE:"dock-annotation:gesture",GET_STILL:"dock-annotation:get-still",STATE:"dock-annotation:state",TOOLBAR:"dock-annotation:toolbar"},POWER:{GET_BATTERY_STATE:"power:get-battery-state",BATTERY_CHANGED:"power:battery-changed"},TERMINAL:{CREATE_WITH_COMMAND:"terminal:createWithCommand",PROFESSIONAL_CREATE:"terminal:professional:create",PROFESSIONAL_LIST:"terminal:professional:list",PROFESSIONAL_WRITE:"terminal:professional:write",PROFESSIONAL_RESIZE:"terminal:professional:resize",PROFESSIONAL_INFO:"terminal:professional:info",PROFESSIONAL_REFRESH:"terminal:professional:refresh",PROFESSIONAL_DISPOSE:"terminal:professional:dispose",PROFESSIONAL_GET_BUFFER:"terminal:professional:get-buffer"},GIT:{STATUS:"git:status",STATUS_CHANGED:"git:status-changed",AUTH_REQUIRED:"git:auth-required",KEYCHAIN_ACCESS_WARNING:"git:keychain-access-warning",KEYCHAIN_CONSENT_RESPOND:"git:keychain-consent-respond",CHECK_KEYCHAIN_RISK:"git:check-keychain-risk",DIFF:"git:diff",NUMSTAT:"git:numstat",COMMIT:"git:commit",COMMIT_DETAILS:"git:commit-details",PUSH:"git:push",PULL:"git:pull",BRANCH:"git:branch",CHECKOUT:"git:checkout",LOG:"git:log",HISTORY:"git:history",GET_BRANCHES:"git:getBranches",STAGE:"git:stage",UNSTAGE:"git:unstage",STAGE_HUNK:"git:stage-hunk",UNSTAGE_HUNK:"git:unstage-hunk",DISCARD:"git:discard",REMOVE_LOCK:"git:removeLock",SHOW_FILE:"git:show-file",FILE_HISTORY:"git:file-history",RENAME_BRANCH:"git:rename-branch",PULL_BRANCH:"git:pullBranch",GET_BRANCH_STATUS:"git:getBranchStatus",GET_REMOTES:"git:getRemotes",FETCH:"git:fetch"},CONFIG:{GET:"config:get",SET:"config:set",DELETE:"config:delete",GET_ALL:"config:get-all",RESET:"config:reset"},SETTINGS:{GET:"settings:get",SET:"settings:set",GET_ALL:"settings:getAll",UPDATE:"settings:update"},FEATURE_CODES:{ACTIVATE:"feature-codes:activate",GET_ACTIVE:"feature-codes:get-active",DEACTIVATE:"feature-codes:deactivate",RESTART_APP:"feature-codes:restart-app"},USER_MCP:{AUTHENTICATE:"user-mcp:authenticate",CHECK_AUTH:"user-mcp:check-auth",TEST_CONNECTION:"user-mcp:test-connection"},NOTIFICATION:{TEST:"notification:test",REQUEST_PERMISSION:"notification:requestPermission",SHOW:"notification:show"},DIALOG:{MESSAGE:"dialog:message",OPEN:"dialog:open"},VOICE:{LOCAL_AVAILABLE:"voice:local-available",TRANSCRIBE_LOCAL:"voice:transcribe-local",REQUEST_LOCAL_AUTHORIZATION:"voice:request-local-authorization"},SHELL:{OPEN:"shell:open",OPEN_PATH:"shell:openPath",OPEN_EXTERNAL:"shell:openExternal",TRASH_ITEM:"shell:trashItem",SHOW_ITEM_IN_FOLDER:"shell:showItemInFolder"},EDITOR:{GET_SELECTION:"editor:get-selection"},EXTERNAL_EDITORS:{DETECT_INSTALLED:"external-editors:detect-installed",OPEN:"external-editors:open",OPEN_WITH_OTHER:"external-editors:open-with-other"},FIRST_VISIT:{LOAD:"first-visit-state:load",SAVE:"first-visit-state:save",DELETE:"first-visit-state:delete",EXISTS:"first-visit-state:exists"},PANEL_LAYOUT:{LOAD:"panel-layout:load",SAVE:"panel-layout:save"},BROWSER:{REGISTER_TAB:"browser:register-tab",UNREGISTER_TAB:"browser:unregister-tab",REPORT_TAB_BOUNDS:"browser:report-tab-bounds",SET_TAB_VIEWPORT:"browser:set-tab-viewport",OPEN_DEVTOOLS_PANEL:"browser:open-devtools-panel",EXEC:"browser:exec",RESOLVE_URL:"browser:resolve-url",FOCUS_TAB:"browser:focus-tab",SHOW_TAB:"browser:show-tab",LIST_TABS_REQUEST:"browser:list-tabs-request",HOST_WORKSPACE:"browser:host-workspace",CAPTURE_DRAWING:"browser:capture-drawing",AGENT_DRAWING:"browser:agent-drawing",BACKGROUND_HOSTED_WORKSPACES:"browser:background-hosted-workspaces",LIST_TABS_RESPONSE:"browser:list-tabs-response",OPEN_TAB:"browser:open-tab",DIAGNOSE_TAB:"browser:diagnose-tab",CLOSE_TAB:"browser:close-tab",TAB_NAVIGATED:"browser:tab-navigated",TAB_OWNER_CHANGED:"browser:tab-owner-changed",CLEAR_AGENT_TABS:"browser:clear-agent-tabs"},FILE_TRACKING:{AGENT_FILE_CHANGED:"file-tracking:agent-file-changed"},STREAMING:{START:"streaming:start",STOP:"streaming:stop",PAUSE:"streaming:pause",RESUME:"streaming:resume",GET_STATS:"streaming:get-stats"},AGENT_CONFIG:{GET:"agent-config:get",UPDATE:"agent-config:update",RESET:"agent-config:reset"},LOG:{TRACK_FILE_CHANGE:"log:track-file-change",TRACK_AGENT_EVENT:"log:track-agent-event",TRACK_MCP_CALL:"log:track-mcp-call",PATHS:"log:paths",READ:"log:read",CLEAR:"log:clear",SUMMARY:"log:summary",EXPORT_DEBUG_BUNDLE:"log:export-debug-bundle",PERSIST_RENDERER_LOGS:"log:persist-renderer-logs"},USER_RULES:{GET:"user-rules:get",SET:"user-rules:set",DELETE:"user-rules:delete",GET_ALL:"user-rules:get-all",GET_FORMATTED:"user-rules:get-formatted",SET_ENABLED:"user-rules:set-enabled",EXPORT:"user-rules:export",IMPORT:"user-rules:import",GET_COMBINED_PROMPT:"user-rules:get-combined-prompt",UPDATE:"user-rules:update",GET_BY_TYPE:"user-rules:get-by-type",GET_FORMATTED_BY_TYPE:"user-rules:get-formatted-by-type",UPDATE_BY_TYPE:"user-rules:update-by-type",SET_ENABLED_BY_TYPE:"user-rules:set-enabled-by-type",DELETE_BY_TYPE:"user-rules:delete-by-type",EXPORT_BY_TYPE:"user-rules:export-by-type"},VSCODE:{OPEN:"vscode:open",OPEN_FILE:"vscode:openFile",OPEN_DIFF:"vscode:open-diff",OPEN_GIT_DIFF:"vscode:open-git-diff"},JETBRAINS:{OPEN:"jetbrains:open"},XCODE:{OPEN:"xcode:open"},DEEP_LINK:{HANDLE:"deep-link:handle",CONSUME_PENDING:"deep-link:consume-pending"},LEGACY:{GET_HOME_DIRECTORY:"get_home_directory"},RULES:{LIST:"rules:list",LOAD_WORKSPACE:"rules:load-workspace",GET_CONTEXT:"rules:get-context"},CONFIG_RULES:{GET_ALL:"config:getAll"},USER_ACTIVITY:{MARK_NOTE_READ:"user-activity:mark-note-read",GET_NOTE_READ_STATUS:"user-activity:get-note-read-status",GET_UNREAD_NOTE_IDS:"user-activity:get-unread-note-ids"},GIT_TRACKING:{GET_STATE:"git-tracking:get-state",GET_SYNC_STATUS:"git-tracking:get-sync-status",SYNC:"git-tracking:sync",GET_FILE_DIFF:"git-tracking:get-file-diff",IS_GITHUB_AUTHENTICATED:"git-tracking:is-github-authenticated",GET_GITHUB_BRANCHES:"git-tracking:get-github-branches",GET_PULL_REQUESTS:"git-tracking:get-pull-requests",SEARCH_PULL_REQUESTS:"git-tracking:search-pull-requests",GET_PULL_REQUEST:"git-tracking:get-pull-request",CREATE_PULL_REQUEST:"git-tracking:create-pull-request",GET_GITHUB_ISSUES:"git-tracking:get-github-issues",SEARCH_GITHUB_ISSUES:"git-tracking:search-github-issues",LIST_RELATED_REPOS:"git-tracking:list-related-repos",GET_REMOTE_URL:"git-tracking:get-remote-url",GET_CHECK_RUNS:"git-tracking:get-check-runs",GET_PR_REVIEWS:"git-tracking:get-pr-reviews"},GITHUB_AUTH:{IS_AUTHENTICATED:"github-auth:is-authenticated",GET_USER:"github-auth:get-user",START_AUTH:"github-auth:start",POLL_FOR_TOKEN:"github-auth:poll",CANCEL_AUTH:"github-auth:cancel",LOGOUT:"github-auth:logout",GET_AUTH_STATE:"github-auth:get-auth-state",GET_STATUS:"github-auth:get-status",LIST_REPOS:"github-auth:list-repos",SEARCH_REPOS:"github-auth:search-repos",SEARCH_USERS:"github-auth:search-users"},FORGE_AUTH:{GET_STATUS:"forge-auth:get-status",CONNECT:"forge-auth:connect",CANCEL_AUTH:"forge-auth:cancel",REVOKE:"forge-auth:revoke",GET_USER:"forge-auth:get-user"},LINEAR_AUTH:{IS_AUTHENTICATED:"linear-auth:is-authenticated",START_AUTH:"linear-auth:start-auth",CANCEL_AUTH:"linear-auth:cancel-auth",LOGOUT:"linear-auth:logout",GET_AUTH_STATE:"linear-auth:get-auth-state",GET_STATUS:"linear-auth:get-status",FETCH_MY_ISSUES:"linear-auth:fetch-my-issues",SEARCH_ISSUES:"linear-auth:search-issues"},SENTRY_AUTH:{IS_AUTHENTICATED:"sentry-auth:is-authenticated",SAVE_CONFIG:"sentry-auth:save-config",GET_AUTH_STATE:"sentry-auth:get-auth-state",LOGOUT:"sentry-auth:logout",FETCH_PROJECTS:"sentry-auth:fetch-projects",FETCH_ISSUES:"sentry-auth:fetch-issues",SEARCH_ISSUES:"sentry-auth:search-issues",GET_ISSUE:"sentry-auth:get-issue"},OBSERVABILITY_EXT:{},AGENT_TESTING:{RUN:"agent-testing:run",GET_REPORT:"agent-testing:get-report",GET_AGENT_REPORTS:"agent-testing:get-agent-reports",CLEANUP:"agent-testing:cleanup"},DEBUG:{TRIGGER_BACKEND_RESUME:"debug:trigger-backend-resume",LIST_AGENTS:"debug:list-agents"},SETUP_SCRIPTS:{GENERATE:"setup-scripts:generate",READ_REPO_CONFIG:"setup-scripts:read-repo-config",DETECT_TYPE:"setup-scripts:detect-type",GENERATE_WITH_AGENT:"setup-scripts:generate-with-agent",STOP_AGENT:"setup-scripts:stop-agent",STREAM_CHUNK:"setup-scripts:stream-chunk",STREAM_COMPLETE:"setup-scripts:stream-complete",STREAM_ERROR:"setup-scripts:stream-error"},GIT_EXT:{IS_REPOSITORY:"git:isRepository",GET_AUTO_COMMIT_STATUS:"git:get-auto-commit-status",GET_BACKGROUND_OPS_STATUS:"git:background-ops-status"},ACCEPT_CHANGES:{CHECK_PATH_HAS_CHANGES:"accept-changes:check-path-has-changes"},CHAT_EXPORT:{CHAT_TO_HTML:"export:chat-to-html"},FILE_EXT:{},COMMENTS_EXT:{},WORKSPACE_EXT:{},AGENT_LAUNCH:{},AGENT_CONTEXT:{GET:"agent-context:get"},RECOVERY:{NEEDS_RECOVERY:"recovery:needs-recovery",MARK_STREAMING:"recovery:mark-streaming",MARK_COMPLETE:"recovery:mark-complete",CLEAR_STREAMING:"recovery:clear-streaming",CHECK_NEEDS_RECOVERY:"recovery:check-needs-recovery",GET_STATUS:"recovery:get-status",CREATE_CHECKPOINT:"recovery:create-checkpoint",RESTORE_CHECKPOINT:"recovery:restore-checkpoint",RECOVER_SESSION:"recovery:recover-session",GET_STATS:"recovery:get-stats"},STORAGE:{SAVE:"storage:save",DELETE:"storage:delete"},AUTO_UPDATE:{CHECK_MANUAL:"auto-update:check-manual",DOWNLOAD:"auto-update:download",INSTALL:"auto-update:install",GET_STATE:"auto-update:get-state",SET_CHANNEL:"auto-update:set-channel",SET_SHARE_STATISTICS:"auto-update:set-share-statistics",STATUS_CHANGED:"auto-update:status-changed",PROGRESS:"auto-update:progress",ERROR:"auto-update:error",UP_TO_DATE:"auto-update:up-to-date",SHOW_TOAST:"auto-update:show-toast"},RELEASE_NOTES:{GET:"release-notes:get",GET_PENDING:"release-notes:get-pending",DISMISS:"release-notes:dismiss",SHOW:"release-notes:show",CLOSE:"release-notes:close"},PIP:{OPEN:"pip:open",CLOSE:"pip:close",CLOSE_ALL_FOR_WORKSPACE:"pip:close-all-for-workspace"},BROWSER_ACCESS:{GET_STATE:"browser-access:get-state",SET_ENABLED:"browser-access:set-enabled",SET_PORT:"browser-access:set-port",RESET_KEY:"browser-access:reset-key",CREATE_SIGN_IN_CODE:"browser-access:create-sign-in-code"},WEBSOCKET_API:{GET_STATUS:"websocket-api:get-status",SET_ENABLED:"websocket-api:set-enabled",REGENERATE_TOKEN:"websocket-api:regenerate-token",SET_DISCOVERY:"websocket-api:set-discovery"},TOKEN_USAGE:{GET:"token-usage:get",CHANGED:"token-usage:changed"},BACKEND:{DESKTOP_PERMISSIONS:"backend:desktop-permissions",REQUEST:"backend:request",PR_MONITOR:{READY:"backend:pr-monitor:ready",CAPTURE:"backend:pr-monitor:capture",REQUEST:"backend:pr-monitor:request",RELEASE:"backend:pr-monitor:release",RETIRED:"backend:pr-monitor:retired",NOTIFICATION:"backend:pr-monitor:notification"},NATIVE_REVIEW:{PREPARE:"backend:native-review:prepare",EXECUTE:"backend:native-review:execute",RECONCILE:"backend:native-review:reconcile",RELEASE:"backend:native-review:release",RETIRED:"backend:native-review:retired"},REPOSITORY_SELECTION:{CAPTURE:"backend:repository-selection:capture",CONFIRM:"backend:repository-selection:confirm",RECONCILE:"backend:repository-selection:reconcile",RELEASE:"backend:repository-selection:release",RETIRED:"backend:repository-selection:retired"},REPOSITORY_CHECKOUT:{CAPTURE:"backend:repository-checkout:capture",REQUEST:"backend:repository-checkout:request",RELEASE:"backend:repository-checkout:release",RETIRED:"backend:repository-checkout:retired"},REPOSITORY_RESOURCE:{CAPTURE:"backend:repository-resource:capture",DETAIL:"backend:repository-resource:detail",RELEASE:"backend:repository-resource:release",RETIRED:"backend:repository-resource:retired"},REPOSITORY:{CAPTURE:"backend:repository:capture",RETIRED:"backend:repository:retired",REQUEST:"backend:repository:request",RELEASE:"backend:repository:release"},SUBSCRIBE:"backend:subscribe",UNSUBSCRIBE:"backend:unsubscribe",GET_STATUS:"backend:get-status",NODE_CAPABILITIES:"backend:node-capabilities",READ_PRINCIPAL:"backend:read-principal",NOTIFICATION:"backend:notification",STATUS:"backend:status",SPAWN_SIDECAR:"backend:spawn-sidecar",OPEN_LOCAL_AND_SPAWN:"backend:open-local-and-spawn",GET_SIDECAR_RUN_LOG:"backend:get-sidecar-run-log",RESTART_ORPHANED_SIDECAR:"backend:restart-orphaned-sidecar"},CONNECTIONS:{LIST:"connections:list",CAPTURE_FINGERPRINT:"connections:capture-fingerprint",ADD:"connections:add",UPDATE:"connections:update",TEST:"connections:test",ROTATE_SECRET:"connections:rotate-secret",GET_TUNNEL:"connections:get-tunnel",SET_TUNNEL:"connections:set-tunnel",OPEN:"connections:open",FORGET:"connections:forget",PAIR_LINK_INSPECT:"connections:pair-link-inspect",PAIR_LINK_COMMIT:"connections:pair-link-commit",PAIR_LINK_DISCARD:"connections:pair-link-discard",UPDATE_BACKEND:"connections:update-backend",CHANGED:"connections:changed",CERT_MISMATCH:"connections:cert-mismatch",CERT_WARNINGS:"connections:cert-warnings",PROTOCOL_MISMATCH:"connections:protocol-mismatch",AUTH_REJECTED:"connections:auth-rejected",SYNC_GET_STATE:"connections:sync-get-state",SYNC_SET_ENABLED:"connections:sync-set-enabled",SYNC_STATUS_CHANGED:"connections:sync-status-changed",PUBLISH_SELF:"connections:publish-self",SELF_PUBLISHED_STATE:"connections:self-published-state",REFRESH_SELF:"connections:refresh-self",UNPUBLISH_SELF:"connections:unpublish-self"},GUEST_SESSIONS:{LIST:"guest-sessions:list",LEAVE:"guest-sessions:leave",LEAVE_WORKSPACE:"guest-sessions:leave-workspace",CHANGED:"guest-sessions:changed"},PRESENCE:{REPORT:"presence:report"},TRANSFER:{START:"transfer:start",FINALIZE:"transfer:finalize",CANCEL:"transfer:cancel",PROGRESS:"transfer:progress",IMPORT_START:"transfer:import-start",IMPORT_CANCEL:"transfer:import-cancel",IMPORT_PROGRESS:"transfer:import-progress"},REMOTE_MACHINES:{EXPOSE:"remote-machines:expose",UNEXPOSE:"remote-machines:unexpose",MACHINE_FINGERPRINT:"remote-machines:machine-fingerprint",INVITE_INSPECT:"remote-machines:invite-inspect",INVITE_CLAIM:"remote-machines:invite-claim",INVITE_DISCARD:"remote-machines:invite-discard"},HARDWARE_CONSOLE:{CLEAR_LIGHTING:"hardware-console:clear-lighting",CLEAR_LIGHTING_DONE:"hardware-console:clear-lighting-done",GET_OWNER_STATUS:"hardware-console:get-owner-status",OWNER_CHANGED:"hardware-console:owner-changed"}},d={"global.command-palette":"mod+shift+p","global.settings":"mod+,","global.keyboard-shortcuts":"mod+?","global.command-palette-alt":"mod+k","global.toggle-spaces":"mod+o","global.new-space":"mod+n","global.search":"mod+f","global.next-space":"ctrl+tab","global.previous-space":"ctrl+shift+tab","global.next-space-alt":"mod+shift+]","global.previous-space-alt":"mod+shift+[","navigation.go-to-tab":"mod+1-9","navigation.new-tab":"mod+t","navigation.close-tab":"mod+w","navigation.close-space-tab":"mod+shift+w","navigation.reopen-tab":"mod+shift+t","navigation.move-space-tab-left":"mod+alt+shift+left","navigation.move-space-tab-right":"mod+alt+shift+right","workspace.new-agent":"mod+alt+a","workspace.new-note":"mod+alt+n","workspace.new-terminal":"mod+alt+t","workspace.new-browser":"mod+alt+b","workspace.set-aside":"mod+shift+s","chat.send":"enter","chat.force-send":"mod+enter","chat.new-line":"shift+enter","chat.focus-input":"/","chat.mention-context":"@","editor.go-to-line":"mod+g","editor.save":"mod+s","editor.undo":"mod+z","editor.redo":"mod+shift+z","editor.toggle-task-list":"mod+shift+9","editor.toggle-word-wrap":"alt+z","editor.copy":"mod+c","editor.select-all":"mod+a","panel.toggle-sidebar":"mod+b","panel.create-column-right":"mod+\\","panel.focus-next-column":"mod+alt+right","panel.maximize":"mod+shift+m","panel.focus-previous-column":"mod+alt+left","panel.next-pane":"mod+]","panel.previous-pane":"mod+[","panel.move-pane-next-column":"mod+alt+pagedown","panel.move-pane-previous-column":"mod+alt+pageup","panel.copy-browser-url":"mod+shift+c","leader.navigate-panels":"h/j/k/l","leader.resize-panels":"H/J/K/L","leader.split-right":"%","leader.toggle-zoom":"z","leader.close-panel":"x","leader.next-previous-panel":"o/p","leader.equalize-sizes":"=","leader.jump-to-panel":"q + 1-9","leader.cycle-layout":"space"},L=["mod","ctrl","alt","shift"],P={mod:"mod",cmd:"mod",command:"mod",meta:"mod",control:"ctrl",ctrl:"ctrl",option:"alt",alt:"alt",shift:"shift"},K={escape:"esc",return:"enter",arrowup:"up",arrowdown:"down",arrowleft:"left",arrowright:"right",pgup:"pageup",pgdn:"pagedown"," ":"space"},Ee=new Set(["backspace","delete","down","end","enter","esc","f1","f2","f3","f4","f5","f6","f7","f8","f9","f10","f11","f12","home","left","pagedown","pageup","right","space","tab","up"]),ce=new Set(["alt","control","meta","shift"]),M={"~":"`","!":"1","@":"2","#":"3",$:"4","%":"5","^":"6","&":"7","*":"8","(":"9",")":"0",_:"-","+":"=","{":"[","}":"]","|":"\\",":":";",'"':"'","<":",",">":".","?":"/"},Te=Object.fromEntries(Object.entries(M).map(([e,t])=>[t,e]));function be(e,t){if(ce.has(e.key.toLowerCase())||!t&&e.metaKey)return null;let s=e.key;e.altKey&&e.code?.startsWith("Key")?s=e.code.slice(3):e.altKey&&e.code?.startsWith("Digit")&&(s=e.code.slice(5));const o=[];return(t&&e.metaKey||!t&&e.ctrlKey)&&o.push("mod"),t&&e.ctrlKey&&o.push("ctrl"),e.altKey&&o.push("alt"),e.shiftKey&&o.push("shift"),o.push(s),k(o.join("+"))}function le(e){return Object.prototype.hasOwnProperty.call(d,e)}function m(e){const t=e.trim();if(!t||t.includes("/"))return null;const s=t.split("+").map(r=>r.trim()).filter(Boolean);if(s.length===0)return null;const o=new Set;for(const r of s.slice(0,-1)){const c=P[r.toLowerCase()];if(!c||o.has(c))return null;o.add(c)}const n=s.at(-1)??"";if(P[n.toLowerCase()])return null;const a=K[n.toLowerCase()]??n.toLowerCase();return a.length===1||Ee.has(a)?{key:a,mod:o.has("mod"),ctrl:o.has("ctrl"),alt:o.has("alt"),shift:o.has("shift")}:null}function k(e){const t=e.trim();if(t.includes("/")){const r=t.split("/").map(S=>S.trim()),c=r[0]??"",l=c.includes("+")?`${c.slice(0,c.lastIndexOf("+"))}+`:"",p=r.map((S,I)=>{const g=I>0&&l&&!S.includes("+")?l+S:S,C=g.slice(g.lastIndexOf("+")+1),N=m(/^[A-Z]$/.test(C)?`${g.slice(0,-1)}shift+${C.toLowerCase()}`:g);return N?[...L.filter(j=>N[j]),N.key].join("+"):null});return p.some(S=>!S)?null:p.join("/")}const s=t.match(/^(.*\+)?([1-8])-9$/i);if(s){const r=m(`${s[1]??""}${s[2]}`);if(!r)return null;const c=L.filter(l=>r[l]);return`${c.length?`${c.join("+")}+`:""}${s[2]}-9`}const o=t.match(/^(.+?)\s+\+\s+([1-8]-9)$/);if(o){const r=k(o[1]);return r?`${r} + ${o[2]}`:null}const n=m(e);return n?[...L.filter(r=>n[r]),n.key].join("+"):null}function De(e,t){const s=d[e],o=t.includes("+")?`${t.slice(0,t.lastIndexOf("+"))}+`:"",n=s.match(/^(.+?)\s+\+\s+([1-8]-9)$/);if(n)return`${t} + ${n[2]}`;const a=s.match(/^(?:.*\+)?([1-8]-9)$/);return a?`${o}${a[1]}`:s.includes("/")?`${o}${s}`:t}function Ue(e){return e.match(/^(.+?)\s+\+\s+[1-8]-9$/)?.[1]??null}function Se(e){const t=e.match(/^(.*\+)?([1-8])-9$/);if(t){const a=t[1]??"";return Array.from({length:10-Number(t[2])},(r,c)=>`${a}${Number(t[2])+c}`)}const s=e.split("/"),o=s[0]??"",n=o.includes("+")?`${o.slice(0,o.lastIndexOf("+"))}+`:"";return s.map((a,r)=>{const c=a.trim(),l=r>0&&n&&!c.includes("+")?n+c:c;return/^[A-Z]$/.test(l)?`shift+${l.toLowerCase()}`:l==="space"?"space":l})}function _e(e,t,s){return Se(t).findIndex(o=>ue(e,o,s))}function ue(e,t,s){const o=m(t);if(!o)return!1;const n=K[e.key.toLowerCase()]??e.key.toLowerCase(),a=o.key.length===1&&'~!@#$%^&*()_+{}|:"<>?'.includes(o.key);return new Set([n,M[n],e.shiftKey?Te[n]:void 0]).has(o.key)&&e.metaKey===(o.mod&&s)&&e.ctrlKey===(o.ctrl||o.mod&&!s)&&e.altKey===o.alt&&e.shiftKey===(o.shift||a)}function ye(e){if(!e||typeof e!="object"||Array.isArray(e))return{};const t={};for(const[s,o]of Object.entries(e)){if(!le(s)||typeof o!="string")continue;const n=k(o);n&&n!==d[s]&&(t[s]=n)}return t}function He(e,t){return t[e]??d[e]}function Ke(e,t,s,o){return s(e)!==d[e]?!1:Object.keys(d).some(n=>{if(n===e||n.startsWith("leader."))return!1;const a=s(n);return a===d[n]?!1:_e(t,a,o)>=0})}function R(e){if(/[\u0000-\u0020\u007f\\]/.test(e))return null;const t=/^https:\/\/([^/?#]+)([^?#]*)/i.exec(e);if(!t||/[@%]/.test(t[1]))return null;try{const s=new URL(e);if(s.protocol!=="https:"||s.username||s.password)return null;const o=t[2].replace(/\/$/,""),n=o?o.slice(1).split("/"):[];return n.some(a=>!/^[A-Za-z0-9_.-]+$/.test(a)||a==="."||a==="..")?null:{url:s,path:n}}catch{return null}}function G(e){const t=R(e);return!!t&&!t.url.search&&!t.url.hash&&e===t.url.origin+(t.path.length?`/${t.path.join("/")}`:"")}function Me(e,t){if(!G(t))return null;const s=R(e),o=R(t);if(!s||!o||o.url.origin!==s.url.origin||!o.path.every((a,r)=>s.path[r]===a))return null;const n=s.path.slice(o.path.length);return n.length<2||n[0]==="groups"||n.includes("-")?null:{provider:"gitlab",instanceBaseUrl:t,projectPath:n.join("/")}}function ge(e,t){const s=R(e);if(!s)return null;let o=null;for(const n of t){if(n.provider!=="gitlab"||!G(n.instanceBaseUrl))continue;const a=R(n.instanceBaseUrl);if(!a||a.url.origin!==s.url.origin||!a.path.every((C,N)=>s.path[N]===C))continue;const r=s.path.slice(a.path.length),c=r.indexOf("-");if(c<2||r[0]==="groups")continue;const[l,p,...S]=r.slice(c+1),I=l==="merge_requests"?"merge-request":l==="issues"?"issue":null;if(!I||!/^[1-9]\d*$/.test(p??"")||!Number.isSafeInteger(Number(p))||S.length&&(I!=="merge-request"||S.length!==1||!["diffs","commits","pipelines"].includes(S[0])))continue;const g={repository:{provider:"gitlab",instanceBaseUrl:n.instanceBaseUrl,projectPath:r.slice(0,c).join("/")},kind:I,number:Number(p)};if(o&&JSON.stringify(o)!==JSON.stringify(g))return null;o=g}return o}function ve(e){const t=R(e);return t?ge(e,[{provider:"gitlab",instanceBaseUrl:t.url.origin}])!==null:!1}const v="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",W="([01]\\d|2[0-3]):[0-5]\\d(:[0-5]\\d(\\.\\d+)?)?",de=new RegExp(`^${v}T${W}(Z)$`),pe=new RegExp(`^${v}T${W}(Z|([+-]\\d{2}:?\\d{2}))$`);function b(e={}){return i().regex(e.offset?pe:de,e.message??"Invalid datetime")}function F(e="Invalid url"){return i().refine(t=>URL.canParse(t),e)}const D=i().regex(/^(0|[1-9][0-9]*)$/).refine(e=>/^(0|[1-9][0-9]*)$/.test(e)&&BigInt(e)<=18446744073709551615n),We=E({target:T(["local","remote"]),checkout:T(["shared","worktree","isolated"]),os:T(["linux","macos"]).optional(),nodeId:i().min(1).optional(),exclusive:u().optional()}).strict().refine(e=>e.target!=="remote"||e.checkout==="isolated").refine(e=>!e.exclusive||e.target==="remote"&&e.checkout==="isolated"),B=E({target:T(["local","remote","e2b"]).optional(),checkout:T(["shared","worktree","isolated"]).optional(),os:T(["linux","macos"]).optional(),arch:T(["x86_64","aarch64"]).optional(),nodeId:i().min(1).refine(e=>new TextEncoder().encode(e).length<=128).optional(),exclusive:u().optional(),cloudMachineId:i().min(1).refine(e=>new TextEncoder().encode(e).length<=64).optional()}).strict(),Fe=B.refine(e=>e.target!=="remote"||(e.checkout??"isolated")==="isolated").refine(e=>e.cloudMachineId===void 0||e.target==="e2b").refine(e=>e.target!=="e2b"||(e.checkout??"isolated")==="isolated"&&!e.os&&!e.arch&&!e.nodeId&&!e.exclusive).refine(e=>!e.exclusive||e.target!=="local"&&(e.checkout??"isolated")==="isolated"),Ae=B.extend({target:T(["local","remote","e2b"]),checkout:T(["shared","worktree","isolated"])}).refine(e=>e.target!=="remote"||e.checkout==="isolated").refine(e=>!e.exclusive||e.target!=="local"&&e.checkout==="isolated"),Re=E({id:i().min(1),assignmentEpoch:D,captureRevision:D,capturedAt:b({offset:!0}),committedAt:b({offset:!0})}),Oe=E({state:T(["pending","running","completed","failed","skipped"]),exitCode:w().int().optional(),error:i().optional(),startedAt:i().optional(),finishedAt:i().optional(),output:i().optional(),outputTruncated:u().optional()}),Be=E({nodeId:i().min(1).optional(),leaseId:i().min(1).optional(),nodeName:i().min(1).optional(),placement:Ae.optional(),effectiveIsolation:T(["pending","isolated","shared","worktree","direct","cow"]).optional(),nodeState:T(["ready","offline","incompatible","removed"]).optional(),checkpoint:Re.optional(),placementError:E({code:i(),detail:i()}).optional(),cloudStart:E({step:i().min(1)}).passthrough().optional().catch(void 0),setup:Oe.optional().catch(void 0),nodePath:i().optional()}),_=i().min(1),A=F().refine(e=>{const t=new URL(e);return t.protocol==="https:"&&!t.username&&!t.password}),x=A.refine(e=>G(e)),V=w().int().nonnegative().max(Number.MAX_SAFE_INTEGER),O=i().max(1024).regex(/^[A-Za-z0-9_.-]+(?:\/[A-Za-z0-9_.-]+)+$/).refine(e=>e.split("/").every(t=>t!=="."&&t!=="..")),f=i().regex(/^[0-9a-fA-F]{40}$/),Y=E({checkoutId:_,revision:_}).strict(),xe=E({provider:h("gitlab"),instanceBaseUrl:x.optional()}).strict(),Ve=Y.extend({provider:h("gitlab"),instanceBaseUrl:x,expiresAfterMs:V}).strict(),$=E({projectPath:O,name:i(),namespace:i(),webUrl:A,cloneUrl:A,defaultBranch:_.optional(),ownerAvatarUrl:F().pipe(A).optional().catch(void 0)}).strict(),Ie=E({name:_,commitSha:f,protected:u().optional()}).strict(),Ne=E({query:i().trim().refine(e=>new TextEncoder().encode(e).length<=256&&!/[\u0000-\u001f\u007f]/.test(e)).optional(),cursor:_.optional(),limit:w().int().positive().max(100).optional()}).strict(),Ye=ee([E({projectPath:O}).strict(),E({url:A}).strict()]),$e=Ne.extend({projectPath:O,cached:u().optional()}).strict(),he=Y.extend({projectPath:O,branch:_,commitSha:f,mode:T(["direct","cached"])}).strict(),Xe=he.omit({mode:!0}).strict(),je=E({projectPath:O,branch:_,commitSha:f,config:te(i(),U()).nullable(),exists:u()}).strict().refine(e=>e.exists===(e.config!==null)),qe=E({items:y($),nextCursor:_.optional()}).strict(),ze=E({project:$,contextUrl:A.optional()}).strict(),Qe=E({items:y(Ie),nextCursor:_.optional(),defaultBranch:_.optional(),cached:u()}).strict(),Ze=E({projectPath:O,branch:_,commitSha:f,cached:u()}).strict(),X=E({status:h("unavailable"),reason:T(["disabled","not-connected","access-denied","rate-limited","unreachable","retired","not-found","invalid-target","empty-repository","branch-changed"]),retryAfterMs:V.optional()}).strict();function Je(e){return oe("status",[E({status:h("ready"),value:e}).strict(),X])}function et(e,t){if(E({status:T(["ready","unavailable"])}).passthrough().parse(t).status==="unavailable")return X.parse(t);const o=E({status:h("ready"),value:U()}).strict().parse(t);return{status:"ready",value:e.parse(o.value)}}export{Re as A,le as B,$e as C,b as D,we as E,ue as F,_e as G,k as H,Pe as I,et as J,Me as K,ge as L,He as M,ye as N,be as O,d as S,Be as a,Fe as b,We as c,Qe as d,xe as e,Ve as f,Ne as g,ze as h,Ye as i,$ as j,qe as k,Xe as l,je as m,he as n,Ze as o,De as p,re as q,Je as r,ae as s,H as t,Ue as u,Ge as v,G as w,ke as x,Ke as y,ve as z};
1
+ import{aR as q,aP as z,b4 as Q,a0 as Z}from"./DYhIMPy1.js";import{B as J}from"./E2zwcBGL.js";import{s as i,o as E,c as u,_ as T,n as w,l as h,u as ee,r as te,e as U,b as y,d as oe}from"./UyBYtOpv.js";const se=Symbol("NaN");function we(e,t,s){q&&z();var o=new J(e),n=!Q();Z(()=>{var a=t();a!==a&&(a=se),n&&a!==null&&typeof a=="object"&&(a={}),o.ensure(a,s)})}const ne="0.0.0-browser";function ae(e){const t=e?.electronAPI;return!t||t.versions?.electron===ne?"web":"electron"}function H(){return typeof window>"u"?"web":ae(window)}function ke(){return H()==="electron"}function re(e){const t=e==="electron";return{windowChrome:t,nativeDialogs:t,shellIntegration:t,externalEditors:t,browserPanel:t,autoUpdate:t,deeplinks:t,nativeNotifications:t,ssh:t}}function ie(){return re(H())}function Ge(e){return ie()[e]}const Pe={DEV_CONSOLE:{OPEN:"dev-console:open",CONNECT:"dev-console:connect",READ:"dev-console:read",RECORD:"dev-console:record",CLEAR:"dev-console:clear",SELECT:"dev-console:select",LINKS_STATUS:"dev-console:links-status",LINKS_START:"dev-console:links-start",LINKS_STOP:"dev-console:links-stop",LINKS_READ:"dev-console:links-read",LINKS_RECORD:"dev-console:links-record"},WORKSPACE:{LIST:"workspace:list",CREATE:"workspace:create",GET:"workspace:get",GET_CURRENT:"workspace:get-current",GET_BY_ID:"workspace:get-by-id",GET_ROOT:"workspace:get-root",OPEN:"workspace:open",CLOSE:"workspace:close",SAVE:"workspace:save",UPDATE:"workspace:update",DELETE:"workspace:delete",ACTIVATE:"workspace:activate",ARCHIVE:"workspace:archive",UNARCHIVE:"workspace:unarchive",CLEANUP:"workspace:cleanup",RENAME:"workspace:rename",EXPORT:"workspace:export",IMPORT:"workspace:import",GET_METADATA:"workspace:get-metadata",UPDATE_METADATA:"workspace:update-metadata",GET_RECENT:"workspace:get-recent",CLEAR_RECENT:"workspace:clear-recent",GET_STATS:"workspace:get-stats",VALIDATE:"workspace:validate",REPAIR:"workspace:repair",BACKUP:"workspace:backup",RESTORE:"workspace:restore",GET_SETTINGS:"workspace:get-settings",UPDATE_SETTINGS:"workspace:update-settings",TRIGGER_CHECK:"workspace:trigger-check",LIST_FILES:"workspace:list-files",TEST_WATCHER:"workspace:test-watcher",FIND_REPOSITORIES:"workspace:find-repositories",UPDATE_SPEC_WATCHER_TIMESTAMP:"workspace:update-spec-watcher-timestamp",UPDATE_CURRENT_CONTEXT:"workspace:update-current-context",SEARCH_IN_FILES:"workspace:search-in-files",GET_RECENT_REPOSITORIES:"workspace:get-recent-repositories",ADD_RECENT_REPOSITORY:"workspace:add-recent-repository",CLEAR_RECENT_REPOSITORIES:"workspace:clear-recent-repositories",REMOVE_RECENT_REPOSITORY:"workspace:remove-recent-repository",UPDATE_GIT_INFO:"workspace:update_git_info",GET_SETTINGS_ALT:"workspace:getSettings",UPDATE_SETTINGS_ALT:"workspace:updateSettings",LOAD_RULES:"workspace:load-rules",RENAME_BRANCH:"workspace:rename-branch",GET_HOVER_STATUS:"workspace:get-hover-status",GET_DIFF_SUMMARY:"workspace:get-diff-summary",GET_GIT_SUMMARY:"workspace:get-git-summary",GET_TASKS:"workspace:get-tasks"},AGENT:{LOAD_INITIAL_CONFIG:"agent:load-initial-config",AVAILABLE:"agent:available",RESUME:"agent:resume",CLEANUP:"agent:cleanup",GET_USER_RULES:"agent:get-user-rules",GET_SPECIALIZATION_RULES:"agent:get-specialization-rules",TRACK_STARTED:"agent:track-started",TRACK_COMPLETED:"agent:track-completed",TRACK_ERROR:"agent:track-error",CREATE:"agent:create",CIRCUIT_BREAKER_RESET:"agent:circuit-breaker:reset",SEND_MESSAGE:"agent:send-message",STOP:"agent:stop",SEND:"agent:send",GET_SESSION:"agent:get-session",LIST_SESSIONS:"agent:list-sessions",DELETE_SESSION:"agent:delete-session",RENAME:"agent:rename",SET_PRIORITY:"agent:set-priority",SUBSCRIBE_UPDATES:"agent:subscribe-updates",UNSUBSCRIBE_UPDATES:"agent:unsubscribe-updates",GET_SUGGESTIONS:"agent:get-suggestions",APPLY_SUGGESTION:"agent:apply-suggestion",GET_COMPLETIONS:"agent:get-completions",VALIDATE_INPUT:"agent:validate-input",FORMAT_OUTPUT:"agent:format-output",GET_SHORTCUTS:"agent:get-shortcuts",ADD_SHORTCUT:"agent:add-shortcut",REMOVE_SHORTCUT:"agent:remove-shortcut",EXECUTE_SHORTCUT:"agent:execute-shortcut",GET_PLUGINS:"agent:get-plugins",INSTALL_PLUGIN:"agent:install-plugin",UNINSTALL_PLUGIN:"agent:uninstall-plugin",ENABLE_PLUGIN:"agent:enable-plugin",DISABLE_PLUGIN:"agent:disable-plugin",GET_PLUGIN_SETTINGS:"agent:get-plugin-settings",UPDATE_PLUGIN_SETTINGS:"agent:update-plugin-settings",EXECUTE_PLUGIN_ACTION:"agent:execute-plugin-action",GET_WEBHOOKS:"agent:get-webhooks",ADD_WEBHOOK:"agent:add-webhook",REMOVE_WEBHOOK:"agent:remove-webhook",TEST_WEBHOOK:"agent:test-webhook",GET_INTEGRATIONS:"agent:get-integrations",CONNECT_INTEGRATION:"agent:connect-integration",DISCONNECT_INTEGRATION:"agent:disconnect-integration",SYNC_INTEGRATION:"agent:sync-integration",GET_INTEGRATION_STATUS:"agent:get-integration-status",GET_INTEGRATION_DATA:"agent:get-integration-data",UPDATE_INTEGRATION_SETTINGS:"agent:update-integration-settings",TEST_INTEGRATION:"agent:test-integration",GET_WORKFLOWS:"agent:get-workflows",CREATE_WORKFLOW:"agent:create-workflow",UPDATE_WORKFLOW:"agent:update-workflow",DELETE_WORKFLOW:"agent:delete-workflow",EXECUTE_WORKFLOW:"agent:execute-workflow",PAUSE_WORKFLOW:"agent:pause-workflow",RESUME_WORKFLOW:"agent:resume-workflow",CANCEL_WORKFLOW:"agent:cancel-workflow",GET_WORKFLOW_STATUS:"agent:get-workflow-status",GET_WORKFLOW_HISTORY:"agent:get-workflow-history",EXPORT_WORKFLOW:"agent:export-workflow",IMPORT_WORKFLOW:"agent:import-workflow",VALIDATE_WORKFLOW:"agent:validate-workflow",OPTIMIZE_WORKFLOW:"agent:optimize-workflow",GET_WORKFLOW_METRICS:"agent:get-workflow-metrics",GET_WORKFLOW_LOGS:"agent:get-workflow-logs",CLEAR_WORKFLOW_LOGS:"agent:clear-workflow-logs",SCHEDULE_WORKFLOW:"agent:schedule-workflow",UNSCHEDULE_WORKFLOW:"agent:unschedule-workflow",GET_SCHEDULED_WORKFLOWS:"agent:get-scheduled-workflows",GET_WORKFLOW_TRIGGERS:"agent:get-workflow-triggers",ADD_WORKFLOW_TRIGGER:"agent:add-workflow-trigger",REMOVE_WORKFLOW_TRIGGER:"agent:remove-workflow-trigger",TEST_WORKFLOW_TRIGGER:"agent:test-workflow-trigger",GET_WORKFLOW_VARIABLES:"agent:get-workflow-variables",SET_WORKFLOW_VARIABLES:"agent:set-workflow-variables",GET_WORKFLOW_DEPENDENCIES:"agent:get-workflow-dependencies",RESOLVE_WORKFLOW_DEPENDENCIES:"agent:resolve-workflow-dependencies",GET_WORKFLOW_PERMISSIONS:"agent:get-workflow-permissions",SET_WORKFLOW_PERMISSIONS:"agent:set-workflow-permissions",SHARE_WORKFLOW:"agent:share-workflow",UNSHARE_WORKFLOW:"agent:unshare-workflow",CLONE_WORKFLOW:"agent:clone-workflow",MERGE_WORKFLOWS:"agent:merge-workflows",DIFF_WORKFLOWS:"agent:diff-workflows",GET_WORKFLOW_VERSIONS:"agent:get-workflow-versions",RESTORE_WORKFLOW_VERSION:"agent:restore-workflow-version",TAG_WORKFLOW_VERSION:"agent:tag-workflow-version",GET_WORKFLOW_TAGS:"agent:get-workflow-tags",REMOVE_WORKFLOW_TAG:"agent:remove-workflow-tag",SET_MODEL:"agent:set-model"},EVENTS:{QUERY:"events:query",SUBSCRIBE:"events:subscribe",UNSUBSCRIBE:"events:unsubscribe",EMIT:"events:emit",GET_LAST_EVENT:"events:getLastEvent",GET_STATISTICS:"events:getStatistics",GET_AGENT_SUBSCRIPTIONS:"events:get-agent-subscriptions",UNSUBSCRIBE_AGENT:"events:unsubscribe-agent"},AUGGIE:{INSTALL:"auggie:install",AUTHENTICATE:"auggie:authenticate",GET_MODELS:"auggie:get-models",GET_CONFIG:"auggie:get-config",UPDATE_CONFIG:"auggie:update-config",GET_LATEST_SESSION:"auggie:get-latest-session",EXTRACT_FILE_CHANGES:"auggie:extract-file-changes",GET_PATH:"auggie:get-path",GET_USER_INFO:"auggie:get-user-info",UNINSTALL_MCP_CLAUDE_CODE:"auggie:uninstall-mcp-claude-code",UNINSTALL_MCP_CODEX:"auggie:uninstall-mcp-codex",UNINSTALL_MCP_OPENCODE:"auggie:uninstall-mcp-opencode",UNINSTALL_MCP_CORTEX:"auggie:uninstall-mcp-cortex",UNINSTALL_MCP_PI:"auggie:uninstall-mcp-pi",UNINSTALL_MCP_DROID:"auggie:uninstall-mcp-droid"},OPENCODE:{GET_MODELS:"opencode:get-models"},CLAUDE_CODE:{GET_MODELS:"claude-code:get-models"},CODEX:{GET_MODELS:"codex:get-models"},CORTEX:{GET_MODELS:"cortex:get-models"},PI:{GET_MODELS:"pi:get-models"},DROID:{GET_MODELS:"droid:get-models"},GROK:{GET_MODELS:"grok:get-models"},UNSLOTH:{GET_MODELS:"unsloth:get-models"},ANTIGRAVITY:{GET_MODELS:"antigravity:get-models"},PROVIDERS:{GET_AVAILABILITY:"providers:get-availability",PREPARE_ADAPTERS:"providers:prepare-adapters",GET_PATHS:"providers:get-paths",CHECK_SINGLE:"providers:check-single"},FILE:{READ:"file:read",READ_CHUNK:"file:read-chunk",HASH:"file:hash",WRITE:"file:write",DELETE:"file:delete",EXISTS:"file:exists",LIST:"file:list",COPY:"file:copy",MOVE:"file:move",GET_INFO:"file:get-info",READ_DIR_WITH_STATS:"file:readDirWithStats",GET_GITIGNORE_PATTERNS:"file:getGitignorePatterns",READ_BATCH:"file:read-batch",MKDIR:"file:mkdir",GET_GIT_STATUS:"file:getGitStatus",GET_TREE_WITH_SIZES:"file:getTreeWithSizes",GET_DIRECTORY_STATUS:"file:getDirectoryStatus",DOWNLOAD:"file:download",DOWNLOAD_ATTACHMENT:"file:download-attachment"},PRIMITIVES:{CODEBASE_SEARCH:"codebase:search",TERMINAL_RUN:"terminal:runCommand",TERMINAL_KILL:"terminal:killProcess",TERMINAL_SUBSCRIBE:"terminal:subscribeOutput",AGENT_RUN:"agent:runAction"},SYSTEM:{GET_INFO:"system:get-info",GET_RESOURCES:"system:get-resources",OPEN_EXTERNAL:"system:open-external",SHOW_ITEM_IN_FOLDER:"system:show-item-in-folder",WRITE_CLIPBOARD:"system:write-clipboard",BEEP:"system:beep",HOME_DIRECTORY:"system:home-directory",EXECUTE_COMMAND:"system:execute-command",EXECUTE_COMMAND_STREAMING:"system:execute-command-streaming",CHECK_GIT:"system:check-git",CHECK_NODE:"system:check-node",CHECK_GH:"system:check-gh",CHECK_RTK:"system:check-rtk",LIST_FONTS:"system:list-fonts"},APP:{SET_BADGE:"app:set-badge",SET_LANGUAGE_PREFERENCE:"app:set-language-preference",VERSION:"app:version",GET_VERSION:"app:get-version",NAME:"app:name",PATH:"app:path",ROOT:"app:root",UI_NAVIGATE:"app:ui:navigate",UI_HIGHLIGHT:"app:ui:highlight",HISTORY_NAVIGATE:"app:history-navigate"},QUIT_CONFIRMATION:{SHOW:"quit-confirmation:show",ACK:"quit-confirmation:ack",RESPONSE:"quit-confirmation:response",DISMISS:"quit-confirmation:dismiss"},COLLABORATION_AUTH:{POLICY:"collaboration-auth:policy",OPEN:"collaboration-auth:open",SHOW:"collaboration-auth:show",ACTION:"collaboration-auth:action",DISMISS:"collaboration-auth:dismiss"},INVITE_CONSENT:{SHOW:"invite-consent:show",ACK:"invite-consent:ack",RESPONSE:"invite-consent:response",DISMISS:"invite-consent:dismiss"},INVITE_PROGRESS:{SHOW:"invite-progress:show",UPDATE:"invite-progress:update",ACK:"invite-progress:ack",RESPONSE:"invite-progress:response",DISMISS:"invite-progress:dismiss"},INVITE_NOTICE:{SHOW:"invite-notice:show",ACK:"invite-notice:ack",RESPONSE:"invite-notice:response",DISMISS:"invite-notice:dismiss"},WINDOW:{RELOAD:"window:reload",TOGGLE_DEVTOOLS:"window:toggle-devtools",MINIMIZE:"window:minimize",MAXIMIZE:"window:maximize",CLOSE:"window:close",CREATE:"window:create",OPEN_NEW:"window:open-new",SET_THEME:"window:set-theme",SET_TRANSLUCENCY:"window:set-translucency",GET_ZOOM_FACTOR:"window:get-zoom-factor",SET_TITLE:"window:set-title",SET_IN_WORKSPACE:"window:set-in-workspace",SET_OPEN_WORKSPACE_TABS:"window:set-open-workspace-tabs",SET_BROWSER_FOCUSED:"window:set-browser-focused",SET_FULL_SCREEN:"window:set-full-screen",GET_FULL_SCREEN:"window:get-full-screen",SET_DOCK_POINTER_REGION:"window:set-dock-pointer-region",FOCUS_DOCK:"window:focus-dock",GET_DOCK_PLACEMENT:"window:get-dock-placement",UPDATE_DOCK_PLACEMENT:"window:update-dock-placement",SHOW_DOCK_MENU:"window:show-dock-menu",SWITCH_DOCK_BACKEND:"window:switch-dock-backend",DOCK_BACKEND_SWITCH_FAILED:"window:dock-backend-switch-failed",DOCK_PLACEMENT_CHANGED:"window:dock-placement-changed",DOCK_POINTER_PRESENCE_CHANGED:"window:dock-pointer-presence-changed",DOCK_RENDERER_READY:"window:dock-renderer-ready",GET_DOCK_LAB:"window:get-dock-lab",SET_DOCK_LAB:"window:set-dock-lab",DOCK_LAB_CHANGED:"window:dock-lab-changed",CYCLE_FOCUS:"window:cycle-focus"},DOCK_EVIDENCE:{BEGIN:"dock-evidence:begin",CAPTURE:"dock-evidence:capture",CANCEL:"dock-evidence:cancel",CONTROL:"dock-evidence:control",EVENT:"dock-evidence:event"},DOCK_ANNOTATION:{READY:"dock-annotation:ready",POINTER:"dock-annotation:pointer",GESTURE:"dock-annotation:gesture",GET_STILL:"dock-annotation:get-still",STATE:"dock-annotation:state",TOOLBAR:"dock-annotation:toolbar"},POWER:{GET_BATTERY_STATE:"power:get-battery-state",BATTERY_CHANGED:"power:battery-changed"},TERMINAL:{CREATE_WITH_COMMAND:"terminal:createWithCommand",PROFESSIONAL_CREATE:"terminal:professional:create",PROFESSIONAL_LIST:"terminal:professional:list",PROFESSIONAL_WRITE:"terminal:professional:write",PROFESSIONAL_RESIZE:"terminal:professional:resize",PROFESSIONAL_INFO:"terminal:professional:info",PROFESSIONAL_REFRESH:"terminal:professional:refresh",PROFESSIONAL_DISPOSE:"terminal:professional:dispose",PROFESSIONAL_GET_BUFFER:"terminal:professional:get-buffer"},GIT:{STATUS:"git:status",STATUS_CHANGED:"git:status-changed",AUTH_REQUIRED:"git:auth-required",KEYCHAIN_ACCESS_WARNING:"git:keychain-access-warning",KEYCHAIN_CONSENT_RESPOND:"git:keychain-consent-respond",CHECK_KEYCHAIN_RISK:"git:check-keychain-risk",DIFF:"git:diff",NUMSTAT:"git:numstat",COMMIT:"git:commit",COMMIT_DETAILS:"git:commit-details",PUSH:"git:push",PULL:"git:pull",BRANCH:"git:branch",CHECKOUT:"git:checkout",LOG:"git:log",HISTORY:"git:history",GET_BRANCHES:"git:getBranches",STAGE:"git:stage",UNSTAGE:"git:unstage",STAGE_HUNK:"git:stage-hunk",UNSTAGE_HUNK:"git:unstage-hunk",DISCARD:"git:discard",REMOVE_LOCK:"git:removeLock",SHOW_FILE:"git:show-file",FILE_HISTORY:"git:file-history",RENAME_BRANCH:"git:rename-branch",PULL_BRANCH:"git:pullBranch",GET_BRANCH_STATUS:"git:getBranchStatus",GET_REMOTES:"git:getRemotes",FETCH:"git:fetch"},CONFIG:{GET:"config:get",SET:"config:set",DELETE:"config:delete",GET_ALL:"config:get-all",RESET:"config:reset"},SETTINGS:{GET:"settings:get",SET:"settings:set",GET_ALL:"settings:getAll",UPDATE:"settings:update"},FEATURE_CODES:{ACTIVATE:"feature-codes:activate",GET_ACTIVE:"feature-codes:get-active",DEACTIVATE:"feature-codes:deactivate",RESTART_APP:"feature-codes:restart-app"},USER_MCP:{AUTHENTICATE:"user-mcp:authenticate",CHECK_AUTH:"user-mcp:check-auth",TEST_CONNECTION:"user-mcp:test-connection"},NOTIFICATION:{TEST:"notification:test",REQUEST_PERMISSION:"notification:requestPermission",SHOW:"notification:show"},DIALOG:{MESSAGE:"dialog:message",OPEN:"dialog:open"},VOICE:{LOCAL_AVAILABLE:"voice:local-available",TRANSCRIBE_LOCAL:"voice:transcribe-local",REQUEST_LOCAL_AUTHORIZATION:"voice:request-local-authorization"},SHELL:{OPEN:"shell:open",OPEN_PATH:"shell:openPath",OPEN_EXTERNAL:"shell:openExternal",TRASH_ITEM:"shell:trashItem",SHOW_ITEM_IN_FOLDER:"shell:showItemInFolder"},EDITOR:{GET_SELECTION:"editor:get-selection"},EXTERNAL_EDITORS:{DETECT_INSTALLED:"external-editors:detect-installed",OPEN:"external-editors:open",OPEN_WITH_OTHER:"external-editors:open-with-other"},FIRST_VISIT:{LOAD:"first-visit-state:load",SAVE:"first-visit-state:save",DELETE:"first-visit-state:delete",EXISTS:"first-visit-state:exists"},PANEL_LAYOUT:{LOAD:"panel-layout:load",SAVE:"panel-layout:save"},BROWSER:{REGISTER_TAB:"browser:register-tab",UNREGISTER_TAB:"browser:unregister-tab",REPORT_TAB_BOUNDS:"browser:report-tab-bounds",SET_TAB_VIEWPORT:"browser:set-tab-viewport",OPEN_DEVTOOLS_PANEL:"browser:open-devtools-panel",EXEC:"browser:exec",RESOLVE_URL:"browser:resolve-url",FOCUS_TAB:"browser:focus-tab",SHOW_TAB:"browser:show-tab",LIST_TABS_REQUEST:"browser:list-tabs-request",HOST_WORKSPACE:"browser:host-workspace",CAPTURE_DRAWING:"browser:capture-drawing",AGENT_DRAWING:"browser:agent-drawing",BACKGROUND_HOSTED_WORKSPACES:"browser:background-hosted-workspaces",LIST_TABS_RESPONSE:"browser:list-tabs-response",OPEN_TAB:"browser:open-tab",DIAGNOSE_TAB:"browser:diagnose-tab",CLOSE_TAB:"browser:close-tab",TAB_NAVIGATED:"browser:tab-navigated",TAB_OWNER_CHANGED:"browser:tab-owner-changed",CLEAR_AGENT_TABS:"browser:clear-agent-tabs"},FILE_TRACKING:{AGENT_FILE_CHANGED:"file-tracking:agent-file-changed"},STREAMING:{START:"streaming:start",STOP:"streaming:stop",PAUSE:"streaming:pause",RESUME:"streaming:resume",GET_STATS:"streaming:get-stats"},AGENT_CONFIG:{GET:"agent-config:get",UPDATE:"agent-config:update",RESET:"agent-config:reset"},LOG:{TRACK_FILE_CHANGE:"log:track-file-change",TRACK_AGENT_EVENT:"log:track-agent-event",TRACK_MCP_CALL:"log:track-mcp-call",PATHS:"log:paths",READ:"log:read",CLEAR:"log:clear",SUMMARY:"log:summary",EXPORT_DEBUG_BUNDLE:"log:export-debug-bundle",PERSIST_RENDERER_LOGS:"log:persist-renderer-logs"},USER_RULES:{GET:"user-rules:get",SET:"user-rules:set",DELETE:"user-rules:delete",GET_ALL:"user-rules:get-all",GET_FORMATTED:"user-rules:get-formatted",SET_ENABLED:"user-rules:set-enabled",EXPORT:"user-rules:export",IMPORT:"user-rules:import",GET_COMBINED_PROMPT:"user-rules:get-combined-prompt",UPDATE:"user-rules:update",GET_BY_TYPE:"user-rules:get-by-type",GET_FORMATTED_BY_TYPE:"user-rules:get-formatted-by-type",UPDATE_BY_TYPE:"user-rules:update-by-type",SET_ENABLED_BY_TYPE:"user-rules:set-enabled-by-type",DELETE_BY_TYPE:"user-rules:delete-by-type",EXPORT_BY_TYPE:"user-rules:export-by-type"},VSCODE:{OPEN:"vscode:open",OPEN_FILE:"vscode:openFile",OPEN_DIFF:"vscode:open-diff",OPEN_GIT_DIFF:"vscode:open-git-diff"},JETBRAINS:{OPEN:"jetbrains:open"},XCODE:{OPEN:"xcode:open"},DEEP_LINK:{HANDLE:"deep-link:handle",CONSUME_PENDING:"deep-link:consume-pending"},LEGACY:{GET_HOME_DIRECTORY:"get_home_directory"},RULES:{LIST:"rules:list",LOAD_WORKSPACE:"rules:load-workspace",GET_CONTEXT:"rules:get-context"},CONFIG_RULES:{GET_ALL:"config:getAll"},USER_ACTIVITY:{MARK_NOTE_READ:"user-activity:mark-note-read",GET_NOTE_READ_STATUS:"user-activity:get-note-read-status",GET_UNREAD_NOTE_IDS:"user-activity:get-unread-note-ids"},GIT_TRACKING:{GET_STATE:"git-tracking:get-state",GET_SYNC_STATUS:"git-tracking:get-sync-status",SYNC:"git-tracking:sync",GET_FILE_DIFF:"git-tracking:get-file-diff",IS_GITHUB_AUTHENTICATED:"git-tracking:is-github-authenticated",GET_GITHUB_BRANCHES:"git-tracking:get-github-branches",GET_PULL_REQUESTS:"git-tracking:get-pull-requests",SEARCH_PULL_REQUESTS:"git-tracking:search-pull-requests",GET_PULL_REQUEST:"git-tracking:get-pull-request",CREATE_PULL_REQUEST:"git-tracking:create-pull-request",GET_GITHUB_ISSUES:"git-tracking:get-github-issues",SEARCH_GITHUB_ISSUES:"git-tracking:search-github-issues",LIST_RELATED_REPOS:"git-tracking:list-related-repos",GET_REMOTE_URL:"git-tracking:get-remote-url",GET_CHECK_RUNS:"git-tracking:get-check-runs",GET_PR_REVIEWS:"git-tracking:get-pr-reviews"},GITHUB_AUTH:{IS_AUTHENTICATED:"github-auth:is-authenticated",GET_USER:"github-auth:get-user",START_AUTH:"github-auth:start",POLL_FOR_TOKEN:"github-auth:poll",CANCEL_AUTH:"github-auth:cancel",LOGOUT:"github-auth:logout",GET_AUTH_STATE:"github-auth:get-auth-state",GET_STATUS:"github-auth:get-status",LIST_REPOS:"github-auth:list-repos",SEARCH_REPOS:"github-auth:search-repos",SEARCH_USERS:"github-auth:search-users"},FORGE_AUTH:{GET_STATUS:"forge-auth:get-status",CONNECT:"forge-auth:connect",CANCEL_AUTH:"forge-auth:cancel",REVOKE:"forge-auth:revoke",GET_USER:"forge-auth:get-user"},LINEAR_AUTH:{IS_AUTHENTICATED:"linear-auth:is-authenticated",START_AUTH:"linear-auth:start-auth",CANCEL_AUTH:"linear-auth:cancel-auth",LOGOUT:"linear-auth:logout",GET_AUTH_STATE:"linear-auth:get-auth-state",GET_STATUS:"linear-auth:get-status",FETCH_MY_ISSUES:"linear-auth:fetch-my-issues",SEARCH_ISSUES:"linear-auth:search-issues"},SENTRY_AUTH:{IS_AUTHENTICATED:"sentry-auth:is-authenticated",SAVE_CONFIG:"sentry-auth:save-config",GET_AUTH_STATE:"sentry-auth:get-auth-state",LOGOUT:"sentry-auth:logout",FETCH_PROJECTS:"sentry-auth:fetch-projects",FETCH_ISSUES:"sentry-auth:fetch-issues",SEARCH_ISSUES:"sentry-auth:search-issues",GET_ISSUE:"sentry-auth:get-issue"},OBSERVABILITY_EXT:{},AGENT_TESTING:{RUN:"agent-testing:run",GET_REPORT:"agent-testing:get-report",GET_AGENT_REPORTS:"agent-testing:get-agent-reports",CLEANUP:"agent-testing:cleanup"},DEBUG:{TRIGGER_BACKEND_RESUME:"debug:trigger-backend-resume",LIST_AGENTS:"debug:list-agents"},SETUP_SCRIPTS:{GENERATE:"setup-scripts:generate",READ_REPO_CONFIG:"setup-scripts:read-repo-config",DETECT_TYPE:"setup-scripts:detect-type",GENERATE_WITH_AGENT:"setup-scripts:generate-with-agent",STOP_AGENT:"setup-scripts:stop-agent",STREAM_CHUNK:"setup-scripts:stream-chunk",STREAM_COMPLETE:"setup-scripts:stream-complete",STREAM_ERROR:"setup-scripts:stream-error"},GIT_EXT:{IS_REPOSITORY:"git:isRepository",GET_AUTO_COMMIT_STATUS:"git:get-auto-commit-status",GET_BACKGROUND_OPS_STATUS:"git:background-ops-status"},ACCEPT_CHANGES:{CHECK_PATH_HAS_CHANGES:"accept-changes:check-path-has-changes"},CHAT_EXPORT:{CHAT_TO_HTML:"export:chat-to-html"},FILE_EXT:{},COMMENTS_EXT:{},WORKSPACE_EXT:{},AGENT_LAUNCH:{},AGENT_CONTEXT:{GET:"agent-context:get"},RECOVERY:{NEEDS_RECOVERY:"recovery:needs-recovery",MARK_STREAMING:"recovery:mark-streaming",MARK_COMPLETE:"recovery:mark-complete",CLEAR_STREAMING:"recovery:clear-streaming",CHECK_NEEDS_RECOVERY:"recovery:check-needs-recovery",GET_STATUS:"recovery:get-status",CREATE_CHECKPOINT:"recovery:create-checkpoint",RESTORE_CHECKPOINT:"recovery:restore-checkpoint",RECOVER_SESSION:"recovery:recover-session",GET_STATS:"recovery:get-stats"},STORAGE:{SAVE:"storage:save",DELETE:"storage:delete"},AUTO_UPDATE:{CHECK_MANUAL:"auto-update:check-manual",DOWNLOAD:"auto-update:download",INSTALL:"auto-update:install",GET_STATE:"auto-update:get-state",SET_CHANNEL:"auto-update:set-channel",SET_SHARE_STATISTICS:"auto-update:set-share-statistics",STATUS_CHANGED:"auto-update:status-changed",PROGRESS:"auto-update:progress",ERROR:"auto-update:error",UP_TO_DATE:"auto-update:up-to-date",SHOW_TOAST:"auto-update:show-toast"},RELEASE_NOTES:{GET:"release-notes:get",GET_PENDING:"release-notes:get-pending",DISMISS:"release-notes:dismiss",SHOW:"release-notes:show",CLOSE:"release-notes:close"},PIP:{OPEN:"pip:open",CLOSE:"pip:close",CLOSE_ALL_FOR_WORKSPACE:"pip:close-all-for-workspace"},BROWSER_ACCESS:{GET_STATE:"browser-access:get-state",SET_ENABLED:"browser-access:set-enabled",SET_PORT:"browser-access:set-port",RESET_KEY:"browser-access:reset-key",CREATE_SIGN_IN_CODE:"browser-access:create-sign-in-code"},WEBSOCKET_API:{GET_STATUS:"websocket-api:get-status",SET_ENABLED:"websocket-api:set-enabled",REGENERATE_TOKEN:"websocket-api:regenerate-token",SET_DISCOVERY:"websocket-api:set-discovery"},TOKEN_USAGE:{GET:"token-usage:get",CHANGED:"token-usage:changed"},BACKEND:{DESKTOP_PERMISSIONS:"backend:desktop-permissions",REQUEST:"backend:request",PR_MONITOR:{READY:"backend:pr-monitor:ready",CAPTURE:"backend:pr-monitor:capture",REQUEST:"backend:pr-monitor:request",RELEASE:"backend:pr-monitor:release",RETIRED:"backend:pr-monitor:retired",NOTIFICATION:"backend:pr-monitor:notification"},NATIVE_REVIEW:{PREPARE:"backend:native-review:prepare",EXECUTE:"backend:native-review:execute",RECONCILE:"backend:native-review:reconcile",RELEASE:"backend:native-review:release",RETIRED:"backend:native-review:retired"},REPOSITORY_SELECTION:{CAPTURE:"backend:repository-selection:capture",CONFIRM:"backend:repository-selection:confirm",RECONCILE:"backend:repository-selection:reconcile",RELEASE:"backend:repository-selection:release",RETIRED:"backend:repository-selection:retired"},REPOSITORY_CHECKOUT:{CAPTURE:"backend:repository-checkout:capture",REQUEST:"backend:repository-checkout:request",RELEASE:"backend:repository-checkout:release",RETIRED:"backend:repository-checkout:retired"},REPOSITORY_RESOURCE:{CAPTURE:"backend:repository-resource:capture",DETAIL:"backend:repository-resource:detail",RELEASE:"backend:repository-resource:release",RETIRED:"backend:repository-resource:retired"},REPOSITORY:{CAPTURE:"backend:repository:capture",RETIRED:"backend:repository:retired",REQUEST:"backend:repository:request",RELEASE:"backend:repository:release"},SUBSCRIBE:"backend:subscribe",UNSUBSCRIBE:"backend:unsubscribe",GET_STATUS:"backend:get-status",NODE_CAPABILITIES:"backend:node-capabilities",READ_PRINCIPAL:"backend:read-principal",NOTIFICATION:"backend:notification",STATUS:"backend:status",SPAWN_SIDECAR:"backend:spawn-sidecar",OPEN_LOCAL_AND_SPAWN:"backend:open-local-and-spawn",GET_SIDECAR_RUN_LOG:"backend:get-sidecar-run-log",RESTART_ORPHANED_SIDECAR:"backend:restart-orphaned-sidecar"},CONNECTIONS:{LIST:"connections:list",CAPTURE_FINGERPRINT:"connections:capture-fingerprint",ADD:"connections:add",UPDATE:"connections:update",TEST:"connections:test",ROTATE_SECRET:"connections:rotate-secret",GET_TUNNEL:"connections:get-tunnel",SET_TUNNEL:"connections:set-tunnel",OPEN:"connections:open",FORGET:"connections:forget",PAIR_LINK_INSPECT:"connections:pair-link-inspect",PAIR_LINK_COMMIT:"connections:pair-link-commit",PAIR_LINK_DISCARD:"connections:pair-link-discard",UPDATE_BACKEND:"connections:update-backend",CHANGED:"connections:changed",CERT_MISMATCH:"connections:cert-mismatch",CERT_WARNINGS:"connections:cert-warnings",PROTOCOL_MISMATCH:"connections:protocol-mismatch",AUTH_REJECTED:"connections:auth-rejected",SYNC_GET_STATE:"connections:sync-get-state",SYNC_SET_ENABLED:"connections:sync-set-enabled",SYNC_STATUS_CHANGED:"connections:sync-status-changed",PUBLISH_SELF:"connections:publish-self",SELF_PUBLISHED_STATE:"connections:self-published-state",REFRESH_SELF:"connections:refresh-self",UNPUBLISH_SELF:"connections:unpublish-self"},GUEST_SESSIONS:{LIST:"guest-sessions:list",LEAVE:"guest-sessions:leave",LEAVE_WORKSPACE:"guest-sessions:leave-workspace",CHANGED:"guest-sessions:changed"},PRESENCE:{REPORT:"presence:report"},TRANSFER:{START:"transfer:start",FINALIZE:"transfer:finalize",CANCEL:"transfer:cancel",PROGRESS:"transfer:progress",IMPORT_START:"transfer:import-start",IMPORT_CANCEL:"transfer:import-cancel",IMPORT_PROGRESS:"transfer:import-progress"},REMOTE_MACHINES:{EXPOSE:"remote-machines:expose",UNEXPOSE:"remote-machines:unexpose",MACHINE_FINGERPRINT:"remote-machines:machine-fingerprint",INVITE_INSPECT:"remote-machines:invite-inspect",INVITE_CLAIM:"remote-machines:invite-claim",INVITE_DISCARD:"remote-machines:invite-discard"},HARDWARE_CONSOLE:{CLEAR_LIGHTING:"hardware-console:clear-lighting",CLEAR_LIGHTING_DONE:"hardware-console:clear-lighting-done",GET_OWNER_STATUS:"hardware-console:get-owner-status",OWNER_CHANGED:"hardware-console:owner-changed"}},d={"global.command-palette":"mod+shift+p","global.settings":"mod+,","global.keyboard-shortcuts":"mod+?","global.command-palette-alt":"mod+k","global.toggle-spaces":"mod+o","global.new-space":"mod+n","global.search":"mod+f","global.next-space":"ctrl+tab","global.previous-space":"ctrl+shift+tab","global.next-space-alt":"mod+shift+]","global.previous-space-alt":"mod+shift+[","navigation.go-to-tab":"mod+1-9","navigation.new-tab":"mod+t","navigation.close-tab":"mod+w","navigation.close-space-tab":"mod+shift+w","navigation.reopen-tab":"mod+shift+t","navigation.move-space-tab-left":"mod+alt+shift+left","navigation.move-space-tab-right":"mod+alt+shift+right","workspace.new-agent":"mod+alt+a","workspace.new-note":"mod+alt+n","workspace.new-terminal":"mod+alt+t","workspace.new-browser":"mod+alt+b","workspace.set-aside":"mod+shift+s","chat.send":"enter","chat.force-send":"mod+enter","chat.new-line":"shift+enter","chat.focus-input":"/","chat.mention-context":"@","editor.go-to-line":"mod+g","editor.save":"mod+s","editor.undo":"mod+z","editor.redo":"mod+shift+z","editor.toggle-task-list":"mod+shift+9","editor.toggle-word-wrap":"alt+z","editor.copy":"mod+c","editor.select-all":"mod+a","panel.toggle-sidebar":"mod+b","panel.create-column-right":"mod+\\","panel.focus-next-column":"mod+alt+right","panel.maximize":"mod+shift+m","panel.focus-previous-column":"mod+alt+left","panel.next-pane":"mod+]","panel.previous-pane":"mod+[","panel.move-pane-next-column":"mod+alt+pagedown","panel.move-pane-previous-column":"mod+alt+pageup","panel.copy-browser-url":"mod+shift+c","leader.navigate-panels":"h/j/k/l","leader.resize-panels":"H/J/K/L","leader.split-right":"%","leader.toggle-zoom":"z","leader.close-panel":"x","leader.next-previous-panel":"o/p","leader.equalize-sizes":"=","leader.jump-to-panel":"q + 1-9","leader.cycle-layout":"space"},L=["mod","ctrl","alt","shift"],P={mod:"mod",cmd:"mod",command:"mod",meta:"mod",control:"ctrl",ctrl:"ctrl",option:"alt",alt:"alt",shift:"shift"},K={escape:"esc",return:"enter",arrowup:"up",arrowdown:"down",arrowleft:"left",arrowright:"right",pgup:"pageup",pgdn:"pagedown"," ":"space"},Ee=new Set(["backspace","delete","down","end","enter","esc","f1","f2","f3","f4","f5","f6","f7","f8","f9","f10","f11","f12","home","left","pagedown","pageup","right","space","tab","up"]),ce=new Set(["alt","control","meta","shift"]),M={"~":"`","!":"1","@":"2","#":"3",$:"4","%":"5","^":"6","&":"7","*":"8","(":"9",")":"0",_:"-","+":"=","{":"[","}":"]","|":"\\",":":";",'"':"'","<":",",">":".","?":"/"},Te=Object.fromEntries(Object.entries(M).map(([e,t])=>[t,e]));function be(e,t){if(ce.has(e.key.toLowerCase())||!t&&e.metaKey)return null;let s=e.key;e.altKey&&e.code?.startsWith("Key")?s=e.code.slice(3):e.altKey&&e.code?.startsWith("Digit")&&(s=e.code.slice(5));const o=[];return(t&&e.metaKey||!t&&e.ctrlKey)&&o.push("mod"),t&&e.ctrlKey&&o.push("ctrl"),e.altKey&&o.push("alt"),e.shiftKey&&o.push("shift"),o.push(s),k(o.join("+"))}function le(e){return Object.prototype.hasOwnProperty.call(d,e)}function m(e){const t=e.trim();if(!t||t.includes("/"))return null;const s=t.split("+").map(r=>r.trim()).filter(Boolean);if(s.length===0)return null;const o=new Set;for(const r of s.slice(0,-1)){const c=P[r.toLowerCase()];if(!c||o.has(c))return null;o.add(c)}const n=s.at(-1)??"";if(P[n.toLowerCase()])return null;const a=K[n.toLowerCase()]??n.toLowerCase();return a.length===1||Ee.has(a)?{key:a,mod:o.has("mod"),ctrl:o.has("ctrl"),alt:o.has("alt"),shift:o.has("shift")}:null}function k(e){const t=e.trim();if(t.includes("/")){const r=t.split("/").map(S=>S.trim()),c=r[0]??"",l=c.includes("+")?`${c.slice(0,c.lastIndexOf("+"))}+`:"",p=r.map((S,I)=>{const g=I>0&&l&&!S.includes("+")?l+S:S,C=g.slice(g.lastIndexOf("+")+1),N=m(/^[A-Z]$/.test(C)?`${g.slice(0,-1)}shift+${C.toLowerCase()}`:g);return N?[...L.filter(j=>N[j]),N.key].join("+"):null});return p.some(S=>!S)?null:p.join("/")}const s=t.match(/^(.*\+)?([1-8])-9$/i);if(s){const r=m(`${s[1]??""}${s[2]}`);if(!r)return null;const c=L.filter(l=>r[l]);return`${c.length?`${c.join("+")}+`:""}${s[2]}-9`}const o=t.match(/^(.+?)\s+\+\s+([1-8]-9)$/);if(o){const r=k(o[1]);return r?`${r} + ${o[2]}`:null}const n=m(e);return n?[...L.filter(r=>n[r]),n.key].join("+"):null}function De(e,t){const s=d[e],o=t.includes("+")?`${t.slice(0,t.lastIndexOf("+"))}+`:"",n=s.match(/^(.+?)\s+\+\s+([1-8]-9)$/);if(n)return`${t} + ${n[2]}`;const a=s.match(/^(?:.*\+)?([1-8]-9)$/);return a?`${o}${a[1]}`:s.includes("/")?`${o}${s}`:t}function Ue(e){return e.match(/^(.+?)\s+\+\s+[1-8]-9$/)?.[1]??null}function Se(e){const t=e.match(/^(.*\+)?([1-8])-9$/);if(t){const a=t[1]??"";return Array.from({length:10-Number(t[2])},(r,c)=>`${a}${Number(t[2])+c}`)}const s=e.split("/"),o=s[0]??"",n=o.includes("+")?`${o.slice(0,o.lastIndexOf("+"))}+`:"";return s.map((a,r)=>{const c=a.trim(),l=r>0&&n&&!c.includes("+")?n+c:c;return/^[A-Z]$/.test(l)?`shift+${l.toLowerCase()}`:l==="space"?"space":l})}function _e(e,t,s){return Se(t).findIndex(o=>ue(e,o,s))}function ue(e,t,s){const o=m(t);if(!o)return!1;const n=K[e.key.toLowerCase()]??e.key.toLowerCase(),a=o.key.length===1&&'~!@#$%^&*()_+{}|:"<>?'.includes(o.key);return new Set([n,M[n],e.shiftKey?Te[n]:void 0]).has(o.key)&&e.metaKey===(o.mod&&s)&&e.ctrlKey===(o.ctrl||o.mod&&!s)&&e.altKey===o.alt&&e.shiftKey===(o.shift||a)}function ye(e){if(!e||typeof e!="object"||Array.isArray(e))return{};const t={};for(const[s,o]of Object.entries(e)){if(!le(s)||typeof o!="string")continue;const n=k(o);n&&n!==d[s]&&(t[s]=n)}return t}function He(e,t){return t[e]??d[e]}function Ke(e,t,s,o){return s(e)!==d[e]?!1:Object.keys(d).some(n=>{if(n===e||n.startsWith("leader."))return!1;const a=s(n);return a===d[n]?!1:_e(t,a,o)>=0})}function R(e){if(/[\u0000-\u0020\u007f\\]/.test(e))return null;const t=/^https:\/\/([^/?#]+)([^?#]*)/i.exec(e);if(!t||/[@%]/.test(t[1]))return null;try{const s=new URL(e);if(s.protocol!=="https:"||s.username||s.password)return null;const o=t[2].replace(/\/$/,""),n=o?o.slice(1).split("/"):[];return n.some(a=>!/^[A-Za-z0-9_.-]+$/.test(a)||a==="."||a==="..")?null:{url:s,path:n}}catch{return null}}function G(e){const t=R(e);return!!t&&!t.url.search&&!t.url.hash&&e===t.url.origin+(t.path.length?`/${t.path.join("/")}`:"")}function Me(e,t){if(!G(t))return null;const s=R(e),o=R(t);if(!s||!o||o.url.origin!==s.url.origin||!o.path.every((a,r)=>s.path[r]===a))return null;const n=s.path.slice(o.path.length);return n.length<2||n[0]==="groups"||n.includes("-")?null:{provider:"gitlab",instanceBaseUrl:t,projectPath:n.join("/")}}function ge(e,t){const s=R(e);if(!s)return null;let o=null;for(const n of t){if(n.provider!=="gitlab"||!G(n.instanceBaseUrl))continue;const a=R(n.instanceBaseUrl);if(!a||a.url.origin!==s.url.origin||!a.path.every((C,N)=>s.path[N]===C))continue;const r=s.path.slice(a.path.length),c=r.indexOf("-");if(c<2||r[0]==="groups")continue;const[l,p,...S]=r.slice(c+1),I=l==="merge_requests"?"merge-request":l==="issues"?"issue":null;if(!I||!/^[1-9]\d*$/.test(p??"")||!Number.isSafeInteger(Number(p))||S.length&&(I!=="merge-request"||S.length!==1||!["diffs","commits","pipelines"].includes(S[0])))continue;const g={repository:{provider:"gitlab",instanceBaseUrl:n.instanceBaseUrl,projectPath:r.slice(0,c).join("/")},kind:I,number:Number(p)};if(o&&JSON.stringify(o)!==JSON.stringify(g))return null;o=g}return o}function ve(e){const t=R(e);return t?ge(e,[{provider:"gitlab",instanceBaseUrl:t.url.origin}])!==null:!1}const v="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",W="([01]\\d|2[0-3]):[0-5]\\d(:[0-5]\\d(\\.\\d+)?)?",de=new RegExp(`^${v}T${W}(Z)$`),pe=new RegExp(`^${v}T${W}(Z|([+-]\\d{2}:?\\d{2}))$`);function b(e={}){return i().regex(e.offset?pe:de,e.message??"Invalid datetime")}function F(e="Invalid url"){return i().refine(t=>URL.canParse(t),e)}const D=i().regex(/^(0|[1-9][0-9]*)$/).refine(e=>/^(0|[1-9][0-9]*)$/.test(e)&&BigInt(e)<=18446744073709551615n),We=E({target:T(["local","remote"]),checkout:T(["shared","worktree","isolated"]),os:T(["linux","macos"]).optional(),nodeId:i().min(1).optional(),exclusive:u().optional()}).strict().refine(e=>e.target!=="remote"||e.checkout==="isolated").refine(e=>!e.exclusive||e.target==="remote"&&e.checkout==="isolated"),B=E({target:T(["local","remote","e2b"]).optional(),checkout:T(["shared","worktree","isolated"]).optional(),os:T(["linux","macos"]).optional(),arch:T(["x86_64","aarch64"]).optional(),nodeId:i().min(1).refine(e=>new TextEncoder().encode(e).length<=128).optional(),exclusive:u().optional(),cloudMachineId:i().min(1).refine(e=>new TextEncoder().encode(e).length<=64).optional()}).strict(),Fe=B.refine(e=>e.target!=="remote"||(e.checkout??"isolated")==="isolated").refine(e=>e.cloudMachineId===void 0||e.target==="e2b").refine(e=>e.target!=="e2b"||(e.checkout??"isolated")==="isolated"&&!e.os&&!e.arch&&!e.nodeId&&!e.exclusive).refine(e=>!e.exclusive||e.target!=="local"&&(e.checkout??"isolated")==="isolated"),Ae=B.extend({target:T(["local","remote","e2b"]),checkout:T(["shared","worktree","isolated"])}).refine(e=>e.target!=="remote"||e.checkout==="isolated").refine(e=>!e.exclusive||e.target!=="local"&&e.checkout==="isolated"),Re=E({id:i().min(1),assignmentEpoch:D,captureRevision:D,capturedAt:b({offset:!0}),committedAt:b({offset:!0})}),Oe=E({state:T(["pending","running","completed","failed","skipped"]),exitCode:w().int().optional(),error:i().optional(),startedAt:i().optional(),finishedAt:i().optional(),output:i().optional(),outputTruncated:u().optional()}),Be=E({nodeId:i().min(1).optional(),leaseId:i().min(1).optional(),nodeName:i().min(1).optional(),placement:Ae.optional(),effectiveIsolation:T(["pending","isolated","shared","worktree","direct","cow"]).optional(),nodeState:T(["ready","offline","incompatible","removed"]).optional(),checkpoint:Re.optional(),placementError:E({code:i(),detail:i()}).optional(),cloudStart:E({step:i().min(1)}).passthrough().optional().catch(void 0),setup:Oe.optional().catch(void 0),nodePath:i().optional()}),_=i().min(1),A=F().refine(e=>{const t=new URL(e);return t.protocol==="https:"&&!t.username&&!t.password}),x=A.refine(e=>G(e)),V=w().int().nonnegative().max(Number.MAX_SAFE_INTEGER),O=i().max(1024).regex(/^[A-Za-z0-9_.-]+(?:\/[A-Za-z0-9_.-]+)+$/).refine(e=>e.split("/").every(t=>t!=="."&&t!=="..")),f=i().regex(/^[0-9a-fA-F]{40}$/),Y=E({checkoutId:_,revision:_}).strict(),xe=E({provider:h("gitlab"),instanceBaseUrl:x.optional()}).strict(),Ve=Y.extend({provider:h("gitlab"),instanceBaseUrl:x,expiresAfterMs:V}).strict(),$=E({projectPath:O,name:i(),namespace:i(),webUrl:A,cloneUrl:A,defaultBranch:_.optional(),ownerAvatarUrl:F().pipe(A).optional().catch(void 0)}).strict(),Ie=E({name:_,commitSha:f,protected:u().optional()}).strict(),Ne=E({query:i().trim().refine(e=>new TextEncoder().encode(e).length<=256&&!/[\u0000-\u001f\u007f]/.test(e)).optional(),cursor:_.optional(),limit:w().int().positive().max(100).optional()}).strict(),Ye=ee([E({projectPath:O}).strict(),E({url:A}).strict()]),$e=Ne.extend({projectPath:O,cached:u().optional()}).strict(),he=Y.extend({projectPath:O,branch:_,commitSha:f,mode:T(["direct","cached"])}).strict(),Xe=he.omit({mode:!0}).strict(),je=E({projectPath:O,branch:_,commitSha:f,config:te(i(),U()).nullable(),exists:u()}).strict().refine(e=>e.exists===(e.config!==null)),qe=E({items:y($),nextCursor:_.optional()}).strict(),ze=E({project:$,contextUrl:A.optional()}).strict(),Qe=E({items:y(Ie),nextCursor:_.optional(),defaultBranch:_.optional(),cached:u()}).strict(),Ze=E({projectPath:O,branch:_,commitSha:f,cached:u()}).strict(),X=E({status:h("unavailable"),reason:T(["disabled","not-connected","access-denied","rate-limited","unreachable","retired","not-found","invalid-target","empty-repository","branch-changed"]),retryAfterMs:V.optional()}).strict();function Je(e){return oe("status",[E({status:h("ready"),value:e}).strict(),X])}function et(e,t){if(E({status:T(["ready","unavailable"])}).passthrough().parse(t).status==="unavailable")return X.parse(t);const o=E({status:h("ready"),value:U()}).strict().parse(t);return{status:"ready",value:e.parse(o.value)}}export{Re as A,le as B,$e as C,b as D,we as E,ue as F,_e as G,k as H,Pe as I,et as J,Me as K,ge as L,He as M,ye as N,be as O,d as S,Be as a,Fe as b,We as c,Qe as d,xe as e,Ve as f,Ne as g,ze as h,Ye as i,$ as j,qe as k,Xe as l,je as m,he as n,Ze as o,De as p,re as q,Je as r,ae as s,H as t,Ue as u,Ge as v,G as w,ke as x,Ke as y,ve as z};
@@ -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,Z as ce,ai as q,ar as Ce}from"./DmYZE-MO.js";import{bU as Le,cS as le,cj as ue,ci as ve}from"./DCPTVyDU.js";import{Hp as p,Ai as we,bA as be,c as Fe,Js as de,i2 as me,bM as ke,Cd as z,AJ as Ge,f0 as Pe,yP as xe,dY as Ee,eY as fe,dX as _e,zf as Ve,J6 as Ue,uZ as Be}from"./h8IoI-w7.js";import{aB as Ae,dC as he,A as H,P as ge,ax as K}from"./Cti1rV_x.js";import{ax as $e}from"./CpELl9t1.js";import{c as W}from"./ChTqQfQN.js";import{a as Xe}from"./BJzHxIyr.js";import{n as Q}from"./DYlSkPA-.js";import"./DYhIMPy1.js";import{bo as n}from"./B3iaLYr6.js";import"./DEmaG7Ya.js";import"./hUiIfi2t.js";import"./D0UrvUQM.js";import{R as Re}from"./BvFAWM27.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,Z as ce,ai as q,ar as Ce}from"./IgS40dps.js";import{bU as Le,cS as le,cj as ue,ci as ve}from"./NYl-wMGf.js";import{Hp as p,Ai as we,bA as be,c as Fe,Js as de,i2 as me,bM as ke,Cd as z,AJ as Ge,f0 as Pe,yP as xe,dY as Ee,eY as fe,dX as _e,zf as Ve,J6 as Ue,uZ as Be}from"./DzNB7FSW.js";import{aB as Ae,dC as he,A as H,P as ge,ax as K}from"./kWExXPwX.js";import{ax as $e}from"./AXIAXE42.js";import{c as W}from"./ChTqQfQN.js";import{a as Xe}from"./BJzHxIyr.js";import{n as Q}from"./qj_I7waa.js";import"./DYhIMPy1.js";import{bo as n}from"./E2zwcBGL.js";import"./8mzXJxUW.js";import"./BTNnUZgK.js";import"./C0GDF9vt.js";import{R as Re}from"./BvFAWM27.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};