@wrongstack/webui 1.0.9 → 1.0.11

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 (340) hide show
  1. package/dist/assets/AgentRosterView-BzVZjThP.js +12 -0
  2. package/dist/assets/AgentRosterView-Cv9-DYty.css +1 -0
  3. package/dist/assets/{AnalyticsDashboard-fPe6DYsh.js → AnalyticsDashboard-BT_KhdxY.js} +1 -1
  4. package/dist/assets/AudienceMemoryPanel-CdGaL5ob.js +3 -0
  5. package/dist/assets/ChangesView-BbNRQjPu.js +1 -0
  6. package/dist/assets/{ChimeraReviewsView-BQe81cSZ.js → ChimeraReviewsView-DdLrY1rA.js} +1 -1
  7. package/dist/assets/ChronicleDashboard-CXAqB0-c.js +1 -0
  8. package/dist/assets/CodeEditor-BRVibv3L.js +2 -0
  9. package/dist/assets/CodeMap-BVSuBKUK.js +1 -0
  10. package/dist/assets/{CronJobsPanel-C30TtTM7.js → CronJobsPanel-DO8KnHyT.js} +1 -1
  11. package/dist/assets/DeadCodeScanPanel-ByhAW_bl.js +2 -0
  12. package/dist/assets/{DebugDashboard-jJxP9Qek.js → DebugDashboard-nitOcTHq.js} +1 -1
  13. package/dist/assets/DesignGalleryView-DhavCall.js +1 -0
  14. package/dist/assets/GoalView-CCdMVcp4.js +1 -0
  15. package/dist/assets/KanbanView-PzDm4bt2.js +3 -0
  16. package/dist/assets/MailboxDetailView-DAljvmny.js +1 -0
  17. package/dist/assets/MemoryDrawer-IMvyNAhc.js +1 -0
  18. package/dist/assets/MemoryManager-BtC4dOvO.js +1 -0
  19. package/dist/assets/{ProcessMonitor-Bvgcuk_7.js → ProcessMonitor-C39U4XNb.js} +1 -1
  20. package/dist/assets/{PromptJournalView-BUgpBI3V.js → PromptJournalView-CdC4ldrv.js} +1 -1
  21. package/dist/assets/ProviderTestView-CSNA3lH_.js +1 -0
  22. package/dist/assets/QueuePanel-D7TXqgFW.js +1 -0
  23. package/dist/assets/{RefreshDebugView-CCk1X8Hz.js → RefreshDebugView-Dbq_bHwj.js} +1 -1
  24. package/dist/assets/RepositoryHistoryView-yhAMRjpk.js +2 -0
  25. package/dist/assets/{RequirementIntakeView-ByVm-u0p.js → RequirementIntakeView-Dhp5_d6J.js} +1 -1
  26. package/dist/assets/SageTabs-BlLy8Phu.js +2 -0
  27. package/dist/assets/SddFlowGraph-BZkvlaQ1.js +1 -0
  28. package/dist/assets/SddHub-KdxihXZy.js +2 -0
  29. package/dist/assets/SessionInspectView-kKzWEPpe.js +1 -0
  30. package/dist/assets/SessionList-DjDxENAu.js +1 -0
  31. package/dist/assets/SessionsDashboard-CGCCMceU.js +1 -0
  32. package/dist/assets/SetupScreen-D70VCq7r.js +1 -0
  33. package/dist/assets/SkillDetailView-Dp2kWAQb.js +3 -0
  34. package/dist/assets/TechStackView-DYdZrkkA.js +2 -0
  35. package/dist/assets/TerminalPanel-B9Ka6hvR.js +1 -0
  36. package/dist/assets/{activity-pDZp_UqI.js → activity-B-GYDVn2.js} +2 -2
  37. package/dist/assets/{activity-BGw29FDK.js → activity-BWPWyp3o.js} +5 -5
  38. package/dist/assets/{activity-D8n7MaKo.js → activity-BazcMhZZ.js} +2 -2
  39. package/dist/assets/{activity-CbWiifO9.js → activity-Bk7N_ZW5.js} +5 -5
  40. package/dist/assets/{activity-S9f20P0d.js → activity-Cmq0z33p.js} +2 -2
  41. package/dist/assets/{activity-DYH5K2cA.js → activity-DBsMiPsa.js} +2 -2
  42. package/dist/assets/{activity-DdvIZYux.js → activity-VTOCX_jm.js} +2 -2
  43. package/dist/assets/atkinson-hyperlegible-next-latin-ext-wght-normal-C6vrW8VD.woff2 +0 -0
  44. package/dist/assets/atkinson-hyperlegible-next-latin-wght-normal-BcXVPD7q.woff2 +0 -0
  45. package/dist/assets/button-9ewV4TF3.js +1 -0
  46. package/dist/assets/cascadia-code-arabic-wght-normal-BxRhwSzF.woff2 +0 -0
  47. package/dist/assets/cascadia-code-braille-wght-normal-Cj7wfYns.woff2 +0 -0
  48. package/dist/assets/cascadia-code-cyrillic-ext-wght-normal-Bq2rGQtZ.woff2 +0 -0
  49. package/dist/assets/cascadia-code-cyrillic-wght-normal-DC72kP-V.woff2 +0 -0
  50. package/dist/assets/cascadia-code-greek-wght-normal-DmKacV-0.woff2 +0 -0
  51. package/dist/assets/cascadia-code-hebrew-wght-normal-CYieC9BD.woff2 +0 -0
  52. package/dist/assets/cascadia-code-latin-ext-wght-normal-CeKCfnVW.woff2 +0 -0
  53. package/dist/assets/cascadia-code-latin-wght-normal-CCwG33-X.woff2 +0 -0
  54. package/dist/assets/cascadia-code-symbols2-wght-normal-o0G5EPJ1.woff2 +0 -0
  55. package/dist/assets/cascadia-code-vietnamese-wght-normal-DXbdGs8p.woff2 +0 -0
  56. package/dist/assets/{chat-store-DpI9nO_z.js → chat-store-DNRce6sE.js} +1 -1
  57. package/dist/assets/{codemap-activity-store-5hcdmofR.js → codemap-activity-store-Ha7XbGgq.js} +1 -1
  58. package/dist/assets/commit-mono-latin-400-normal-s0S3qwFW.woff +0 -0
  59. package/dist/assets/commit-mono-latin-400-normal-wzhe4RuD.woff2 +0 -0
  60. package/dist/assets/commit-mono-latin-600-normal-BuQDXT0M.woff +0 -0
  61. package/dist/assets/commit-mono-latin-600-normal-SwgSWHaV.woff2 +0 -0
  62. package/dist/assets/commit-mono-latin-700-normal-1-GU0IUE.woff +0 -0
  63. package/dist/assets/commit-mono-latin-700-normal-DU8mrtj2.woff2 +0 -0
  64. package/dist/assets/config-store-BAUadwHd.js +22 -0
  65. package/dist/assets/dialog-C7EIBM_2.js +1 -0
  66. package/dist/assets/dm-sans-latin-ext-wght-normal-BOFOeGcA.woff2 +0 -0
  67. package/dist/assets/dm-sans-latin-wght-normal-Xz1IZZA0.woff2 +0 -0
  68. package/dist/assets/{empty-state-Dl66htl_.js → empty-state-5YP1rmE6.js} +1 -1
  69. package/dist/assets/figtree-latin-ext-wght-normal-DCwSJGxG.woff2 +0 -0
  70. package/dist/assets/figtree-latin-wght-normal-D_ZTVpCC.woff2 +0 -0
  71. package/dist/assets/fira-code-cyrillic-ext-wght-normal-DhYMMuQd.woff2 +0 -0
  72. package/dist/assets/fira-code-cyrillic-wght-normal-Y3u8pIsh.woff2 +0 -0
  73. package/dist/assets/fira-code-greek-ext-wght-normal-wWus70Ix.woff2 +0 -0
  74. package/dist/assets/fira-code-greek-wght-normal-B2SviObF.woff2 +0 -0
  75. package/dist/assets/fira-code-latin-ext-wght-normal-Dvfvaomy.woff2 +0 -0
  76. package/dist/assets/fira-code-latin-wght-normal-CHoedHDv.woff2 +0 -0
  77. package/dist/assets/fira-code-symbols2-wght-normal-CE6EOz_n.woff2 +0 -0
  78. package/dist/assets/fonts-DRGbd-AM.js +2 -0
  79. package/dist/assets/fraunces-latin-ext-wght-normal-Ca2vKHc0.woff2 +0 -0
  80. package/dist/assets/fraunces-latin-wght-normal-ukD16Tqj.woff2 +0 -0
  81. package/dist/assets/fraunces-vietnamese-wght-normal-CnvboYUG.woff2 +0 -0
  82. package/dist/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
  83. package/dist/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
  84. package/dist/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
  85. package/dist/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
  86. package/dist/assets/geist-mono-cyrillic-ext-wght-normal-X_5orZeX.woff2 +0 -0
  87. package/dist/assets/geist-mono-cyrillic-wght-normal-DiZS0aHC.woff2 +0 -0
  88. package/dist/assets/geist-mono-latin-ext-wght-normal-Bwz-egvJ.woff2 +0 -0
  89. package/dist/assets/geist-mono-latin-wght-normal-XN7g48iV.woff2 +0 -0
  90. package/dist/assets/geist-mono-symbols2-wght-normal-CO5SzqOn.woff2 +0 -0
  91. package/dist/assets/geist-mono-vietnamese-wght-normal-DadHysG0.woff2 +0 -0
  92. package/dist/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
  93. package/dist/assets/{i18n-B_njdXiH.js → i18n-CbyUyl6G.js} +2 -2
  94. package/dist/assets/ibm-plex-serif-cyrillic-400-normal-C7IY3oUc.woff +0 -0
  95. package/dist/assets/ibm-plex-serif-cyrillic-400-normal-CPQ8oqB-.woff2 +0 -0
  96. package/dist/assets/ibm-plex-serif-cyrillic-600-normal-6oiym5iu.woff2 +0 -0
  97. package/dist/assets/ibm-plex-serif-cyrillic-600-normal-C8YEAlRA.woff +0 -0
  98. package/dist/assets/ibm-plex-serif-cyrillic-700-normal-BSMLrh7C.woff2 +0 -0
  99. package/dist/assets/ibm-plex-serif-cyrillic-700-normal-CHVzwaSb.woff +0 -0
  100. package/dist/assets/ibm-plex-serif-cyrillic-ext-400-normal-BcBv-TKp.woff +0 -0
  101. package/dist/assets/ibm-plex-serif-cyrillic-ext-400-normal-CxUI4jC_.woff2 +0 -0
  102. package/dist/assets/ibm-plex-serif-cyrillic-ext-600-normal-CDMeBxaJ.woff +0 -0
  103. package/dist/assets/ibm-plex-serif-cyrillic-ext-600-normal-DXSZftVr.woff2 +0 -0
  104. package/dist/assets/ibm-plex-serif-cyrillic-ext-700-normal-CFcTJr1V.woff2 +0 -0
  105. package/dist/assets/ibm-plex-serif-cyrillic-ext-700-normal-Dq7XTXEq.woff +0 -0
  106. package/dist/assets/ibm-plex-serif-latin-400-normal-BB-zNvJB.woff +0 -0
  107. package/dist/assets/ibm-plex-serif-latin-400-normal-BIGslYFI.woff2 +0 -0
  108. package/dist/assets/ibm-plex-serif-latin-600-normal-D3rpGdkS.woff +0 -0
  109. package/dist/assets/ibm-plex-serif-latin-600-normal-DAxitmSu.woff2 +0 -0
  110. package/dist/assets/ibm-plex-serif-latin-700-normal-BBiG0u0D.woff +0 -0
  111. package/dist/assets/ibm-plex-serif-latin-700-normal-bnJnpGuO.woff2 +0 -0
  112. package/dist/assets/ibm-plex-serif-latin-ext-400-normal-CNMooFZX.woff2 +0 -0
  113. package/dist/assets/ibm-plex-serif-latin-ext-400-normal-DwktX9jl.woff +0 -0
  114. package/dist/assets/ibm-plex-serif-latin-ext-600-normal-CU6LeQOd.woff2 +0 -0
  115. package/dist/assets/ibm-plex-serif-latin-ext-600-normal-D1-_Ic5L.woff +0 -0
  116. package/dist/assets/ibm-plex-serif-latin-ext-700-normal-5BnP_gGI.woff +0 -0
  117. package/dist/assets/ibm-plex-serif-latin-ext-700-normal-BoBbeF2z.woff2 +0 -0
  118. package/dist/assets/ibm-plex-serif-vietnamese-400-normal-BY9Vij9A.woff +0 -0
  119. package/dist/assets/ibm-plex-serif-vietnamese-400-normal-DGubAMUE.woff2 +0 -0
  120. package/dist/assets/ibm-plex-serif-vietnamese-600-normal-BBruYZNA.woff2 +0 -0
  121. package/dist/assets/ibm-plex-serif-vietnamese-600-normal-DZRaS25B.woff +0 -0
  122. package/dist/assets/ibm-plex-serif-vietnamese-700-normal-B3aSYR1A.woff +0 -0
  123. package/dist/assets/ibm-plex-serif-vietnamese-700-normal-hPmb8oh_.woff2 +0 -0
  124. package/dist/assets/{index-CfREDCPe.js → index-BhXxZMAb.js} +83 -76
  125. package/dist/assets/index-BssEH_2N.css +1 -0
  126. package/dist/assets/{input-DAvKojvP.js → input-ag1CrUiS.js} +1 -1
  127. package/dist/assets/intel-one-mono-latin-400-normal-CqVdU6iH.woff2 +0 -0
  128. package/dist/assets/intel-one-mono-latin-400-normal-Dz-D6UFM.woff +0 -0
  129. package/dist/assets/intel-one-mono-latin-600-normal-DJb_B24X.woff2 +0 -0
  130. package/dist/assets/intel-one-mono-latin-600-normal-UTD3q2hA.woff +0 -0
  131. package/dist/assets/intel-one-mono-latin-700-normal-BFFlk8Op.woff2 +0 -0
  132. package/dist/assets/intel-one-mono-latin-700-normal-BzzNQkyM.woff +0 -0
  133. package/dist/assets/intel-one-mono-latin-ext-400-normal-BW7QmGmG.woff +0 -0
  134. package/dist/assets/intel-one-mono-latin-ext-400-normal-DpSum8DV.woff2 +0 -0
  135. package/dist/assets/intel-one-mono-latin-ext-600-normal-VDQcLlxR.woff +0 -0
  136. package/dist/assets/intel-one-mono-latin-ext-600-normal-wurdkzs-.woff2 +0 -0
  137. package/dist/assets/intel-one-mono-latin-ext-700-normal-Cszyb8TI.woff +0 -0
  138. package/dist/assets/intel-one-mono-latin-ext-700-normal-DHqel5Cm.woff2 +0 -0
  139. package/dist/assets/intel-one-mono-symbols2-400-normal-CD7uMPNv.woff2 +0 -0
  140. package/dist/assets/intel-one-mono-symbols2-400-normal-DrJQZ3Wk.woff +0 -0
  141. package/dist/assets/intel-one-mono-symbols2-600-normal-DhzUCacJ.woff2 +0 -0
  142. package/dist/assets/intel-one-mono-symbols2-600-normal-DoqMVv6l.woff +0 -0
  143. package/dist/assets/intel-one-mono-symbols2-700-normal-CYi7u3jm.woff +0 -0
  144. package/dist/assets/intel-one-mono-symbols2-700-normal-CkmMEo1z.woff2 +0 -0
  145. package/dist/assets/intel-one-mono-vietnamese-400-normal-Bn-nXHDK.woff2 +0 -0
  146. package/dist/assets/intel-one-mono-vietnamese-400-normal-nd8xkrKu.woff +0 -0
  147. package/dist/assets/intel-one-mono-vietnamese-600-normal-B9HWtSu2.woff2 +0 -0
  148. package/dist/assets/intel-one-mono-vietnamese-600-normal-Dm9ZhbyQ.woff +0 -0
  149. package/dist/assets/intel-one-mono-vietnamese-700-normal-Da_Xc8bO.woff +0 -0
  150. package/dist/assets/intel-one-mono-vietnamese-700-normal-xgkGRJps.woff2 +0 -0
  151. package/dist/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2 +0 -0
  152. package/dist/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2 +0 -0
  153. package/dist/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2 +0 -0
  154. package/dist/assets/inter-greek-wght-normal-CkhJZR-_.woff2 +0 -0
  155. package/dist/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
  156. package/dist/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
  157. package/dist/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2 +0 -0
  158. package/dist/assets/iosevka-latin-400-normal-7stTb90X.woff2 +0 -0
  159. package/dist/assets/iosevka-latin-400-normal-BVqCxfc4.woff +0 -0
  160. package/dist/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
  161. package/dist/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
  162. package/dist/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
  163. package/dist/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
  164. package/dist/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
  165. package/dist/assets/lexend-latin-ext-wght-normal-B6JQhE1e.woff2 +0 -0
  166. package/dist/assets/lexend-latin-wght-normal-ci0D1wrL.woff2 +0 -0
  167. package/dist/assets/lexend-vietnamese-wght-normal-RvljkFvg.woff2 +0 -0
  168. package/dist/assets/literata-cyrillic-ext-wght-normal-CGKlZYBf.woff2 +0 -0
  169. package/dist/assets/literata-cyrillic-wght-normal-DLqwHbi6.woff2 +0 -0
  170. package/dist/assets/literata-greek-ext-wght-normal-e3e57Shi.woff2 +0 -0
  171. package/dist/assets/literata-greek-wght-normal-CO1l-giJ.woff2 +0 -0
  172. package/dist/assets/literata-latin-ext-wght-normal-BnEbWgdZ.woff2 +0 -0
  173. package/dist/assets/literata-latin-wght-normal-DLxlUchJ.woff2 +0 -0
  174. package/dist/assets/literata-vietnamese-wght-normal-LcSrhZ7T.woff2 +0 -0
  175. package/dist/assets/{mailbox-store-5Dizermg.js → mailbox-store-C49LeBj8.js} +1 -1
  176. package/dist/assets/martian-mono-cyrillic-wght-normal-B84CD5C_.woff2 +0 -0
  177. package/dist/assets/martian-mono-latin-ext-wght-normal-DlL6xMw5.woff2 +0 -0
  178. package/dist/assets/martian-mono-latin-wght-normal-5W32yIyr.woff2 +0 -0
  179. package/dist/assets/noto-sans-mono-cyrillic-ext-wght-normal-CFdLnqWt.woff2 +0 -0
  180. package/dist/assets/noto-sans-mono-cyrillic-wght-normal-Bt8FJ3Mn.woff2 +0 -0
  181. package/dist/assets/noto-sans-mono-greek-ext-wght-normal-D70fr4An.woff2 +0 -0
  182. package/dist/assets/noto-sans-mono-greek-wght-normal-CxbW-kt-.woff2 +0 -0
  183. package/dist/assets/noto-sans-mono-latin-ext-wght-normal-Co5HW6fV.woff2 +0 -0
  184. package/dist/assets/noto-sans-mono-latin-wght-normal-BOJxtwUa.woff2 +0 -0
  185. package/dist/assets/noto-sans-mono-vietnamese-wght-normal-R4O-K-Ty.woff2 +0 -0
  186. package/dist/assets/nunito-sans-cyrillic-ext-wght-normal-7w74d1lj.woff2 +0 -0
  187. package/dist/assets/nunito-sans-cyrillic-wght-normal-B9hoeQUC.woff2 +0 -0
  188. package/dist/assets/nunito-sans-latin-ext-wght-normal-DMEAsnHD.woff2 +0 -0
  189. package/dist/assets/nunito-sans-latin-wght-normal-BWQ3gi2K.woff2 +0 -0
  190. package/dist/assets/nunito-sans-vietnamese-wght-normal-BhFYcaJr.woff2 +0 -0
  191. package/dist/assets/onest-cyrillic-ext-wght-normal-DOFToQv1.woff2 +0 -0
  192. package/dist/assets/onest-cyrillic-wght-normal-DayYxulF.woff2 +0 -0
  193. package/dist/assets/onest-latin-ext-wght-normal-QAhDxQuo.woff2 +0 -0
  194. package/dist/assets/onest-latin-wght-normal-Dun_Rd-l.woff2 +0 -0
  195. package/dist/assets/onest-math-wght-normal-Bl4ZGkZl.woff2 +0 -0
  196. package/dist/assets/onest-symbols-wght-normal-DxQzqQfC.woff2 +0 -0
  197. package/dist/assets/onest-vietnamese-wght-normal-BBxOatbv.woff2 +0 -0
  198. package/dist/assets/outfit-latin-ext-wght-normal-DdQaqQDo.woff2 +0 -0
  199. package/dist/assets/outfit-latin-wght-normal-Bc-8i84L.woff2 +0 -0
  200. package/dist/assets/plus-jakarta-sans-latin-ext-wght-normal-DmpS2jIq.woff2 +0 -0
  201. package/dist/assets/plus-jakarta-sans-latin-wght-normal-eXO_dkmS.woff2 +0 -0
  202. package/dist/assets/plus-jakarta-sans-vietnamese-wght-normal-qRpaaN48.woff2 +0 -0
  203. package/dist/assets/red-hat-mono-latin-ext-wght-normal-BQQ6IFDA.woff2 +0 -0
  204. package/dist/assets/red-hat-mono-latin-wght-normal-Dwfc5A3M.woff2 +0 -0
  205. package/dist/assets/roboto-mono-cyrillic-ext-wght-normal-BUDPrIko.woff2 +0 -0
  206. package/dist/assets/roboto-mono-cyrillic-wght-normal-HUlVHixE.woff2 +0 -0
  207. package/dist/assets/roboto-mono-greek-wght-normal-BJJTbwTT.woff2 +0 -0
  208. package/dist/assets/roboto-mono-latin-ext-wght-normal-QAYlOegK.woff2 +0 -0
  209. package/dist/assets/roboto-mono-latin-wght-normal-CZtBPCCa.woff2 +0 -0
  210. package/dist/assets/roboto-mono-vietnamese-wght-normal-DlC-zuDL.woff2 +0 -0
  211. package/dist/assets/{roster-ws-CSbZSs3G.js → roster-ws-z8DKquaN.js} +1 -1
  212. package/dist/assets/settings-B5Jy-ObI.js +1 -0
  213. package/dist/assets/settings-BXTJJ4n-.js +1 -0
  214. package/dist/assets/settings-BcXAVecM.js +1 -0
  215. package/dist/assets/settings-ByPfZHGm.js +1 -0
  216. package/dist/assets/settings-CCe4iHcn.js +1 -0
  217. package/dist/assets/settings-D2GLiaDO.js +1 -0
  218. package/dist/assets/settings-gB9nKL3f.js +1 -0
  219. package/dist/assets/{shared-BirfDJmq.js → shared-BFJvAYzX.js} +1 -1
  220. package/dist/assets/source-code-pro-cyrillic-ext-wght-normal-BODHZjil.woff2 +0 -0
  221. package/dist/assets/source-code-pro-cyrillic-wght-normal-aqTvhEeI.woff2 +0 -0
  222. package/dist/assets/source-code-pro-greek-wght-normal-BvT6WsG1.woff2 +0 -0
  223. package/dist/assets/source-code-pro-latin-ext-wght-normal-0UZNSh4u.woff2 +0 -0
  224. package/dist/assets/source-code-pro-latin-wght-normal-BP8Zz55n.woff2 +0 -0
  225. package/dist/assets/source-code-pro-vietnamese-wght-normal-B6x53GZG.woff2 +0 -0
  226. package/dist/assets/source-sans-3-cyrillic-ext-wght-normal-DzyfIafT.woff2 +0 -0
  227. package/dist/assets/source-sans-3-cyrillic-wght-normal-BMDVbyM7.woff2 +0 -0
  228. package/dist/assets/source-sans-3-greek-ext-wght-normal-BWSLJLk6.woff2 +0 -0
  229. package/dist/assets/source-sans-3-greek-wght-normal-C9H9m1vD.woff2 +0 -0
  230. package/dist/assets/source-sans-3-latin-ext-wght-normal-C8iNium2.woff2 +0 -0
  231. package/dist/assets/source-sans-3-latin-wght-normal-BqRLTx4X.woff2 +0 -0
  232. package/dist/assets/source-sans-3-vietnamese-wght-normal-C1uRvKPU.woff2 +0 -0
  233. package/dist/assets/source-serif-4-cyrillic-ext-wght-normal-cHuGMAiY.woff2 +0 -0
  234. package/dist/assets/source-serif-4-cyrillic-wght-normal-DwHjdM4S.woff2 +0 -0
  235. package/dist/assets/source-serif-4-greek-wght-normal-ece1310W.woff2 +0 -0
  236. package/dist/assets/source-serif-4-latin-ext-wght-normal-CxNHBx-q.woff2 +0 -0
  237. package/dist/assets/source-serif-4-latin-wght-normal-D9elroTD.woff2 +0 -0
  238. package/dist/assets/source-serif-4-vietnamese-wght-normal-D-yuW59g.woff2 +0 -0
  239. package/dist/assets/space-mono-latin-400-normal-Rg4St2Dn.woff2 +0 -0
  240. package/dist/assets/space-mono-latin-400-normal-_3DlpgIW.woff +0 -0
  241. package/dist/assets/space-mono-latin-700-normal-D7A851RN.woff +0 -0
  242. package/dist/assets/space-mono-latin-700-normal-mWgeinG7.woff2 +0 -0
  243. package/dist/assets/space-mono-latin-ext-400-normal-D4cJI_B-.woff +0 -0
  244. package/dist/assets/space-mono-latin-ext-400-normal-DTLbW2xa.woff2 +0 -0
  245. package/dist/assets/space-mono-latin-ext-700-normal-B2s3bDs2.woff2 +0 -0
  246. package/dist/assets/space-mono-latin-ext-700-normal-B_E7P90g.woff +0 -0
  247. package/dist/assets/space-mono-vietnamese-400-normal-B0PMp_xB.woff +0 -0
  248. package/dist/assets/space-mono-vietnamese-400-normal-BNOj0Qhp.woff2 +0 -0
  249. package/dist/assets/space-mono-vietnamese-700-normal-D-KrLuLr.woff +0 -0
  250. package/dist/assets/space-mono-vietnamese-700-normal-DWQgDHuA.woff2 +0 -0
  251. package/dist/assets/{stores-COxKgvNx.js → stores-BIVCS5nu.js} +2 -2
  252. package/dist/assets/ubuntu-mono-cyrillic-400-normal-Di_0TARV.woff +0 -0
  253. package/dist/assets/ubuntu-mono-cyrillic-400-normal-OGyu3tt3.woff2 +0 -0
  254. package/dist/assets/ubuntu-mono-cyrillic-700-normal-BFVeNRUG.woff2 +0 -0
  255. package/dist/assets/ubuntu-mono-cyrillic-700-normal-Fcmsc1TE.woff +0 -0
  256. package/dist/assets/ubuntu-mono-cyrillic-ext-400-normal-C5u8faa9.woff2 +0 -0
  257. package/dist/assets/ubuntu-mono-cyrillic-ext-400-normal-CL-A5l1V.woff +0 -0
  258. package/dist/assets/ubuntu-mono-cyrillic-ext-700-normal-Bs-2rkWJ.woff2 +0 -0
  259. package/dist/assets/ubuntu-mono-cyrillic-ext-700-normal-CqMWGnc6.woff +0 -0
  260. package/dist/assets/ubuntu-mono-greek-400-normal-CCUzT4Jh.woff2 +0 -0
  261. package/dist/assets/ubuntu-mono-greek-400-normal-DR50Gfyl.woff +0 -0
  262. package/dist/assets/ubuntu-mono-greek-700-normal-BZ2dYCtm.woff2 +0 -0
  263. package/dist/assets/ubuntu-mono-greek-700-normal-CzNTt3J6.woff +0 -0
  264. package/dist/assets/ubuntu-mono-greek-ext-400-normal-BNZd3ZNJ.woff +0 -0
  265. package/dist/assets/ubuntu-mono-greek-ext-400-normal-CUE8Ia0W.woff2 +0 -0
  266. package/dist/assets/ubuntu-mono-greek-ext-700-normal-BT9L2HK2.woff2 +0 -0
  267. package/dist/assets/ubuntu-mono-greek-ext-700-normal-C7ZC70Zm.woff +0 -0
  268. package/dist/assets/ubuntu-mono-latin-400-normal-DpWeehTz.woff +0 -0
  269. package/dist/assets/ubuntu-mono-latin-400-normal-l4cqI2xd.woff2 +0 -0
  270. package/dist/assets/ubuntu-mono-latin-700-normal-g9eDMPsO.woff +0 -0
  271. package/dist/assets/ubuntu-mono-latin-700-normal-nUYOZNIl.woff2 +0 -0
  272. package/dist/assets/ubuntu-mono-latin-ext-400-normal-C-izf5FM.woff +0 -0
  273. package/dist/assets/ubuntu-mono-latin-ext-400-normal-Cadvr_Yo.woff2 +0 -0
  274. package/dist/assets/ubuntu-mono-latin-ext-700-normal-DDYBRrrS.woff +0 -0
  275. package/dist/assets/ubuntu-mono-latin-ext-700-normal-DW9JNpKV.woff2 +0 -0
  276. package/dist/assets/ui-store-DC3mkswy.js +1 -0
  277. package/dist/assets/utils-CKsqCaP8.js +1 -0
  278. package/dist/assets/{vector-memory-panel-fEdfCaDJ.js → vector-memory-panel-DZFEwwGM.js} +1 -1
  279. package/dist/assets/{vendor-BO-lHyIr.js → vendor-V3ydTHqN.js} +14 -14
  280. package/dist/assets/vendor-jL-bRT8f.css +1 -0
  281. package/dist/assets/victor-mono-cyrillic-ext-wght-normal-BdiBydkn.woff2 +0 -0
  282. package/dist/assets/victor-mono-cyrillic-wght-normal-hErKNM3V.woff2 +0 -0
  283. package/dist/assets/victor-mono-greek-wght-normal-Dt1CKMit.woff2 +0 -0
  284. package/dist/assets/victor-mono-latin-ext-wght-normal-9ZPGfAHN.woff2 +0 -0
  285. package/dist/assets/victor-mono-latin-wght-normal-DLAw12qW.woff2 +0 -0
  286. package/dist/assets/victor-mono-vietnamese-wght-normal-C28_QU0a.woff2 +0 -0
  287. package/dist/assets/{view-navigation-CVnKqjL2.js → view-navigation-DHtNFXIl.js} +1 -1
  288. package/dist/components/MessageBubble/ToolCallOverview.d.ts +14 -0
  289. package/dist/components/SettingsPanel/FontSettingsTab.d.ts +2 -0
  290. package/dist/components/ThemeProvider.d.ts +1 -1
  291. package/dist/hooks/use-font-settings.d.ts +13 -0
  292. package/dist/index.html +17 -16
  293. package/dist/index.js +13650 -10550
  294. package/dist/lib/font-scale-css.d.ts +45 -0
  295. package/dist/lib/fonts.d.ts +502 -0
  296. package/dist/stores/config-store.d.ts +8 -1
  297. package/dist/stores/types.d.ts +6 -0
  298. package/dist/stores/ui-store-types.d.ts +1 -1
  299. package/package.json +39 -9
  300. package/dist/assets/AgentRosterView-Ce7myLNH.css +0 -1
  301. package/dist/assets/AgentRosterView-CtUX-VHJ.js +0 -12
  302. package/dist/assets/AudienceMemoryPanel-i53Y5nRR.js +0 -3
  303. package/dist/assets/ChangesView-CFOQZBoO.js +0 -1
  304. package/dist/assets/ChronicleDashboard-Dc2rEfEh.js +0 -1
  305. package/dist/assets/CodeEditor-DhA63AyO.js +0 -2
  306. package/dist/assets/CodeMap-6sHlGgjj.js +0 -1
  307. package/dist/assets/DeadCodeScanPanel-j3n15R1p.js +0 -2
  308. package/dist/assets/DesignGalleryView-tw6AdJGD.js +0 -1
  309. package/dist/assets/GoalView-DsGdbElx.js +0 -1
  310. package/dist/assets/KanbanView-B8USJasA.js +0 -3
  311. package/dist/assets/MailboxDetailView-jsHPTvQO.js +0 -1
  312. package/dist/assets/MemoryDrawer-BdcWptmP.js +0 -1
  313. package/dist/assets/MemoryManager-Cawc6tAj.js +0 -1
  314. package/dist/assets/ProviderTestView-CztiodHF.js +0 -1
  315. package/dist/assets/QueuePanel-BQQfIbGH.js +0 -1
  316. package/dist/assets/RepositoryHistoryView-BFiEVjF-.js +0 -2
  317. package/dist/assets/SageTabs-BnjtZSVk.js +0 -2
  318. package/dist/assets/SddFlowGraph-CZQxxeJv.js +0 -1
  319. package/dist/assets/SddHub-CimqjJhd.js +0 -2
  320. package/dist/assets/SessionInspectView-DnzU3hjG.js +0 -1
  321. package/dist/assets/SessionList-DBcHNwcc.js +0 -1
  322. package/dist/assets/SessionsDashboard-DofL975M.js +0 -1
  323. package/dist/assets/SetupScreen-DQAqt8Dn.js +0 -1
  324. package/dist/assets/SkillDetailView-BcG2XIwr.js +0 -3
  325. package/dist/assets/TechStackView-Ce3WNG85.js +0 -2
  326. package/dist/assets/TerminalPanel-B3SOIzJY.js +0 -1
  327. package/dist/assets/button-h7DHXgna.js +0 -1
  328. package/dist/assets/config-store-D7yrCV2X.js +0 -22
  329. package/dist/assets/dialog-CTmNJKRN.js +0 -1
  330. package/dist/assets/index-coebX2ug.css +0 -1
  331. package/dist/assets/settings-AxDNIcz1.js +0 -1
  332. package/dist/assets/settings-BcejxgTD.js +0 -1
  333. package/dist/assets/settings-CAfe70nd.js +0 -1
  334. package/dist/assets/settings-CxqeEzzD.js +0 -1
  335. package/dist/assets/settings-D90wMI-3.js +0 -1
  336. package/dist/assets/settings-DKSmPD2M.js +0 -1
  337. package/dist/assets/settings-DWXLaAFN.js +0 -1
  338. package/dist/assets/ui-store-BROszDxo.js +0 -1
  339. package/dist/assets/utils-DQbrPaAM.js +0 -1
  340. package/dist/assets/vendor-BShi5_Dg.css +0 -1
@@ -0,0 +1,12 @@
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{I as t,K as n,Nt as r,P as i,U as a,V as o,Z as s,j as c,l,mt as u,tt as d,z as f}from"./config-store-BAUadwHd.js";import{i as p,t as m}from"./react-core-wiHys0m2.js";import{Bt as h,Ci as g,Cn as _,Cr as v,Da as y,Dn as b,En as x,Er as S,Ft as C,Ha as w,Ht as T,Ja as E,Ji as D,Ka as O,Ki as k,Mr as A,Mt as j,Na as M,Nt as ee,Pa as N,Pr as P,Pt as F,Qi as te,Qt as ne,Ta as re,Ti as ie,Ur as ae,Vn as oe,Vr as se,Xi as ce,Yi as le,Yr as I,Yt as ue,bi as L,da as R,ei as de,er as fe,fn as pe,fo as me,ga as he,go as ge,ho as z,jr as _e,jt as B,ki as ve,kn as ye,la as be,ln as xe,mr as Se,qa as Ce,sa as we,ti as Te,tn as Ee,ua as De,ur as Oe,vi as ke,wo as Ae,wr as je,xo as V,xr as Me,yn as Ne,za as Pe}from"./vendor-V3ydTHqN.js";import"./i18n-CbyUyl6G.js";import{a as Fe,c as Ie,d as Le,f as Re,g as ze,h as Be,i as Ve,l as He,n as Ue,o as We,p as Ge,r as Ke,s as qe,t as Je,u as Ye}from"./xyflow-BqDBClm9.js";import{t as H}from"./utils-CKsqCaP8.js";import{i as Xe}from"./view-navigation-DHtNFXIl.js";import{n as Ze}from"./ui-store-DC3mkswy.js";import{f as Qe,m as $e,p as U}from"./stores-BIVCS5nu.js";import{t as et}from"./chat-store-DNRce6sE.js";import{r as tt}from"./mailbox-store-C49LeBj8.js";import{c as nt}from"./markdown-CXRzjX3p.js";import{D as rt,S as it,a as at,c as ot,g as st,h as ct,o as lt,s as ut,v as dt,x as ft}from"./index-BhXxZMAb.js";import{t as W}from"./roster-ws-z8DKquaN.js";import{AudienceMemoryPanel as pt}from"./AudienceMemoryPanel-CdGaL5ob.js";var G=e(p(),1),K=m(),mt=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],ht=[[`timeoutMs`,`Total timeout (ms)`],[`idleTimeoutMs`,`Idle timeout (ms)`],[`maxIterations`,`Max iterations`],[`maxToolCalls`,`Max tool calls`],[`maxTokens`,`Max tokens`],[`maxCostUsd`,`Max cost (USD)`]];function gt(e){return`${e.provider}/${e.model}`}function _t(e){let t=e.indexOf(`/`);return t<0?{provider:``,model:e}:{provider:e.slice(0,t),model:e.slice(t+1)}}function vt(e){return Array.isArray(e)?e.join(`, `):``}function yt(e){return[...new Set(e.split(/[\n,]+/).map(e=>e.trim()).filter(Boolean))]}function bt({initialConfig:e,systemProtected:t,saving:n,onSave:r,onCancel:i}){let{t:a}=V(),[o,s]=(0,G.useState)(()=>structuredClone(e)),c=dt(!0),l=o.modelPolicy,u=(0,G.useMemo)(()=>(l?.allowed??[]).map(gt),[l?.allowed]),d=(0,G.useMemo)(()=>(l?.fallbacks??[]).map(gt),[l?.fallbacks]),f=e=>s(t=>({...t,...e})),p=(e,t)=>{let n=yt(t);s(t=>{let r={...t};return n.length?r[e]=n:delete r[e],r})},m=(e,t)=>{s(n=>{let r={...n.budget??{}};t===``?delete r[e]:r[e]=Number(t);let i={...n};return Object.keys(r).length?i.budget=r:delete i.budget,i})},h=e=>{let t=e.map(_t),n=new Set(e);s(e=>({...e,modelPolicy:{allowed:t,fallbacks:(e.modelPolicy?.fallbacks??[]).filter(e=>n.has(gt(e))),strict:e.modelPolicy?.strict??!0}}))};return(0,K.jsxs)(`div`,{className:`space-y-4 rounded-lg border border-border bg-card/40 p-4`,children:[t&&(0,K.jsxs)(`div`,{className:`flex gap-2 rounded-md border border-warning/30 bg-warning/5 p-2 text-[11px] text-muted-foreground`,children:[(0,K.jsx)(Ne,{className:`mt-0.5 h-4 w-4 shrink-0 text-warning`}),(0,K.jsx)(`span`,{children:a(`activity:runtimePolicy.protectedSystemAgentRequiredToolsAnd`)})]}),(0,K.jsxs)(`section`,{className:`space-y-2`,children:[(0,K.jsx)(`h4`,{className:`text-xs font-semibold`,children:a(`activity:runtimePolicy.providerAndModelPolicy`)}),(0,K.jsx)(st,{candidates:c,provider:o.provider,value:o.model,placeholder:a(`activity:runtimePolicy.useProjectDefaultModel`),resetLabel:`Use project default`,onReset:()=>{s(e=>{let t={...e};return delete t.provider,delete t.model,t})},onPick:(e,t)=>{let n=`${t}/${e}`;f({provider:t,model:e}),l&&!u.includes(n)&&h([...u,n])}}),(0,K.jsxs)(`label`,{className:`flex items-center gap-2 text-[11px]`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:!!l,onChange:e=>{if(e.target.checked){let e=o.provider&&o.model?[{provider:o.provider,model:o.model}]:c[0]?[{provider:c[0].provider,model:c[0].model}]:[];e.length&&f({modelPolicy:{allowed:e,strict:!0}})}else s(e=>{let t={...e};return delete t.modelPolicy,t})}}),a(`activity:runtimePolicy.restrictThisAgentToAnExplicit`)]}),l&&(0,K.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,K.jsxs)(`div`,{className:`space-y-1`,children:[(0,K.jsx)(`span`,{className:`text-[10px] font-medium`,children:a(`activity:runtimePolicy.allowedModels`)}),(0,K.jsx)(ct,{value:u,candidates:c,onChange:h,placeholder:a(`activity:runtimePolicy.addAllowedModel`),emptyHint:`At least one model is required`})]}),(0,K.jsxs)(`div`,{className:`space-y-1`,children:[(0,K.jsx)(`span`,{className:`text-[10px] font-medium`,children:a(`activity:runtimePolicy.orderedFallbackChain`)}),(0,K.jsx)(ct,{value:d,candidates:c,onChange:e=>{let t=[...new Set([...u,...e])];s(n=>({...n,modelPolicy:{allowed:t.map(_t),fallbacks:e.map(_t),strict:n.modelPolicy?.strict??!0}}))},placeholder:a(`activity:runtimePolicy.addFallbackModel`),emptyHint:`No fallback; primary failure stops the task`})]})]})]}),(0,K.jsx)(`section`,{className:`grid gap-3 sm:grid-cols-3`,children:[[`tools`,`Tools`,`read_file, search, bash`],[`skillNames`,`Skills`,`security-check, browser`],[`allowedCapabilities`,`Capabilities`,`fs.read, fs.write`]].map(([e,t,n])=>(0,K.jsxs)(`label`,{className:`space-y-1 text-[10px]`,children:[(0,K.jsx)(`span`,{className:`font-medium`,children:t}),(0,K.jsx)(`textarea`,{value:vt(o[e]),onChange:t=>p(e,t.target.value),placeholder:n,className:`h-20 w-full resize-y rounded border border-border bg-background p-2 font-mono`})]},e))}),(0,K.jsxs)(`section`,{className:`space-y-2`,children:[(0,K.jsx)(`h4`,{className:`text-xs font-semibold`,children:a(`activity:runtimePolicy.workspaceAndIsolation`)}),(0,K.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,K.jsxs)(`label`,{className:`space-y-1 text-[10px]`,children:[(0,K.jsx)(`span`,{children:a(`activity:runtimePolicy.projectRelativeWorkingDirectory`)}),(0,K.jsx)(`input`,{value:o.cwd??``,onChange:e=>f({cwd:e.target.value||void 0}),placeholder:a(`activity:runtimePolicy.packagesWebui`),className:`h-8 w-full rounded border border-border bg-background px-2 font-mono`})]}),(0,K.jsxs)(`label`,{className:`space-y-1 text-[10px]`,children:[(0,K.jsx)(`span`,{children:a(`activity:runtimePolicy.gitWorktreeIsolation`)}),(0,K.jsxs)(`select`,{value:String(o.worktree??`auto`),onChange:e=>f({worktree:e.target.value}),className:`h-8 w-full rounded border border-border bg-background px-2`,children:[(0,K.jsx)(`option`,{value:`auto`,children:a(`activity:runtimePolicy.automatic`)}),(0,K.jsx)(`option`,{value:`required`,children:a(`activity:runtimePolicy.required`)}),(0,K.jsx)(`option`,{value:`off`,children:a(`activity:runtimePolicy.off`)})]})]})]})]}),(0,K.jsxs)(`section`,{className:`space-y-2`,children:[(0,K.jsx)(`h4`,{className:`text-xs font-semibold`,children:a(`activity:runtimePolicy.limits`)}),(0,K.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-3`,children:ht.map(([e,t])=>(0,K.jsxs)(`label`,{className:`space-y-1 text-[10px]`,children:[(0,K.jsx)(`span`,{children:t}),(0,K.jsx)(`input`,{type:`number`,min:`0`,step:e===`maxCostUsd`?`0.01`:`1`,value:o.budget?.[e]??``,onChange:t=>m(e,t.target.value),className:`h-8 w-full rounded border border-border bg-background px-2`})]},e))})]}),(0,K.jsxs)(`section`,{className:`space-y-2`,children:[(0,K.jsxs)(`label`,{className:`flex items-center gap-2 text-xs font-semibold`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:!!o.availability,onChange:e=>{e.target.checked?f({availability:{timezone:Intl.DateTimeFormat().resolvedOptions().timeZone||`UTC`,days:[1,2,3,4,5],start:`09:00`,end:`18:00`,mode:t?`advisory`:`enforce`}}):s(e=>{let t={...e};return delete t.availability,t})}}),a(`activity:runtimePolicy.workingHours`)]}),o.availability&&(0,K.jsxs)(`div`,{className:`space-y-2 rounded border border-border p-2`,children:[(0,K.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:mt.map((e,t)=>(0,K.jsxs)(`label`,{className:`flex items-center gap-1 text-[10px]`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:o.availability?.days.includes(t)??!1,onChange:e=>{let n=o.availability;if(!n)return;let r=e.target.checked?[...new Set([...n.days,t])].sort():n.days.filter(e=>e!==t);f({availability:{...n,days:r}})}}),e]},e))}),(0,K.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-4`,children:[(0,K.jsx)(`input`,{value:o.availability.timezone,onChange:e=>f({availability:{...o.availability,timezone:e.target.value}}),placeholder:a(`activity:runtimePolicy.europeKiev`),className:`h-8 rounded border border-border bg-background px-2 text-[10px]`}),(0,K.jsx)(`input`,{type:`time`,value:o.availability.start,onChange:e=>f({availability:{...o.availability,start:e.target.value}}),className:`h-8 rounded border border-border bg-background px-2 text-[10px]`}),(0,K.jsx)(`input`,{type:`time`,value:o.availability.end,onChange:e=>f({availability:{...o.availability,end:e.target.value}}),className:`h-8 rounded border border-border bg-background px-2 text-[10px]`}),(0,K.jsxs)(`select`,{value:t?`advisory`:o.availability.mode??`enforce`,disabled:t,onChange:e=>f({availability:{...o.availability,mode:e.target.value}}),className:`h-8 rounded border border-border bg-background px-2 text-[10px]`,children:[(0,K.jsx)(`option`,{value:`enforce`,children:a(`activity:runtimePolicy.enforce`)}),(0,K.jsx)(`option`,{value:`advisory`,children:a(`activity:runtimePolicy.advisory`)})]})]})]})]}),(0,K.jsxs)(`div`,{className:`flex gap-2`,children:[(0,K.jsx)(`button`,{type:`button`,disabled:n||!!(l&&l.allowed.length===0),onClick:()=>r(o),className:`rounded bg-primary px-3 py-1.5 text-xs text-primary-foreground disabled:opacity-50`,children:n?`Saving…`:`Save runtime policy`}),(0,K.jsx)(`button`,{type:`button`,onClick:i,className:`rounded border border-border px-3 py-1.5 text-xs hover:bg-accent`,children:a(`activity:runtimePolicy.cancel`)})]})]})}function xt({customStats:e,catalog:t}){let{t:n}=V(),r=(0,G.useCallback)(e=>n(`activity:rosterRoles.${e.role}.name`,{defaultValue:e.name}),[n]),i=(0,G.useCallback)(e=>n(`activity:rosterRoles.${e.role}.summary`,{defaultValue:e.summary}),[n]),[a,o]=(0,G.useState)(``),[s,c]=(0,G.useState)(null),l=(0,G.useMemo)(()=>new Set(e.filter(e=>e.exists||e.hasIdentity||e.hasConfig||e.hasKnowledge).map(e=>e.role)),[e]),u=(0,G.useMemo)(()=>{if(!a.trim())return t;let e=a.toLowerCase();return t.filter(t=>t.role.includes(e)||r(t).toLowerCase().includes(e)||i(t).toLowerCase().includes(e))},[t,a,r,i]),d=(0,G.useCallback)(t=>e.find(e=>e.role===t),[e]),f=u;return(0,K.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[(0,K.jsx)(`div`,{className:`shrink-0 px-3 py-2 border-b border-border/50`,children:(0,K.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-border/60 bg-background px-3 py-1.5`,children:[(0,K.jsx)(b,{className:`h-3.5 w-3.5 text-muted-foreground`}),(0,K.jsx)(`input`,{type:`text`,value:a,onChange:e=>o(e.target.value),placeholder:n(`activity:agentRoster.searchPlaceholder`),className:`flex-1 bg-transparent text-xs outline-none placeholder:text-muted-foreground/50`}),a&&(0,K.jsx)(`button`,{type:`button`,onClick:()=>o(``),className:`text-muted-foreground hover:text-foreground`,children:(0,K.jsx)(j,{className:`h-3 w-3`})})]})}),(0,K.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-3`,children:[(0,K.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-2`,children:f.map(e=>{let t=d(e.role),a=l.has(e.role),o=s===e.role;return(0,K.jsxs)(`div`,{className:H(`rounded-lg border bg-card transition-colors`,o?`border-primary/40 ring-1 ring-primary/20`:`border-border/60 hover:border-primary/30`),children:[(0,K.jsxs)(`button`,{type:`button`,onClick:()=>c(o?null:e.role),className:`w-full text-left p-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,K.jsx)(O,{className:`h-4 w-4 shrink-0 text-primary`}),(0,K.jsx)(`span`,{className:`text-sm font-semibold truncate`,children:r(e)}),(0,K.jsxs)(`code`,{className:`text-[9px] text-muted-foreground font-mono shrink-0`,children:[`@`,e.role]})]}),(0,K.jsx)(M,{className:H(`h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform`,o&&`rotate-180`)})]}),(0,K.jsx)(`p`,{className:`text-[10px] text-muted-foreground mt-1 leading-relaxed line-clamp-2`,children:i(e)}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2 mt-1.5`,children:[(0,K.jsx)(`span`,{className:`text-[9px] text-muted-foreground tabular-nums`,children:n(`activity:agentRoster.toolsCount`,{count:e.tools})}),e.budget.maxIterations&&(0,K.jsx)(`span`,{className:`text-[9px] text-muted-foreground tabular-nums`,children:n(`activity:agentRoster.maxItShort`,{count:e.budget.maxIterations,value:e.budget.maxIterations.toLocaleString()})}),a&&(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 rounded bg-brand-2/10 px-1 py-0.5 text-[8px] text-brand-2 font-medium`,children:[(0,K.jsx)(ie,{className:`h-2.5 w-2.5`}),` `,n(`activity:agentRoster.customizedBadge`)]}),t?.needsSummarization&&(0,K.jsx)(`span`,{className:`text-[9px] text-warning`,children:n(`activity:agentRoster.needsSummary`)})]})]}),o&&(0,K.jsxs)(`div`,{className:`border-t border-border/50 px-3 py-2 space-y-2`,children:[(0,K.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,K.jsxs)(`div`,{className:`rounded bg-muted/30 p-1.5`,children:[(0,K.jsx)(`span`,{className:`text-[8px] text-muted-foreground uppercase tracking-wider`,children:n(`activity:agentRoster.maxIterations`)}),(0,K.jsx)(`div`,{className:`text-xs font-mono mt-0.5`,children:e.budget.maxIterations?.toLocaleString()??`—`})]}),(0,K.jsxs)(`div`,{className:`rounded bg-muted/30 p-1.5`,children:[(0,K.jsx)(`span`,{className:`text-[8px] text-muted-foreground uppercase tracking-wider`,children:n(`activity:agentRoster.timeout`)}),(0,K.jsx)(`div`,{className:`text-xs font-mono mt-0.5`,children:e.budget.timeoutMs?`${Math.round(e.budget.timeoutMs/6e4)}m`:`—`})]}),(0,K.jsxs)(`div`,{className:`rounded bg-muted/30 p-1.5`,children:[(0,K.jsx)(`span`,{className:`text-[8px] text-muted-foreground uppercase tracking-wider`,children:n(`activity:agentRoster.maxToolCalls`)}),(0,K.jsx)(`div`,{className:`text-xs font-mono mt-0.5`,children:e.budget.maxToolCalls?.toLocaleString()??`—`})]}),(0,K.jsxs)(`div`,{className:`rounded bg-muted/30 p-1.5`,children:[(0,K.jsx)(`span`,{className:`text-[8px] text-muted-foreground uppercase tracking-wider`,children:n(`activity:agentRoster.customizedBadge`)}),(0,K.jsx)(`div`,{className:`text-xs font-mono mt-0.5`,children:n(a?`common:action.yes`:`common:action.no`)})]})]}),a&&t&&(0,K.jsxs)(`div`,{className:`rounded bg-accent/30 p-2 space-y-1`,children:[(0,K.jsx)(`span`,{className:`text-[9px] font-medium text-muted-foreground`,children:n(`activity:agentRoster.projectCustomizations`)}),(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-[9px]`,children:[t.hasIdentity&&(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,K.jsx)(ie,{className:`h-2.5 w-2.5 text-primary`}),` identity.md`]}),t.entryCount>0&&(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,K.jsx)(le,{className:`h-2.5 w-2.5 text-brand-2`}),` `,n(`activity:agentRoster.learnedEntriesCount`,{count:t.entryCount})]}),t.hasConfig&&(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,K.jsx)(_,{className:`h-2.5 w-2.5 text-muted-foreground`}),` config.json`]}),t.sessionCaptureCount>0&&(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,K.jsx)(z,{className:`h-2.5 w-2.5 text-success`}),` `,n(`activity:agentRoster.sessionCapturesCount`,{count:t.sessionCaptureCount})]})]})]})]})]},e.role)})}),f.length===0&&(0,K.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-40 text-muted-foreground`,children:[(0,K.jsx)(b,{className:`h-8 w-8 mb-2 opacity-30`}),(0,K.jsx)(`p`,{className:`text-sm`,children:n(`activity:agentRoster.noAgentsMatch`,{query:a})})]})]}),(0,K.jsxs)(`div`,{className:`shrink-0 border-t border-border/50 px-3 py-2 text-[10px] text-muted-foreground flex items-center gap-2`,children:[(0,K.jsxs)(`span`,{children:[(0,K.jsx)(`strong`,{children:t.length}),` `,n(`activity:agentRoster.footerRosterRoles`,{count:t.length})]}),(0,K.jsx)(`span`,{className:`text-muted-foreground/50`,children:`·`}),(0,K.jsxs)(`span`,{className:`text-brand-2`,children:[(0,K.jsx)(`strong`,{children:l.size}),` `,n(`activity:agentRoster.footerCustomized`,{count:l.size})]}),(0,K.jsx)(`span`,{className:`text-muted-foreground/50`,children:`·`}),(0,K.jsxs)(`span`,{children:[(0,K.jsx)(`strong`,{children:e.reduce((e,t)=>e+t.entryCount,0)}),` `,n(`activity:agentRoster.footerTotalLearned`,{count:e.reduce((e,t)=>e+t.entryCount,0)})]})]})]})}var St=[{id:`live`,icon:(0,K.jsx)(z,{className:`h-4 w-4`}),labelKey:`activity:agentRoster.tabLive`},{id:`officemap`,icon:(0,K.jsx)(Pe,{className:`h-4 w-4`}),labelKey:`activity:agentRoster.tabOfficeMap`},{id:`catalog`,icon:(0,K.jsx)(Ce,{className:`h-4 w-4`}),labelKey:`activity:agentRoster.tabCatalog`},{id:`learning`,icon:(0,K.jsx)(E,{className:`h-4 w-4`}),labelKey:`activity:agentRoster.tabLearning`},{id:`memory`,icon:(0,K.jsx)(w,{className:`h-4 w-4`}),labelKey:`activity:agentRoster.tabMemory`},{id:`customize`,icon:(0,K.jsx)(_,{className:`h-4 w-4`}),labelKey:`activity:agentRoster.tabCustomize`}],Ct=[{role:`generic`,name:`Generic Project Agent`,summary:`Flexible template that can be cloned into independently learning project roles.`,tools:0,budget:{maxIterations:2500,maxToolCalls:7500}},{role:`audit-log`,name:`Audit Log`,summary:`Analyzes session logs, event streams, and system traces.`,tools:12,budget:{timeoutMs:108e5,maxIterations:2500,maxToolCalls:7500}},{role:`bug-hunter`,name:`Bug Hunter`,summary:`Scans code for bugs, code smells, and anti-patterns.`,tools:15,budget:{timeoutMs:18e6,maxIterations:4e3,maxToolCalls:1e4}},{role:`refactor-planner`,name:`Refactor Planner`,summary:`Analyzes code structure and produces phased refactoring plans.`,tools:14,budget:{timeoutMs:144e5,maxIterations:3e3,maxToolCalls:9e3}},{role:`security-scanner`,name:`Security Scanner`,summary:`Scans code, configs, and dependencies for security issues.`,tools:18,budget:{timeoutMs:18e6,maxIterations:4e3,maxToolCalls:1e4}},{role:`critic`,name:`Critic`,summary:`Evaluates decisions, plans, and implementations.`,tools:10,budget:{timeoutMs:108e5,maxIterations:2e3,maxToolCalls:5e3}},{role:`shadow-agent`,name:`Shadow Agent`,summary:`Background monitoring agent that watches fleet health.`,tools:8,budget:{timeoutMs:36e6,maxIterations:500,maxToolCalls:2e3}},{role:`executor`,name:`Executor`,summary:`General-purpose task executor for delegated work.`,tools:20,budget:{timeoutMs:72e5,maxIterations:1500,maxToolCalls:4e3}},{role:`chimera`,name:`Chimera`,summary:`Post-session code quality review of changed files.`,tools:10,budget:{timeoutMs:72e5,maxIterations:1e3,maxToolCalls:3e3}},{role:`researcher`,name:`Researcher`,summary:`Web research and data gathering specialist.`,tools:8,budget:{timeoutMs:72e5,maxIterations:1e3,maxToolCalls:3e3}},{role:`tech-stack`,name:`Tech Stack Validator`,summary:`Validates package/library/framework choices.`,tools:9,budget:{timeoutMs:72e5,maxIterations:1e3,maxToolCalls:3e3}},{role:`orchestrator`,name:`Orchestrator`,summary:`Coordinates multi-agent task execution.`,tools:12,budget:{timeoutMs:144e5,maxIterations:3e3,maxToolCalls:8e3}},{role:`supervisor`,name:`Supervisor`,summary:`Oversees subagent execution and handles escalations.`,tools:10,budget:{timeoutMs:144e5,maxIterations:2e3,maxToolCalls:6e3}},{role:`quality-gate`,name:`Quality Gate`,summary:`Enforces quality gates on implementations.`,tools:8,budget:{timeoutMs:72e5,maxIterations:1e3,maxToolCalls:3e3}},{role:`architect`,name:`Architect`,summary:`Makes design and architecture decisions.`,tools:14,budget:{timeoutMs:144e5,maxIterations:3e3,maxToolCalls:8e3}},{role:`prompt-engineer`,name:`Prompt Engineer`,summary:`Designs and optimizes system prompts.`,tools:8,budget:{timeoutMs:72e5,maxIterations:1e3,maxToolCalls:3e3}},{role:`mnemosyne`,name:`Mnemosyne`,summary:`Memory curator — reviews and maintains SAGE integrity.`,tools:6,budget:{timeoutMs:72e5,maxIterations:500,maxToolCalls:2e3}},{role:`autophase`,name:`AutoPhase`,summary:`Manages multi-phase autonomous task execution.`,tools:10,budget:{timeoutMs:144e5,maxIterations:2e3,maxToolCalls:6e3}}];function wt({customStats:e,rosterLoading:t,onRefresh:n}){let{t:r}=V();return(0,K.jsx)(`div`,{className:`shrink-0 border-b border-border/70 bg-card/80 px-4 py-2.5`,children:(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-2 flex-nowrap min-w-0`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0 overflow-hidden`,children:[(0,K.jsx)(`div`,{className:`flex items-center justify-center w-8 h-8 shrink-0 rounded-lg bg-primary/10`,children:(0,K.jsx)(se,{className:`h-4 w-4 text-primary`})}),(0,K.jsxs)(`div`,{className:`min-w-0 overflow-hidden`,children:[(0,K.jsx)(`h1`,{className:`text-sm font-semibold truncate`,children:r(`activity:agentRoster.heading`)}),(0,K.jsx)(`p`,{className:`text-[10px] text-muted-foreground truncate`,children:r(`activity:agentRoster.headerSummary`,{customized:e.filter(e=>e.exists||e.hasIdentity||e.hasConfig||e.hasKnowledge).length,entries:e.reduce((e,t)=>e+t.entryCount,0)})})]})]}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[t&&(0,K.jsx)(A,{className:`h-4 w-4 animate-spin text-muted-foreground shrink-0`}),(0,K.jsxs)(`button`,{type:`button`,onClick:n,className:`inline-flex items-center gap-1 rounded border border-border/50 px-2 py-1 text-[10px] hover:bg-accent transition-colors shrink-0 whitespace-nowrap`,title:r(`activity:agentRoster.refreshRosterData`),children:[(0,K.jsx)(oe,{className:`h-3 w-3`}),` `,r(`common:action.refresh`)]})]})]})})}function Tt({activeTab:e,onTabChange:t}){let{t:n}=V();return(0,K.jsx)(`div`,{className:`shrink-0 border-b border-border/50 bg-muted/20 px-3 flex gap-0`,children:St.map(r=>(0,K.jsxs)(`button`,{type:`button`,onClick:()=>t(r.id),className:H(`flex items-center gap-1.5 px-3 py-2 text-[10px] font-medium border-b-2 transition-colors`,e===r.id?`border-primary text-primary`:`border-transparent text-muted-foreground hover:text-foreground hover:border-muted-foreground/30`),children:[r.icon,n(r.labelKey)]},r.id))})}var Et={running:{led:`bg-success`,badge:`bg-success/12 text-success`,icon:(0,K.jsx)(`span`,{className:`led text-success led-pulse`}),color:`text-success`},completed:{led:`bg-success`,badge:`bg-success/12 text-success`,icon:(0,K.jsx)(re,{className:`h-3.5 w-3.5`}),color:`text-success`},failed:{led:`bg-destructive`,badge:`bg-destructive/15 text-destructive`,icon:(0,K.jsx)(he,{className:`h-3.5 w-3.5`}),color:`text-destructive`},timeout:{led:`bg-warning`,badge:`bg-muted text-muted-foreground`,icon:(0,K.jsx)(De,{className:`h-3.5 w-3.5`}),color:`text-warning`},stopped:{led:`bg-muted-foreground`,badge:`bg-muted text-muted-foreground`,icon:(0,K.jsx)(`span`,{className:`led text-muted-foreground`}),color:`text-muted-foreground`},idle:{led:`bg-muted-foreground`,badge:`bg-muted text-muted-foreground`,icon:(0,K.jsx)(`span`,{className:`led text-muted-foreground`}),color:`text-muted-foreground`}},Dt=`__no_session__`,Ot=new Map,kt=new Set;r(e=>{Ot.delete(e),kt.add(e)});function At(e){let t=Math.floor(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60);if(n<60)return`${n}m ${t%60}s`;let r=Math.floor(n/60);return r<24?`${r}h ${n%60}m`:`${Math.floor(r/24)}d`}function jt(e){if(e==null||!Number.isFinite(e)||e<=0)return`$0`;if(e<.01){let t=e.toFixed(5);return t===`0.00000`?`$0`:`$`+t.replace(/(\d)0+$/,`$1`).replace(/\.$/,``)}return`$`+e.toFixed(3)}function Mt({nowTick:e}){let{t:n}=V(),r=i(e=>e.agents),o=u(),s=t(o??void 0),[c,l]=(0,G.useState)(null),[d,f]=(0,G.useState)(`all`),p=(0,G.useRef)(o??Dt);(0,G.useLayoutEffect)(()=>{let e=p.current;kt.has(e)||Ot.set(e,{selectedId:c,filter:d});let t=o??Dt,n=Ot.get(t);kt.delete(t),l(n?.selectedId??null),f(n?.filter??`all`),p.current=t},[o]);let m=(0,G.useMemo)(()=>Array.from(r.values()).filter(e=>a(e.sessionId,o)),[r,o]),h=(0,G.useMemo)(()=>{let e=[...m];return e.sort((e,t)=>{let n=e.status===`running`?0:1,r=t.status===`running`?0:1;return n===r?t.startedAt-e.startedAt:n-r}),d===`all`?e:d===`running`?e.filter(e=>e.status===`running`):d===`done`?e.filter(e=>e.status===`completed`):d===`failed`?e.filter(e=>e.status===`failed`||e.status===`timeout`):e},[m,d]),g=(0,G.useMemo)(()=>{let e=0,t=0,n=0;for(let r of m)r.status===`running`?e++:r.status===`completed`?t++:(r.status===`failed`||r.status===`timeout`)&&n++;return{running:e,completed:t,failed:n,total:m.length}},[m]),_=i(e=>e.clearFinishedAgents),v=c?h.find(e=>e.id===c):null;(0,G.useLayoutEffect)(()=>{c&&!m.some(e=>e.id===c)&&l(null)},[c,m]);let y=(0,G.useCallback)(e=>{let t=Ze.getState();e?(t.setInspectorFocusedAgentId(e),t.setInspectorTab(`agents`)):t.setInspectorTab(`fleet`),t.setInspectorOpen(!0)},[]);return h.length===0?(0,K.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-muted-foreground`,children:(0,K.jsxs)(`div`,{className:`text-center space-y-3`,children:[(0,K.jsx)(O,{className:`h-10 w-10 mx-auto opacity-30`}),(0,K.jsx)(`p`,{className:`text-sm`,children:n(`activity:agentRoster.noActiveFleetAgents`)}),(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground/70`,children:n(`activity:agentRoster.liveEmpty`)})]})}):(0,K.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:[(0,K.jsxs)(`div`,{className:H(`flex flex-col min-h-0 min-w-0 overflow-hidden`,v?`w-80 shrink-0 border-r border-border/50`:`flex-1`),children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0 px-3 py-2 border-b border-border/50`,children:[[`all`,`running`,`done`,`failed`].map(e=>(0,K.jsxs)(`button`,{type:`button`,onClick:()=>f(e),className:H(`rounded px-2 py-0.5 text-[10px] font-medium transition-colors`,d===e?`bg-primary/10 text-primary`:`text-muted-foreground hover:text-foreground hover:bg-muted/50`),children:[e===`all`&&n(`activity:agentRoster.filterAll`,{count:g.total}),e===`running`&&n(`activity:agentRoster.filterRunning`,{count:g.running}),e===`done`&&n(`activity:agentRoster.filterDone`,{count:g.completed}),e===`failed`&&n(`activity:agentRoster.filterFailed`,{count:g.failed})]},e)),(0,K.jsx)(`span`,{className:`flex-1`}),(0,K.jsxs)(`button`,{type:`button`,onClick:()=>Xe(`agents`),className:`inline-flex items-center gap-0.5 rounded px-1.5 py-0.5 text-[10px] text-muted-foreground hover:text-foreground hover:bg-muted/50 transition-colors`,title:n(`activity:agentRoster.openAgentsPanel`),children:[(0,K.jsx)(O,{className:`h-3 w-3`}),n(`activity:agentRoster.openAgentsPanel`)]}),g.completed+g.failed>0&&(0,K.jsxs)(`button`,{type:`button`,onClick:()=>_(o),className:`inline-flex items-center gap-0.5 rounded px-1.5 py-0.5 text-[10px] text-muted-foreground hover:text-destructive hover:bg-destructive/10 transition-colors`,children:[(0,K.jsx)(ne,{className:`h-2.5 w-2.5`}),` `,n(`activity:agentRoster.clear`)]})]}),(0,K.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-2 space-y-1`,children:h.map(e=>(0,K.jsxs)(`button`,{type:`button`,onClick:()=>l(c===e.id?null:e.id),className:H(`w-full text-left rounded-lg border px-3 py-2 transition-colors flex items-center gap-2`,c===e.id?`border-primary/50 bg-primary/[0.06]`:`border-border/60 hover:border-primary/30 hover:bg-primary/[0.03]`),children:[(0,K.jsx)(`span`,{className:H(`led shrink-0`,Et[e.status]?.led??`bg-muted-foreground`,e.status===`running`&&`led-pulse`)}),(0,K.jsx)(`span`,{className:`text-xs font-semibold min-w-0 truncate max-w-[7rem]`,children:e.name}),e.id===s&&(0,K.jsx)(ce,{className:`h-3 w-3 shrink-0 text-warning`}),e.model&&(0,K.jsx)(`span`,{className:`text-[9px] text-muted-foreground font-mono truncate max-w-[6rem] shrink-0`,children:e.model}),(0,K.jsxs)(`span`,{className:`text-[9px] text-muted-foreground tabular-nums shrink-0`,children:[e.iteration,`it · `,e.toolCalls,`t`]}),e.status===`running`&&(0,K.jsx)(`span`,{className:`text-[9px] text-primary tabular-nums shrink-0 ml-auto`,children:At(Date.now()-e.startedAt)}),e.status!==`running`&&(0,K.jsx)(`span`,{className:H(`text-[9px] tabular-nums shrink-0 ml-auto`,Et[e.status]?.color??`text-muted-foreground`),children:e.status}),e.costUsd>0&&(0,K.jsx)(`span`,{className:`text-[9px] text-success tabular-nums font-medium shrink-0`,children:jt(e.costUsd)}),e.status===`running`&&e.currentTool&&(0,K.jsxs)(`span`,{className:`text-[9px] text-primary font-mono truncate max-w-[6rem] shrink-0`,children:[`→ `,e.currentTool]})]},e.id))}),(0,K.jsxs)(`div`,{className:`shrink-0 border-t border-border/50 px-3 py-2 flex items-center gap-2 text-[10px] text-muted-foreground`,children:[(0,K.jsx)(`span`,{className:`font-medium tabular-nums`,children:g.total}),` `,n(`activity:agentRoster.agentsTotal`),(0,K.jsx)(`span`,{className:`text-muted-foreground/50`,children:`·`}),(0,K.jsx)(`span`,{className:`text-success tabular-nums`,children:g.running}),` running`,(0,K.jsx)(`span`,{className:`text-muted-foreground/50`,children:`·`}),(0,K.jsx)(`span`,{className:`tabular-nums`,children:g.completed}),` done`,g.failed>0&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`text-muted-foreground/50`,children:`·`}),(0,K.jsx)(`span`,{className:`text-destructive tabular-nums`,children:g.failed}),` failed`]}),(0,K.jsx)(`span`,{className:`flex-1`}),(0,K.jsxs)(`button`,{type:`button`,onClick:()=>y(),className:`inline-flex items-center gap-1 rounded border border-border/50 px-2 py-1 hover:bg-accent transition-colors`,children:[(0,K.jsx)(ae,{className:`h-3 w-3`}),n(`activity:agentRoster.fleetInspector`)]})]})]}),v&&(0,K.jsx)(`div`,{className:`flex-1 min-h-0 min-w-0 overflow-y-auto p-4`,children:(0,K.jsx)(Nt,{agent:v,nowTick:e})})]})}function Nt({agent:e,nowTick:n}){let{t:r}=V(),i=e.status===`running`?At(n-e.startedAt):e.completedAt?At(e.completedAt-e.startedAt):`-`,a=Math.min(100,Math.max(0,e.ctxPct)),o=e.currentTool||e.lastTool,s=t(e.sessionId);return(0,K.jsxs)(`div`,{className:`space-y-4`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,K.jsx)(`div`,{className:`flex items-center justify-center w-10 h-10 rounded-lg bg-primary/10`,children:(0,K.jsx)(O,{className:`h-5 w-5 text-primary`})}),(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`text-base font-semibold`,children:e.name}),e.id===s&&(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded border border-warning/30 bg-warning/10 px-1.5 py-0.5 text-[9px] font-medium text-warning`,children:[(0,K.jsx)(ce,{className:`h-2.5 w-2.5`}),` `,r(`activity:agentRoster.leader`)]})]}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] text-muted-foreground`,children:[(0,K.jsx)(`span`,{className:H(`led`,Et[e.status]?.led,e.status===`running`&&`led-pulse`)}),(0,K.jsx)(`span`,{children:e.status}),e.model&&(0,K.jsxs)(`span`,{children:[`· `,e.provider,`/`,e.model]}),(0,K.jsxs)(`span`,{children:[`· `,i]})]})]})]}),(0,K.jsxs)(`div`,{className:`grid grid-cols-4 gap-2`,children:[(0,K.jsxs)(`div`,{className:`rounded-lg border bg-card p-2`,children:[(0,K.jsx)(`span`,{className:`text-[9px] text-muted-foreground uppercase tracking-wider`,children:r(`activity:agentRoster.iterations`)}),(0,K.jsx)(`div`,{className:`text-lg font-mono font-semibold mt-0.5`,children:e.iteration})]}),(0,K.jsxs)(`div`,{className:`rounded-lg border bg-card p-2`,children:[(0,K.jsx)(`span`,{className:`text-[9px] text-muted-foreground uppercase tracking-wider`,children:r(`activity:agentRoster.toolCalls`)}),(0,K.jsx)(`div`,{className:`text-lg font-mono font-semibold mt-0.5`,children:e.toolCalls})]}),(0,K.jsxs)(`div`,{className:`rounded-lg border bg-card p-2`,children:[(0,K.jsx)(`span`,{className:`text-[9px] text-muted-foreground uppercase tracking-wider`,children:r(`activity:agentRoster.cost`)}),(0,K.jsx)(`div`,{className:`text-lg font-mono font-semibold mt-0.5 text-success`,children:jt(e.costUsd)})]}),(0,K.jsxs)(`div`,{className:`rounded-lg border bg-card p-2`,children:[(0,K.jsx)(`span`,{className:`text-[9px] text-muted-foreground uppercase tracking-wider`,children:r(`activity:agentRoster.context`)}),(0,K.jsxs)(`div`,{className:`text-lg font-mono font-semibold mt-0.5`,children:[a,`%`]})]})]}),e.maxContext>0&&(0,K.jsxs)(`div`,{className:`space-y-1`,children:[(0,K.jsxs)(`div`,{className:`flex justify-between text-[10px]`,children:[(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:r(`activity:agentRoster.contextWindow`)}),(0,K.jsxs)(`span`,{className:H(`tabular font-medium`,a>=85?`text-destructive`:a>=70?`text-warning`:`text-success`),children:[e.ctxTokens.toLocaleString(),` / `,e.maxContext.toLocaleString(),` tokens`]})]}),(0,K.jsx)(`div`,{className:`h-2 w-full overflow-hidden rounded-full bg-muted`,children:(0,K.jsx)(`div`,{className:H(`h-full rounded-full transition-all`,a>=85?`bg-destructive`:a>=70?`bg-warning`:`bg-primary`),style:{width:`${Math.max(2,a)}%`}})})]}),o&&(0,K.jsxs)(`div`,{className:H(`flex items-center gap-2 rounded-lg border px-3 py-2`,e.status===`running`?`border-primary/30 bg-primary/[0.04]`:`border-border bg-muted/30`),children:[(0,K.jsx)(ee,{className:H(`h-4 w-4`,e.status===`running`?`text-primary animate-pulse`:`text-muted-foreground`)}),(0,K.jsx)(`span`,{className:`text-sm font-mono`,children:e.currentTool??e.lastTool}),(0,K.jsx)(`span`,{className:`text-[10px] text-muted-foreground ml-auto`,children:e.currentTool?r(`activity:agentRoster.running`):`Last tool`})]}),e.error&&(0,K.jsxs)(`div`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 p-3`,children:[(0,K.jsx)(`span`,{className:`text-[10px] font-semibold text-destructive uppercase tracking-wider`,children:r(`activity:agentRoster.error`)}),(0,K.jsx)(`p`,{className:`text-xs text-destructive/90 mt-1`,children:e.error.message})]}),e.toolLog.length>0&&(0,K.jsxs)(`div`,{className:`space-y-1`,children:[(0,K.jsxs)(`span`,{className:`text-[10px] font-semibold text-muted-foreground uppercase tracking-wider`,children:[`Tool Log (`,e.toolLog.length,`)`]}),(0,K.jsx)(`div`,{className:`space-y-0.5`,children:e.toolLog.slice(0,10).map((e,t)=>(0,K.jsxs)(`div`,{className:H(`flex items-center gap-2 rounded px-2 py-1 text-[10px] font-mono`,e.ok?`bg-muted/30`:`bg-destructive/5 border border-destructive/20`),children:[(0,K.jsx)(`span`,{className:H(`led shrink-0`,e.ok?`text-success`:`text-destructive`)}),(0,K.jsx)(`span`,{className:`truncate flex-1`,children:e.name}),(0,K.jsxs)(`span`,{className:`tabular text-muted-foreground`,children:[e.durationMs,`ms`]}),!e.ok&&(0,K.jsx)(`span`,{className:`text-destructive`,children:`✗`})]},`${e.name}-${t}`))})]}),e.budgetWarning&&(0,K.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 rounded-lg bg-warning/10 border border-warning/25 text-xs`,children:[(0,K.jsx)(B,{className:`h-3.5 w-3.5 text-warning shrink-0`}),(0,K.jsxs)(`span`,{className:`text-warning`,children:[`Budget: `,e.budgetWarning.kind,` limit (`,e.budgetWarning.used,`/`,e.budgetWarning.limit,`)`]})]})]})}function Pt({populated:e,selectedRole:t,onSelectRole:n,onBulkOptimize:r,bulkOptimizing:i}){let{t:a}=V(),o=e.filter(e=>e.needsSummarization);return(0,K.jsxs)(`div`,{className:H(`flex flex-col min-h-0 min-w-0 overflow-hidden border-r border-border/50`,t?`w-80 shrink-0`:`flex-1`),children:[(0,K.jsxs)(`div`,{className:`shrink-0 px-3 py-2 border-b border-border/50`,children:[(0,K.jsxs)(`h3`,{className:`text-xs font-semibold flex items-center gap-1.5`,children:[(0,K.jsx)(le,{className:`h-3.5 w-3.5 text-brand-2`}),a(`activity:agentRoster.allRosterAgents`)]}),o.length>0&&(0,K.jsxs)(`div`,{className:`mt-2 flex flex-col gap-1.5 rounded border border-warning/40 bg-warning/10 px-2 py-1.5`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(B,{className:`h-3 w-3 text-warning shrink-0`}),(0,K.jsxs)(`span`,{className:`text-[10px] text-warning leading-tight`,children:[o.length,` agent`,o.length>1?`s`:``,` need`,o.length===1?`s`:``,` optimization`]}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>{let e=o[0];e&&n(e.role)},className:`ml-auto text-[9px] text-warning underline hover:text-warning/80 shrink-0`,children:a(`activity:agentRoster.review`)})]}),(0,K.jsxs)(`button`,{type:`button`,onClick:()=>r(o.map(e=>e.role)),disabled:i,className:`flex items-center justify-center gap-1 rounded bg-warning/20 border border-warning/40 px-2 py-1 text-[10px] font-medium text-warning hover:bg-warning/30 transition-colors disabled:opacity-50`,children:[i?(0,K.jsx)(A,{className:`h-3 w-3 animate-spin`}):(0,K.jsx)(B,{className:`h-3 w-3`}),i?a(`activity:agentRoster.optimizing`):a(`activity:agentRoster.optimizeAll`,{count:o.length})]})]})]}),(0,K.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-2 space-y-1`,children:e.map(e=>(0,K.jsxs)(`button`,{type:`button`,onClick:()=>n(e.role),className:H(`w-full text-left rounded-lg border px-3 py-2 transition-colors`,t===e.role?`border-primary/50 bg-primary/[0.06]`:`border-border/60 hover:border-primary/30`,e.needsSummarization&&t!==e.role&&`border-warning/40`),children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,K.jsx)(`span`,{className:`text-xs font-semibold`,children:e.role}),(0,K.jsx)(`span`,{className:H(`text-[9px] tabular-nums`,e.learningEnabled?`text-success`:`text-muted-foreground`),children:e.learningEnabled?a(`activity:agentRoster.learning`):a(`activity:agentRoster.paused`)})]}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2 mt-1 text-[9px] text-muted-foreground`,children:[(0,K.jsxs)(`span`,{className:`tabular-nums`,children:[e.entryCount,` entries`]}),e.sessionCaptureCount>0&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`text-muted-foreground/50`,children:`·`}),(0,K.jsxs)(`span`,{className:`text-success tabular-nums`,children:[`+`,e.sessionCaptureCount]})]}),typeof e.directiveHitRate==`number`&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`text-muted-foreground/50`,children:`·`}),(0,K.jsxs)(`span`,{className:H(`tabular-nums`,e.directiveHitRate>=.7?`text-success`:e.directiveHitRate<.4&&`text-warning`),title:`Share of directive applications that ended in a successful task`,children:[Math.round(e.directiveHitRate*100),`%`]})]}),e.lastCapture&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`text-muted-foreground/50`,children:`·`}),(0,K.jsx)(`span`,{children:new Date(e.lastCapture).toLocaleDateString()})]}),e.needsSummarization&&(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 text-warning font-medium`,children:[(0,K.jsx)(B,{className:`h-2.5 w-2.5`}),`optimize`]})]})]},e.role))})]})}var Ft={size:`buffer reached the size threshold`,"pending-skills":`directives are waiting to reach their skill`,disabled:`auto-optimization is off`,"learning-paused":`learning is paused for this agent`,"too-few-entries":`not enough directives yet`,"below-threshold":`below the threshold`,"cooling-down":`recently optimized — cooling down`};function It({selectedRole:e,selectedStats:t,saving:n,setLearningEnabled:r,optimizing:i,runOptimize:a,autoStatus:o,consolidatedContent:s,loadConsolidated:c,setConsolidatedContent:l,skills:u,toggleSkillBody:d,toggleSkillPin:f,openSkill:p,retired:m,showRetired:h,setShowRetired:g,loadEntries:_,loadingEntries:v,reviewEntries:y,reviewDecisions:b,setReviewEntries:x,setReviewDecisions:S,applyReview:C,teachInput:w,setTeachInput:T,runTeach:D,teachFeedback:O}){let{t:k}=V();return(0,K.jsxs)(`div`,{className:`space-y-4`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,K.jsx)(`h3`,{className:`text-base font-semibold`,children:e}),(0,K.jsx)(`div`,{className:`flex gap-1`,children:(0,K.jsxs)(`button`,{type:`button`,onClick:()=>r(e,!t.learningEnabled),disabled:n,className:H(`inline-flex items-center gap-1 rounded border px-2 py-1 text-[10px] transition-colors disabled:opacity-50`,t.learningEnabled?`border-success/40 text-success hover:bg-success/10`:`border-border/50 text-muted-foreground hover:bg-accent`),children:[(0,K.jsx)(le,{className:`h-3 w-3`}),` `,t.learningEnabled?k(`activity:agentRoster.learningOn`):k(`activity:agentRoster.learningPaused`)]})})]}),(0,K.jsxs)(`div`,{className:`grid grid-cols-3 gap-2`,children:[(0,K.jsxs)(`div`,{className:`rounded-lg border bg-card p-2`,children:[(0,K.jsx)(`span`,{className:`text-[9px] text-muted-foreground uppercase tracking-wider`,children:k(`activity:agentRoster.entries`)}),(0,K.jsx)(`div`,{className:`text-lg font-mono font-semibold mt-0.5`,children:t.entryCount})]}),(0,K.jsxs)(`div`,{className:`rounded-lg border bg-card p-2`,children:[(0,K.jsx)(`span`,{className:`text-[9px] text-muted-foreground uppercase tracking-wider`,children:k(`activity:agentRoster.size`)}),(0,K.jsxs)(`div`,{className:`text-lg font-mono font-semibold mt-0.5`,children:[t.totalBytes,`B`]})]}),(0,K.jsxs)(`div`,{className:`rounded-lg border bg-card p-2`,children:[(0,K.jsx)(`span`,{className:`text-[9px] text-muted-foreground uppercase tracking-wider`,children:k(`activity:agentRoster.lifetimeCaptures`)}),(0,K.jsx)(`div`,{className:`text-lg font-mono font-semibold mt-0.5`,children:t.lifetimeCaptureCount})]}),(0,K.jsxs)(`div`,{className:`rounded-lg border bg-card p-2`,children:[(0,K.jsx)(`span`,{className:`text-[9px] text-muted-foreground uppercase tracking-wider`,children:k(`activity:agentRoster.lastCapture`)}),(0,K.jsx)(`div`,{className:`text-lg font-mono font-semibold mt-0.5`,children:t.lastCapture?new Date(t.lastCapture).toLocaleDateString():`—`})]}),(0,K.jsxs)(`div`,{className:`rounded-lg border bg-card p-2`,title:`Share of directive applications that ended in a successful task. Blank until a directive has actually been exercised on one.`,children:[(0,K.jsx)(`span`,{className:`text-[9px] text-muted-foreground uppercase tracking-wider`,children:k(`activity:agentRoster.hitRate`)}),(0,K.jsxs)(`div`,{className:H(`text-lg font-mono font-semibold mt-0.5`,typeof t.directiveHitRate==`number`&&(t.directiveHitRate>=.7?`text-success`:t.directiveHitRate<.4&&`text-warning`)),children:[typeof t.directiveHitRate==`number`?`${Math.round(t.directiveHitRate*100)}%`:`—`,typeof t.appliedEntryCount==`number`&&t.appliedEntryCount>0&&(0,K.jsxs)(`span`,{className:`text-[9px] text-muted-foreground font-sans ml-1`,children:[`of `,t.appliedEntryCount]})]})]}),(0,K.jsxs)(`div`,{className:`rounded-lg border bg-card p-2`,title:`Directives that have never been exercised on a task. Anchors — exact commands, paths, package names — are what let the runtime tell that a directive was applied.`,children:[(0,K.jsx)(`span`,{className:`text-[9px] text-muted-foreground uppercase tracking-wider`,children:k(`activity:agentRoster.neverUsed`)}),(0,K.jsx)(`div`,{className:`text-lg font-mono font-semibold mt-0.5`,children:typeof t.deadEntryCount==`number`?t.deadEntryCount:`—`})]})]}),t.needsSummarization&&(0,K.jsxs)(`div`,{className:`flex items-center gap-3 text-xs text-warning bg-warning/10 rounded-lg px-3 py-2.5`,children:[(0,K.jsx)(ue,{className:`h-4 w-4 shrink-0`}),(0,K.jsx)(`span`,{className:`flex-1`,children:k(`activity:agentRoster.learningsLimitExceeded`,{bytes:t.totalBytes.toLocaleString()})}),(0,K.jsxs)(`button`,{type:`button`,onClick:()=>a(e),disabled:i,className:`inline-flex items-center gap-1 rounded bg-warning/20 text-warning border border-warning/40 px-2.5 py-1 text-[10px] font-medium hover:bg-warning/30 transition-colors disabled:opacity-50 shrink-0`,children:[i?(0,K.jsx)(A,{className:`h-3 w-3 animate-spin`}):(0,K.jsx)(B,{className:`h-3 w-3`}),i?k(`activity:agentRoster.optimizing`):`Optimize Now`]})]}),(0,K.jsxs)(`div`,{className:`space-y-2 border border-border rounded-lg p-3 bg-card`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,K.jsx)(pe,{className:`h-4 w-4 text-primary`}),(0,K.jsx)(`span`,{className:`text-xs font-semibold`,children:k(`activity:agentRoster.optimizeLearnings`)})]}),(0,K.jsxs)(`button`,{type:`button`,onClick:()=>a(e),disabled:i||t.entryCount===0,className:`inline-flex items-center gap-1 rounded bg-primary px-3 py-1.5 text-xs text-primary-foreground hover:bg-primary/90 transition-colors disabled:opacity-50`,title:t.entryCount===0?`No raw entries to optimize`:`Synthesize raw entries into a consolidated, narrowly-scoped document`,children:[i?(0,K.jsx)(A,{className:`h-3.5 w-3.5 animate-spin`}):(0,K.jsx)(B,{className:`h-3.5 w-3.5`}),i?k(`activity:agentRoster.optimizing`):`Optimize`]})]}),o&&(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px]`,children:[(0,K.jsx)(`span`,{className:H(`inline-block h-1.5 w-1.5 rounded-full`,o.enabled?o.eligible?`bg-warning`:`bg-success`:`bg-muted-foreground`)}),(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:o.enabled?o.eligible?`Queued automatically: ${Ft[o.reason]??o.reason}.`:`Automatic — ${Ft[o.reason]??o.reason}.`:`Automatic optimization is off — run it manually.`})]}),(0,K.jsxs)(`p`,{className:`text-[10px] text-muted-foreground leading-relaxed`,children:[`Synthesizes all `,t.entryCount,` raw entries into a single reviewed document — narrowly scoped to this agent's skills, preserving every fact but reducing context volume. The result replaces raw entries in the agent's prompt.`]}),t.isConsolidated&&t.consolidation&&(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] text-muted-foreground pt-1 border-t border-border/50`,children:[(0,K.jsx)(re,{className:`h-3 w-3 text-success`}),(0,K.jsxs)(`span`,{children:[`Consolidated`,` `,new Date(t.consolidation.consolidatedAt).toLocaleDateString(),` ·`,` `,t.consolidation.sourceBytes,`B →`,` `,t.consolidation.consolidatedBytes,`B`,t.consolidation.sourceEntryCount<t.entryCount&&(0,K.jsxs)(`span`,{className:`text-warning ml-1`,children:[`· `,t.entryCount-t.consolidation.sourceEntryCount,` `,k(`activity:agentRoster.newPending`)]})]}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>{s===null?c(e):l(null)},className:`ml-auto underline text-primary hover:text-primary/80`,children:s===null?k(`activity:agentRoster.viewAction`):`Hide`})]}),s!==null&&(0,K.jsxs)(`div`,{className:`mt-2 max-h-72 overflow-y-auto rounded border border-border/50 bg-background/50 p-2`,children:[(0,K.jsxs)(`div`,{className:`text-[10px] text-muted-foreground mb-1 font-medium`,children:[`Consolidated knowledge for `,e]}),(0,K.jsx)(`pre`,{className:`text-[10px] whitespace-pre-wrap font-sans leading-relaxed`,children:s||`(empty)`})]})]}),u&&u.length>0&&(0,K.jsxs)(`div`,{className:`space-y-2 border border-border rounded-lg p-3 bg-card`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,K.jsx)(E,{className:`h-4 w-4 text-brand-2`}),(0,K.jsx)(`span`,{className:`text-xs font-semibold`,children:`Skills`}),(0,K.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[u.filter(e=>e.developed).length,` of `,u.length,` developed for this project`]})]}),(0,K.jsxs)(`p`,{className:`text-[10px] text-muted-foreground leading-relaxed`,children:[`A developed skill carries a project addendum injected right after the bundled skill body — the agent reads one skill, refined for this codebase. Only the highest-ranked few are loaded per spawn; `,(0,K.jsx)(`span`,{className:`text-primary`,children:`loaded`}),` marks those.`]}),(0,K.jsx)(`div`,{className:`space-y-1`,children:u.map(t=>(0,K.jsxs)(`div`,{className:`rounded border border-border/60`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-1.5`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:()=>d(e,t.skill),disabled:!t.developed,className:H(`text-[11px] font-mono text-left flex-1 truncate`,t.developed?`text-primary hover:underline`:`text-muted-foreground cursor-default`),children:t.skill}),t.eager&&(0,K.jsx)(`span`,{className:`text-[9px] rounded bg-primary/15 text-primary px-1.5 py-0.5`,title:`Ranked high enough to be loaded into a spawn of this role`,children:`loaded`}),t.developed&&(0,K.jsx)(`span`,{className:`text-[9px] rounded bg-success/15 text-success px-1.5 py-0.5`,children:`developed`}),t.affinity&&(0,K.jsxs)(`span`,{className:`text-[9px] text-muted-foreground tabular-nums`,children:[t.affinity.learned>0&&`${t.affinity.learned} learned · `,t.affinity.succeeded,`✓/`,t.affinity.failed,`✗`]}),typeof t.score==`number`&&(0,K.jsx)(`span`,{className:`text-[9px] text-muted-foreground tabular-nums`,title:`Project affinity score — higher is loaded first`,children:t.score.toFixed(2)}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>f(e,t.skill,!t.affinity?.pinned),className:H(`text-[9px] rounded border px-1.5 py-0.5 transition-colors`,t.affinity?.pinned?`border-primary/50 text-primary`:`border-border/50 text-muted-foreground hover:bg-accent`),children:t.affinity?.pinned?`pinned`:`pin`})]}),p?.skill===t.skill&&(0,K.jsx)(`div`,{className:`max-h-60 overflow-y-auto border-t border-border/50 bg-background/50 p-2`,children:(0,K.jsx)(`pre`,{className:`text-[10px] whitespace-pre-wrap font-sans leading-relaxed`,children:p.content||`(empty)`})})]},t.skill))})]}),m&&m.length>0&&(0,K.jsxs)(`div`,{className:`space-y-2 border border-border rounded-lg p-3 bg-card`,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:()=>g(e=>!e),className:`flex w-full items-center gap-1.5 text-left`,children:[(0,K.jsx)(ue,{className:`h-4 w-4 text-warning`}),(0,K.jsx)(`span`,{className:`text-xs font-semibold`,children:`Retired`}),(0,K.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[m.length,` directive`,m.length===1?``:`s`,` no longer injected`]}),(0,K.jsx)(`span`,{className:`ml-auto text-[10px] text-muted-foreground`,children:h?`hide`:`show`})]}),h&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{className:`text-[10px] text-muted-foreground leading-relaxed`,children:`Each of these was exercised repeatedly and kept correlating with failed tasks, so it was removed from the buffer and scrubbed out of the distilled documents.`}),(0,K.jsx)(`ul`,{className:`space-y-1`,children:m.map(e=>(0,K.jsxs)(`li`,{className:`rounded border border-border/60 px-2 py-1.5 text-[10px] leading-relaxed`,children:[e.skill&&(0,K.jsx)(`span`,{className:`mr-1.5 rounded bg-muted px-1 py-0.5 font-mono text-[9px] text-muted-foreground`,children:e.skill}),(0,K.jsx)(`span`,{className:`text-muted-foreground line-through`,children:e.what})]},e.what))})]})]}),t.entryCount>0&&(0,K.jsxs)(`div`,{className:`space-y-2`,children:[(0,K.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,K.jsxs)(`button`,{type:`button`,onClick:()=>_(e),disabled:v,className:`inline-flex items-center gap-1 rounded border border-border/50 px-3 py-1.5 text-xs hover:bg-accent transition-colors`,children:[v?(0,K.jsx)(A,{className:`h-3 w-3 animate-spin`}):(0,K.jsx)(Ce,{className:`h-3 w-3`}),`Review Learned Entries (`,t.entryCount,`)`]})}),y&&(0,K.jsxs)(`div`,{className:`space-y-2 border border-border rounded-lg p-3 bg-card`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,K.jsxs)(`span`,{className:`text-xs font-medium`,children:[y.filter((e,t)=>b[t]!==`drop`).length,`/`,y.length,` kept`]}),(0,K.jsxs)(`div`,{className:`flex gap-2`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:C,disabled:n,className:`inline-flex items-center gap-1 rounded bg-primary px-2 py-1 text-[10px] text-primary-foreground hover:bg-primary/90 transition-colors`,children:n?k(`activity:agentRoster.applying`):`Apply Selection`}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>{x(null),S({})},className:`inline-flex items-center gap-1 rounded border border-border/50 px-2 py-1 text-[10px] hover:bg-accent transition-colors`,children:k(`activity:agentRoster.cancel`)})]})]}),(0,K.jsx)(`div`,{className:`max-h-72 overflow-y-auto space-y-2`,children:y.map((e,t)=>{let n=b[t]??`keep`,r=e.length>200?e.slice(0,200)+`…`:e;return(0,K.jsx)(`div`,{className:H(`rounded-lg border p-2 transition-colors`,n===`drop`?`border-destructive/40 bg-destructive/5 opacity-60`:`border-border`),children:(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,K.jsx)(`pre`,{className:`text-[10px] whitespace-pre-wrap flex-1 leading-relaxed font-sans`,children:r}),(0,K.jsxs)(`div`,{className:`flex gap-1 shrink-0`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:()=>S(e=>({...e,[t]:`keep`})),className:H(`px-2 py-1 text-[9px] rounded`,n===`keep`?`bg-success/20 text-success`:`bg-muted text-muted-foreground`),children:k(`activity:agentRoster.keep`)}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>S(e=>({...e,[t]:`drop`})),className:H(`px-2 py-1 text-[9px] rounded`,n===`drop`?`bg-destructive/20 text-destructive`:`bg-muted text-muted-foreground`),children:k(`activity:agentRoster.drop`)})]})]})},t)})})]})]}),(0,K.jsxs)(`div`,{className:`space-y-2 pt-4 border-t border-border`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1 text-sm font-medium`,children:[(0,K.jsx)(E,{className:`h-4 w-4 text-brand-2`}),` `,k(`activity:agentRoster.teachThisAgent`)]}),(0,K.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:k(`activity:agentRoster.describeACommandPatternOrBehavior`)}),(0,K.jsx)(`textarea`,{className:`w-full h-20 text-xs p-2 bg-card border border-border rounded resize-y`,value:w,onChange:e=>T(e.target.value),placeholder:k(`activity:agentRoster.eGAlwaysUsePnpmForThisProject`)}),(0,K.jsxs)(`div`,{className:`flex justify-between items-center`,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:D,disabled:!w.trim()||n,className:`inline-flex items-center gap-1 rounded bg-primary px-3 py-1.5 text-xs text-primary-foreground hover:bg-primary/90 transition-colors disabled:opacity-50`,children:[(0,K.jsx)(E,{className:`h-3.5 w-3.5`}),` `,k(`activity:agentRoster.teach`)]}),O&&(0,K.jsx)(`span`,{className:H(`text-xs`,O.ok?`text-success`:`text-destructive`),children:O.msg})]})]})]})}function Lt({customStats:e,onRefresh:t}){let{t:r}=V(),[i,a]=(0,G.useState)(null),[o,c]=(0,G.useState)(null),[l,u]=(0,G.useState)({}),[d,f]=(0,G.useState)(``),[p,m]=(0,G.useState)(null),[h,g]=(0,G.useState)(!1),[_,v]=(0,G.useState)(!1),[y,b]=(0,G.useState)(null),[x,S]=(0,G.useState)(!1),[C,w]=(0,G.useState)(!1),[T,E]=(0,G.useState)(null),[D,O]=(0,G.useState)(null),[k,A]=(0,G.useState)(!1),[j,M]=(0,G.useState)(null),[ee,N]=(0,G.useState)(null),P=(0,G.useMemo)(()=>[...e].sort((e,t)=>e.role.localeCompare(t.role)),[e]),F=(0,G.useMemo)(()=>i?P.find(e=>e.role===i):null,[i,P]),te=(0,G.useCallback)(async e=>{v(!0),c(null);try{let t=await W(`agent-roster.read-learned`,{role:e});c(t.entries??[]),u({})}catch{}v(!1)},[]),ne=(0,G.useCallback)(async()=>{if(!i||!o)return;g(!0);let e=o.filter((e,t)=>l[t]!==`drop`).join(`
2
+
3
+ ---
4
+
5
+ `);try{await W(`agent-roster.update-learned`,{role:i,content:e}),c(null),u({})}catch{}g(!1)},[i,o,l]),re=(0,G.useCallback)(async()=>{if(i&&d.trim()){m(null),g(!0);try{let e=`> Taught ${new Date().toISOString().slice(0,10)}\n\n${d.trim()}`;(await W(`agent-roster.append-learned`,{role:i,content:e})).success?(m({ok:!0,msg:r(`activity:customRoster.behaviorSaved`)}),f(``),t()):m({ok:!1,msg:r(`activity:agentRoster.saveFailed`)})}catch(e){m({ok:!1,msg:e instanceof Error?e.message:r(`activity:agentRoster.failed`)})}g(!1)}},[t,i,d,r]),ie=(0,G.useCallback)(async(e,n)=>{g(!0),m(null);try{let i=await W(`agent-roster.update-learning`,{role:e,enabled:n});if(i.error)throw Error(i.error);m({ok:!0,msg:r(n?`activity:agentRoster.learningResumed`:`activity:agentRoster.autoLearningPaused`)}),t()}catch(e){m({ok:!1,msg:e instanceof Error?e.message:r(`activity:agentRoster.policyUpdateFailed`)})}finally{g(!1)}},[t,r]),ae=(0,G.useCallback)(async e=>{try{let t=await W(`agent-roster.auto-optimize-status`,{role:e}),n=t.roles?.find(t=>t.role===e);M(n?{enabled:t.policy?.enabled!==!1,eligible:n.eligible,reason:n.reason}:null)}catch{M(null)}},[]),oe=(0,G.useCallback)(async e=>{try{let t=await W(`agent-roster.skills`,{role:e});E(t.skills??[])}catch{E([])}},[]),se=(0,G.useCallback)(async e=>{try{let t=await W(`agent-roster.quarantine`,{role:e});O(t.retired??[])}catch{O([])}},[]),ce=(0,G.useCallback)(async(e,t)=>{if(ee?.skill===t){N(null);return}try{let n=await W(`agent-roster.read-skill`,{role:e,skill:t});N({skill:t,content:n.content??``})}catch{N({skill:t,content:``})}},[ee]),le=(0,G.useCallback)(async(e,t,n)=>{try{await W(`agent-roster.pin-skill`,{role:e,skill:t,pinned:n}),await oe(e)}catch{}},[oe]),I=(0,G.useCallback)(async e=>{try{let t=await W(`agent-roster.read-consolidated`,{role:e});b(t.isConsolidated?t.content:null)}catch{b(null)}},[]);return{selectedRole:i,reviewEntries:o,setReviewEntries:c,reviewDecisions:l,setReviewDecisions:u,teachInput:d,setTeachInput:f,teachFeedback:p,saving:h,loadingEntries:_,consolidatedContent:y,setConsolidatedContent:b,optimizing:x,bulkOptimizing:C,skills:T,retired:D,showRetired:k,setShowRetired:A,autoStatus:j,openSkill:ee,populated:P,selectedStats:F,loadEntries:te,applyReview:ne,runTeach:re,setLearningEnabled:ie,toggleSkillBody:ce,toggleSkillPin:le,loadConsolidated:I,runOptimize:(0,G.useCallback)(async e=>{S(!0),m(null);try{let i=await W(`agent-roster.consolidate`,{role:e});if(i.error)throw Error(i.error);if(i.rawEntryCount===0){m({ok:!1,msg:r(`activity:agentRoster.noRawEntries`)});return}if(i.consolidated){await t(),await I(e),await oe(e),await ae(e),await se(e),m({ok:!0,msg:r(`activity:agentRoster.optimizedOk`)}),s.success(i.model?r(`activity:agentRoster.consolidatedWithModel`,{model:i.model}):r(`activity:agentRoster.consolidatedPlain`));return}if(i.emptySynthesis){m({ok:!1,msg:r(`activity:agentRoster.emptySynthesis`)}),s.error(r(`activity:agentRoster.optimizationEmptyToast`));return}let a=i.instruction;if(!a)throw Error(`No consolidation instruction generated`);let o=et.getState();o.addMessage({role:`user`,content:a}),o.setLoading(!0),n().sendMessage(a);let c=Ze.getState();c.setSidebarOpen(!1),c.setCurrentView(`chat`),m({ok:!0,msg:r(`activity:agentRoster.noActiveModelMsg`)}),s.info(r(`activity:agentRoster.noActiveModelToast`))}catch(e){m({ok:!1,msg:e instanceof Error?e.message:r(`activity:agentRoster.optimizationFailed`)}),s.error(e instanceof Error?e.message:r(`activity:agentRoster.optimizationFailed`))}finally{S(!1)}},[t,I,oe,ae,se,r]),runBulkOptimize:(0,G.useCallback)(async e=>{if(e.length!==0){w(!0),m(null);try{let t=[],r=0,a=0,o=``,c=[];for(let n of e)try{let e=await W(`agent-roster.consolidate`,{role:n});e.error?(a++,o=e.error):e.consolidated?t.push(n):e.rawEntryCount===0?r++:e.emptySynthesis?(a++,o=`Model returned an empty result`):e.instruction?c.push({role:n,instruction:e.instruction}):(a++,o=`No consolidation produced`)}catch(e){a++,o=e instanceof Error?e.message:String(e)}if(i&&t.includes(i)&&await I(i),c.length>0){let e=`Optimize the learned data for ${c.length} agent${c.length>1?`s`:``}. For each agent below, read its raw learned entries, synthesize them into a single narrowly-scoped document preserving every fact, and save the result to its consolidated.md file.\n\n`+c.map(e=>`## Agent: ${e.role}\n\n${e.instruction}`).join(`
6
+
7
+ ---
8
+
9
+ `),t=et.getState();t.addMessage({role:`user`,content:e}),t.setLoading(!0),n().sendMessage(e);let r=Ze.getState();r.setSidebarOpen(!1),r.setCurrentView(`chat`)}if(t.length===0&&c.length===0){if(a>0){let t=r>0?` ${r} skipped.`:``,n=`Bulk consolidate failed for ${a} of ${e.length} agent${e.length>1?`s`:``}.${o?` Last error: ${o}`:``}${t}`;m({ok:!1,msg:n});return}let t=r>0?`Bulk optimize: ${r} skipped (no entries to optimize).`:`No agents had optimizable entries.`;m({ok:!0,msg:t}),s.info(t,6e3);return}let l=[];t.length>0&&l.push(`${t.length} consolidated`),c.length>0&&l.push(`${c.length} sent to chat`),r>0&&l.push(`${r} skipped`),a>0&&l.push(`${a} failed`);let u=`Bulk optimize: ${l.join(`, `)}.`;m({ok:a===0,msg:u}),t.length>0&&c.length===0?s.success(u,6e3):s.info(u,6e3)}catch(e){m({ok:!1,msg:e instanceof Error?e.message:r(`activity:agentRoster.bulkOptimizationFailed`)}),s.error(e instanceof Error?e.message:r(`activity:agentRoster.bulkOptimizationFailed`))}finally{w(!1)}}},[i,I,r]),selectRole:(0,G.useCallback)(e=>{a(e),c(null),b(null),N(null),O(null),A(!1),oe(e),ae(e),se(e)},[oe,ae,se])}}function Rt({customStats:e,onRefresh:t}){let{t:n}=V(),r=Lt({customStats:e,onRefresh:t});return r.populated.length===0?(0,K.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-muted-foreground`,children:(0,K.jsxs)(`div`,{className:`text-center space-y-3`,children:[(0,K.jsx)(le,{className:`h-10 w-10 mx-auto opacity-30`}),(0,K.jsx)(`p`,{className:`text-sm`,children:n(`activity:agentRoster.noSelfLearningDataYet`)}),(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground/70`,children:n(`activity:agentRoster.learningsEmpty`)})]})}):(0,K.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:[(0,K.jsx)(Pt,{populated:r.populated,selectedRole:r.selectedRole,onSelectRole:r.selectRole,onBulkOptimize:r.runBulkOptimize,bulkOptimizing:r.bulkOptimizing}),(0,K.jsxs)(`div`,{className:`flex-1 min-h-0 min-w-0 overflow-y-auto p-4`,children:[!r.selectedRole&&(0,K.jsx)(`div`,{className:`flex items-center justify-center h-full text-muted-foreground`,children:n(`activity:agentRoster.selectAnAgentToViewLearning`)}),r.selectedRole&&r.selectedStats&&(0,K.jsx)(It,{selectedRole:r.selectedRole,selectedStats:r.selectedStats,saving:r.saving,setLearningEnabled:r.setLearningEnabled,optimizing:r.optimizing,runOptimize:r.runOptimize,autoStatus:r.autoStatus,consolidatedContent:r.consolidatedContent,loadConsolidated:r.loadConsolidated,setConsolidatedContent:r.setConsolidatedContent,skills:r.skills,toggleSkillBody:r.toggleSkillBody,toggleSkillPin:r.toggleSkillPin,openSkill:r.openSkill,retired:r.retired,showRetired:r.showRetired,setShowRetired:r.setShowRetired,loadEntries:r.loadEntries,loadingEntries:r.loadingEntries,reviewEntries:r.reviewEntries,reviewDecisions:r.reviewDecisions,setReviewEntries:r.setReviewEntries,setReviewDecisions:r.setReviewDecisions,applyReview:r.applyReview,teachInput:r.teachInput,setTeachInput:r.setTeachInput,runTeach:r.runTeach,teachFeedback:r.teachFeedback})]})]})}function zt(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}function Bt(e){return typeof e==`number`&&Number.isFinite(e)?e:void 0}function q(e){return typeof e==`string`&&e.trim()?e.trim():void 0}function J(e,t){for(let n of t){let t=q(e[n]);if(t)return t}}function Y(e,t){for(let n of t){let t=Bt(e[n]);if(t!==void 0)return t}}function Vt(e){return e.split(/[\\/]/).filter(Boolean).pop()??e}function Ht(e){return e?e.split(/\r?\n/).length:0}function Ut(e){let t=0,n=0;for(let r of e.split(/\r?\n/))r.startsWith(`+++`)||r.startsWith(`---`)||(r.startsWith(`+`)&&(t+=1),r.startsWith(`-`)&&(n+=1));return t||n?{added:t,removed:n}:null}function Wt(e){let t=e.split(/\r?\n/,1)[0]?.trim()??e;return t.length>72?`${t.slice(0,69)}…`:t}function Gt(e){let t=e.toLowerCase().replace(/[.:/-]+/g,`_`);return/^(read|view|open_file|read_file)|file_read/.test(t)?`read`:/^(write|create|save)|file_write/.test(t)?`write`:/edit|update|patch|replace|apply_patch/.test(t)?`edit`:/bash|shell|terminal|exec|command|powershell|cmd/.test(t)?`terminal`:/fetch|browser|browse|http|url|web/.test(t)?`web`:/search|grep|find|glob|query/.test(t)?`search`:/memory|recall|remember/.test(t)?`memory`:`other`}function Kt(e,t){let n=(Array.isArray(e.fileTargets)?e.fileTargets:[]).flatMap(e=>{let t=zt(e),n=J(t,[`filePath`,`file_path`,`path`]);return n?[{filePath:n,operation:q(t.operation),line:Y(t,[`line`,`startLine`,`start_line`]),endLine:Y(t,[`endLine`,`end_line`])}]:[]});if(n.length>0)return n;let r=J(t,[`file_path`,`filePath`,`path`,`filename`,`target_file`,`targetFile`]);return r?[{filePath:r,line:Y(t,[`line`,`start_line`,`startLine`,`offset`]),endLine:Y(t,[`end_line`,`endLine`])}]:[]}function qt(e,t){let n=e?.line??Y(t,[`line`,`start_line`,`startLine`,`offset`]),r=e?.endLine??Y(t,[`end_line`,`endLine`]),i=Y(t,[`limit`,`line_count`,`lineCount`]);return r===void 0&&n!==void 0&&i!==void 0&&i>0&&(r=n+i-1),n!==void 0&&r!==void 0?{start:n,end:r,label:`L${n}–${r}`}:n===void 0?{}:{start:n,label:`L${n}`}}function Jt(e,t,n,r,i,a){let o=qt(a,n),s=a?.filePath??J(n,[`file_path`,`filePath`,`path`,`filename`]),c=s?Vt(s):void 0;if(e===`read`)return{target:s,summary:i===void 0?o.label?`${o.label} queued to read`:`Reading file`:`${i.toLocaleString()} lines read`,lineLabel:o.label};if(e===`write`){let e=J(n,[`content`,`text`,`data`]),t=Y(r,[`inputLines`])??(e?Ht(e):void 0);return{target:s,summary:t===void 0?`Writing file`:`${t.toLocaleString()} lines written`,lineLabel:o.label}}if(e===`edit`){let e=J(n,[`patch`,`diff`]),t=e?Ut(e):null,i=J(n,[`old_string`,`oldString`,`search`]),a=J(n,[`new_string`,`newString`,`replacement`]),c=Y(r,[`addedLines`]),l=Y(r,[`removedLines`]),u=Y(r,[`oldLines`]),d=Y(r,[`newLines`]);return{target:s,summary:t||c!==void 0||l!==void 0?`+${t?.added??c??0} / −${t?.removed??l??0} lines`:i!==void 0||a!==void 0||u!==void 0||d!==void 0?`${i?Ht(i):u??0} → ${a?Ht(a):d??0} lines`:o.label?`${o.label} updated`:`Updating file`,lineLabel:o.label}}if(e===`terminal`){let e=J(n,[`command`,`cmd`,`script`,`shell`])??t;return{summary:Wt(e),target:e}}if(e===`web`){let e=J(n,[`url`,`href`,`uri`]),t=J(n,[`query`,`q`,`search`]);return{target:e??t,summary:e?`Fetched ${e}`:t?`Looked up “${t}”`:`Went online`}}if(e===`search`){let e=J(n,[`query`,`pattern`,`q`,`search`])??c;return{target:s??e,summary:e?`Searched “${e}”`:`Searching project`}}if(e===`memory`){let e=J(n,[`query`,`text`,`key`]);return{target:e,summary:e?`Recalled “${e}”`:`Checking memory`}}return{target:s,summary:c?`${t} · ${c}`:t}}function Yt(e,t){let n=q(t.name)??q(t.toolName);if(n)return n;if(e.kind===`agent:tool`)return e.target??void 0;if(e.kind.startsWith(`tool:`))return e.source}function Xt(e,t,n){return q(t.agentId)??q(t.subagentId)??(e.kind===`agent:tool`?e.source:void 0)??(e.source!==n&&e.source!==`filesystem`?e.source:void 0)??`leader`}function Zt(e){return q(e.parentSessionId)??q(e.sessionId)}function Qt(e,t){return e.kind===`tool:started`||e.kind===`tool:progress`?`running`:t.ok===!1?`failed`:`succeeded`}function $t(e){if(![`tool:started`,`tool:progress`,`tool:executed`,`agent:tool`].includes(e.kind))return null;let t=zt(e.data),n=Yt(e,t);if(!n)return null;let r=Xt(e,t,n),i=t.input,a=zt(i),o=Kt(t,a),s=Bt(t.outputLines),c=Gt(n),l=Jt(c,n,a,t,s,o[0]),u=q(t.id),d=Math.floor(e.timestamp/2e3),f=Qt(e,t),p=Bt(t.durationMs);return{id:u?`${r}:${u}`:`${r}:${n}:${d}`,agentId:r,agentName:q(t.agentName),sessionId:Zt(t),toolName:n,kind:c,status:f,startedAt:f===`running`?e.timestamp:Math.max(0,e.timestamp-(p??0)),...f===`running`?{}:{completedAt:e.timestamp},durationMs:p,target:l.target,summary:l.summary,lineLabel:l.lineLabel,outputLines:s,outputBytes:Bt(t.outputBytes),outputTokens:Bt(t.outputTokens),input:i,output:q(t.output),fileTargets:o,raw:e.raw??t}}function en(e,t,n){return e?.length?on(e.map(e=>({id:`snapshot:${n??`session`}:${t}:${e.id}`,kind:`tool:executed`,timestamp:e.completedAt,source:t,target:e.name,label:e.name,data:{...e,agentId:t,sessionId:n},flowGroup:`agent:${t}`})),t,n):[]}function tn(e){return e?.length?e.map(e=>({id:e.id,direction:e.direction,from:e.from,to:e.to,type:e.type,subject:e.subject,body:``,priority:`normal`,timestamp:new Date(e.at).toISOString(),timestampMs:e.at,unread:e.direction===`incoming`})).sort((e,t)=>t.timestampMs-e.timestampMs).slice(0,12):[]}function nn(e,t,n=3e4){let r=new Map;e.forEach((e,t)=>{for(let n of[e.agent.serverId,e.agent.mailboxId,e.agent.name]){let e=X(n);e&&!r.has(e)&&r.set(e,t)}});let i=new Set,a=[];for(let o of e){let e=o.mail[0];if(!e||i.has(e.id)||t-e.timestampMs>n)continue;let s=r.get(X(e.from)),c=r.get(X(e.to));s!==void 0&&c!==void 0&&s!==c&&(i.add(e.id),a.push({id:e.id,mail:e,fromIndex:s,toIndex:c}))}return a}function rn(e,t){return e.toLowerCase()===t.toLowerCase()}function X(e){return e?.trim().toLowerCase()??``}function an(e,t,n){let r=new Set([t.serverId,t.mailboxId,t.name].map(X).filter(e=>e.length>0)),i=n?`@session:${X(n)}`:``,a=X(t.role),o=X(t.serverId)===`leader`||X(t.serverId).startsWith(`leader@`)||a===`lead`||a===`leader`;return e.flatMap(e=>{let t=X(e.from),n=X(e.to),a=r.has(t),s=n===`*`||n===`all`||i.length>0&&n===i,c=(e.audience!==`leaders`||o)&&(r.has(n)||o&&s);if(!c&&!a)return[];let l=Date.parse(e.timestamp);return[{...e,direction:c?`incoming`:`outgoing`,timestampMs:Number.isFinite(l)?l:0,unread:c&&!Object.keys(e.readBy??{}).some(e=>r.has(X(e)))}]}).sort((e,t)=>t.timestampMs-e.timestampMs).slice(0,8)}function on(e,t,n){let r=new Map;for(let i=e.length-1;i>=0;--i){let a=e[i];if(!a)continue;let o=$t(a);if(!o||!rn(o.agentId,t)||n&&o.sessionId&&o.sessionId!==n)continue;let s=r.get(o.id);r.set(o.id,s?{...s,...o,startedAt:Math.min(s.startedAt,o.startedAt),fileTargets:o.fileTargets.length>0?o.fileTargets:s.fileTargets,input:o.input??s.input,output:o.output??s.output,raw:o.raw??s.raw}:o)}let i=[...r.values()].sort((e,t)=>(t.completedAt??t.startedAt)-(e.completedAt??e.startedAt));return i.filter((e,t)=>e.input!==void 0||e.fileTargets.length>0||e.output!==void 0||!i.some((n,r)=>r!==t&&n.toolName===e.toolName&&(n.input!==void 0||n.fileTargets.length>0||n.output!==void 0)&&Math.abs((n.completedAt??n.startedAt)-(e.completedAt??e.startedAt))<2500))}function sn(e,t,n){let r=Gt(t),i={read:`Reading a file`,write:`Writing a file`,edit:`Updating code`,terminal:`Running a command`,web:`Working online`,search:`Searching project`,memory:`Checking memory`,other:t};return{id:`${e}:live:${t}`,agentId:e,sessionId:n,toolName:t,kind:r,status:`running`,startedAt:Date.now(),summary:i[r],fileTargets:[]}}var cn={read:b,write:ve,edit:ve,terminal:xe,web:k,search:ke,memory:v,other:be};function ln(e,t=46){if(!e||e.length<=t)return e;let n=e.split(/[\\/]/).slice(-2).join(`/`);return n.length<=t?`…/${n}`:`…${e.slice(-(t-1))}`}function un(e){return e===void 0?`—`:e<1e3?`${Math.round(e)} ms`:`${(e/1e3).toFixed(+(e<1e4))} s`}function dn(e){if(e===void 0)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function Z({label:e,value:t}){return(0,K.jsxs)(`div`,{className:`agent-office__detail-row`,children:[(0,K.jsx)(`span`,{children:e}),(0,K.jsx)(`strong`,{children:t})]})}function fn({selected:e,onClose:t}){let{t:n}=V(),{call:r,agentName:i}=e,a=cn[r.kind],o=dn(r.input),s=dn(r.output);return(0,K.jsxs)(`aside`,{className:`agent-office__detail`,"aria-label":`${r.toolName} details`,children:[(0,K.jsxs)(`div`,{className:`agent-office__detail-header`,children:[(0,K.jsx)(`div`,{className:H(`agent-office__detail-icon`,`is-${r.kind}`),children:(0,K.jsx)(a,{"aria-hidden":`true`})}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{children:n(`activity:agentOffice.toolCall`)}),(0,K.jsx)(`h2`,{children:r.toolName})]}),(0,K.jsx)(`button`,{type:`button`,onClick:t,"aria-label":n(`activity:agentOffice.closeDetails`),children:(0,K.jsx)(j,{})})]}),(0,K.jsxs)(`div`,{className:`agent-office__detail-status`,children:[(0,K.jsx)(`span`,{className:H(`agent-office__status-dot`,r.status===`running`&&`is-active`,r.status===`failed`&&`is-failed`)}),(0,K.jsx)(`strong`,{children:r.summary}),(0,K.jsx)(`span`,{children:r.status})]}),(0,K.jsxs)(`section`,{className:`agent-office__detail-section`,children:[(0,K.jsx)(`h3`,{children:n(`activity:agentOffice.execution`)}),(0,K.jsx)(Z,{label:n(`activity:agentOffice.agent`),value:i}),(0,K.jsx)(Z,{label:n(`activity:agentOffice.started`),value:new Date(r.startedAt).toLocaleTimeString()}),(0,K.jsx)(Z,{label:n(`activity:agentOffice.duration`),value:un(r.durationMs)}),r.sessionId&&(0,K.jsx)(Z,{label:n(`activity:agentOffice.session`),value:ln(r.sessionId,28)})]}),(r.target||r.fileTargets.length>0)&&(0,K.jsxs)(`section`,{className:`agent-office__detail-section`,children:[(0,K.jsx)(`h3`,{children:n(`activity:agentOffice.target`)}),r.target&&(0,K.jsx)(`code`,{className:`agent-office__target-code`,children:r.target}),r.fileTargets.map((e,t)=>(0,K.jsxs)(`div`,{className:`agent-office__file-target`,children:[(0,K.jsx)(g,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:e.filePath}),(e.line||e.endLine)&&(0,K.jsxs)(`strong`,{children:[`L`,e.line??1,e.endLine?`–${e.endLine}`:``]})]},`${e.filePath}:${t}`))]}),(r.outputLines!==void 0||r.outputBytes!==void 0||r.outputTokens!==void 0)&&(0,K.jsxs)(`section`,{className:`agent-office__detail-section`,children:[(0,K.jsx)(`h3`,{children:n(`activity:agentOffice.resultSize`)}),(0,K.jsxs)(`div`,{className:`agent-office__metric-grid`,children:[r.outputLines!==void 0&&(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`strong`,{children:r.outputLines.toLocaleString()}),(0,K.jsx)(`span`,{children:n(`activity:agentOffice.lines`)})]}),r.outputBytes!==void 0&&(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`strong`,{children:r.outputBytes.toLocaleString()}),(0,K.jsx)(`span`,{children:n(`activity:agentOffice.bytes`)})]}),r.outputTokens!==void 0&&(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`strong`,{children:[`≈`,r.outputTokens.toLocaleString()]}),(0,K.jsx)(`span`,{children:n(`activity:agentOffice.tokens`)})]})]})]}),o&&(0,K.jsxs)(`section`,{className:`agent-office__detail-section`,children:[(0,K.jsx)(`h3`,{children:n(`activity:agentOffice.input`)}),(0,K.jsx)(`pre`,{children:(0,K.jsx)(`code`,{children:o})})]}),s&&(0,K.jsxs)(`section`,{className:`agent-office__detail-section`,children:[(0,K.jsx)(`h3`,{children:n(`activity:agentOffice.outputPreview`)}),(0,K.jsx)(`pre`,{children:(0,K.jsx)(`code`,{children:s})})]})]})}function pn({selected:e,onClose:t}){let{t:n}=V(),{mail:r,agentName:i}=e;return(0,K.jsxs)(`aside`,{className:`agent-office__detail`,"aria-label":`${r.subject} details`,children:[(0,K.jsxs)(`div`,{className:`agent-office__detail-header`,children:[(0,K.jsx)(`div`,{className:`agent-office__detail-icon is-mail`,children:(0,K.jsx)(S,{"aria-hidden":`true`})}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{children:r.direction===`incoming`?`INCOMING MAIL`:`OUTGOING MAIL`}),(0,K.jsx)(`h2`,{children:r.subject})]}),(0,K.jsx)(`button`,{type:`button`,onClick:t,"aria-label":n(`activity:agentOffice.closeMailDetails`),children:(0,K.jsx)(j,{})})]}),(0,K.jsxs)(`div`,{className:`agent-office__detail-status`,children:[(0,K.jsx)(`span`,{className:H(`agent-office__status-dot`,r.unread&&`is-active`)}),(0,K.jsxs)(`strong`,{children:[r.from,` → `,r.to]}),(0,K.jsx)(`span`,{children:r.type}),r.audience===`leaders`&&(0,K.jsxs)(`span`,{children:[(0,K.jsx)(_e,{className:`h-3 w-3`}),` `,n(`activity:mailbox.audienceLeaders`)]})]}),(0,K.jsxs)(`section`,{className:`agent-office__detail-section`,children:[(0,K.jsx)(`h3`,{children:n(`activity:mailbox.messages`)}),(0,K.jsx)(Z,{label:n(`activity:agentOffice.agent`),value:i}),(0,K.jsx)(Z,{label:n(`activity:agentOffice.started`),value:new Date(r.timestampMs).toLocaleTimeString()}),(0,K.jsx)(Z,{label:n(`activity:agentOffice.priority`),value:r.priority}),(0,K.jsx)(Z,{label:n(`activity:agentOffice.route`),value:`${r.from} → ${r.to}`})]}),(0,K.jsxs)(`section`,{className:`agent-office__detail-section`,children:[(0,K.jsx)(`h3`,{children:r.subject}),(0,K.jsx)(`div`,{className:`agent-office__mail-body`,children:r.body})]})]})}function mn({selected:e,onClose:t}){let{t:n}=V();return(0,K.jsxs)(`aside`,{className:`agent-office__detail`,"aria-label":`${e.agentName} task details`,children:[(0,K.jsxs)(`div`,{className:`agent-office__detail-header`,children:[(0,K.jsx)(`div`,{className:`agent-office__detail-icon is-task`,children:(0,K.jsx)(P,{"aria-hidden":`true`})}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{children:n(`activity:agentOffice.currentTask`)}),(0,K.jsx)(`h2`,{children:e.agentName})]}),(0,K.jsx)(`button`,{type:`button`,onClick:t,"aria-label":n(`activity:agentOffice.closeTaskDetails`),children:(0,K.jsx)(j,{})})]}),(0,K.jsxs)(`section`,{className:`agent-office__detail-section`,children:[(0,K.jsx)(`h3`,{children:n(`activity:agentOffice.task`)}),e.taskId&&(0,K.jsx)(Z,{label:`ID`,value:e.taskId}),(0,K.jsx)(`div`,{className:`agent-office__task-body`,children:e.task})]})]})}function hn({selected:e,onClose:t}){let{t:n}=V(),r=e.todos.filter(e=>e.status!==`completed`).length;return(0,K.jsxs)(`aside`,{className:`agent-office__detail`,"aria-label":`${e.officeLabel} briefing`,children:[(0,K.jsxs)(`div`,{className:`agent-office__detail-header`,children:[(0,K.jsx)(`div`,{className:`agent-office__detail-icon is-briefing`,children:(0,K.jsx)(Me,{"aria-hidden":`true`})}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{children:e.instructionActive?n(`activity:agentOffice.activeInstruction`):n(`activity:agentOffice.officeBriefing`)}),(0,K.jsx)(`h2`,{children:e.officeLabel})]}),(0,K.jsx)(`button`,{type:`button`,onClick:t,"aria-label":n(`activity:agentOffice.closeOfficeBriefing`),children:(0,K.jsx)(j,{})})]}),(0,K.jsxs)(`div`,{className:`agent-office__detail-status`,children:[(0,K.jsx)(`span`,{className:H(`agent-office__status-dot`,(e.instructionActive||r>0)&&`is-active`)}),(0,K.jsx)(`strong`,{children:e.telemetryConnected?n(`activity:agentOffice.activeTodos`):n(`activity:agentOffice.telemetryWaiting`)}),(0,K.jsx)(`span`,{children:e.telemetryConnected?r:`—`})]}),(0,K.jsxs)(`section`,{className:`agent-office__detail-section`,children:[(0,K.jsx)(`h3`,{children:e.instructionActive?n(`activity:agentOffice.activeInstruction`):n(`activity:agentOffice.leaderPrompt`)}),e.promptAt!==void 0&&(0,K.jsx)(Z,{label:n(`activity:agentOffice.promptReceived`),value:new Date(e.promptAt).toLocaleString()}),(0,K.jsx)(`div`,{className:`agent-office__task-body`,children:e.prompt??(e.telemetryConnected?n(`activity:agentOffice.noPrompt`):n(`activity:agentOffice.telemetryWaiting`))})]}),(0,K.jsxs)(`section`,{className:`agent-office__detail-section`,children:[(0,K.jsx)(`h3`,{children:n(`activity:agentOffice.todos`)}),(0,K.jsx)(`div`,{className:`agent-office__todo-detail-list`,children:e.telemetryConnected?e.todos.length>0?e.todos.map(e=>(0,K.jsxs)(`div`,{className:H(`agent-office__todo-detail`,`is-${e.status}`),children:[(0,K.jsx)(`span`,{"aria-hidden":`true`}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`strong`,{children:e.content}),(0,K.jsx)(`small`,{children:n(`activity:agentOffice.todoStatus.${e.status}`)})]})]},e.id)):(0,K.jsx)(`span`,{className:`agent-office__history-empty`,children:n(`activity:agentOffice.noActiveTodos`)}):(0,K.jsx)(`span`,{className:`agent-office__history-empty`,children:n(`activity:agentOffice.todoTelemetryWaiting`)})})]})]})}function gn({selected:e,onClose:t}){return e.kind===`tool`?(0,K.jsx)(fn,{selected:e,onClose:t}):e.kind===`mail`?(0,K.jsx)(pn,{selected:e,onClose:t}):e.kind===`task`?(0,K.jsx)(mn,{selected:e,onClose:t}):(0,K.jsx)(hn,{selected:e,onClose:t})}var _n=[`bot`,`cactus`,`duck`,`radio`],vn={leader:`plum`,builder:`ocean`,researcher:`mint`,reviewer:`rose`,planner:`amber`,operator:`graphite`},yn={leader:0,builder:1,researcher:2,reviewer:3,planner:4,operator:5},bn={read:b,write:ve,edit:ve,terminal:xe,web:k,search:ke,memory:v,other:be},xn={leader:Pe,builder:be,researcher:b,reviewer:N,planner:P,operator:xe};function Sn(e){if(e.serverId===`leader`||e.serverId.startsWith(`leader@`))return`leader`;let t=[e.role,e.name,e.currentTask].filter(Boolean).join(` `).toLowerCase();return/review|critic|audit|security|test|qa|verify|checker/.test(t)?`reviewer`:/research|analyst|explor|investig|search|hunter|recon/.test(t)?`researcher`:/plan|architect|design|coordinat|strateg|spec/.test(t)?`planner`:/build|implement|code|develop|engineer|refactor|fix|frontend|backend/.test(t)?`builder`:`operator`}function Cn(e,t){let n=2166136261;for(let t=0;t<e.length;t+=1)n^=e.charCodeAt(t),n=Math.imul(n,16777619);let r=n>>>0;return{palette:vn[t],layout:r%4,clutter:Math.floor(r/4)%3,avatar:yn[t],motion:Math.floor(r/31)%4,charm:_n[Math.floor(r/47)%_n.length]}}function wn(e,t=22){let n=e.split(`/`).filter(Boolean).pop()??e;return n.length>t?`${n.slice(0,t-1)}…`:n}function Tn(e,t=46){if(!e||e.length<=t)return e;let n=e.split(/[\\/]/).slice(-2).join(`/`);return n.length<=t?`…/${n}`:`…${e.slice(-(t-1))}`}function En(e,t,n=12e4){let{agent:r,client:i,current:a,history:o,mail:s}=e,c=r.status===`active`||r.status===`streaming`,l=a?.startedAt??o[0]?.completedAt??o[0]?.startedAt,u=[l,s[0]?.timestampMs].filter(e=>e!==void 0),d=Date.parse(i.startedAt??``),f=Number.isFinite(d)?d:0,p=u.length>0?Math.max(...u,f):f>0?f:void 0,m=p===void 0?1/0:Math.max(0,t-p);if(!c||a!==void 0||m<n)return{waiting:!1,idleMs:m,reason:`no-work`,anchor:``,anchorId:void 0,anchorAt:p};if(i.todos===void 0&&r.toolCalls===0)return{waiting:!0,idleMs:m,reason:`telemetry`,anchor:r.currentTask??``,anchorId:void 0,anchorAt:p};let h=s[0],g=h!==void 0&&h.direction===`outgoing`&&(l===void 0||h.timestampMs>l)?h:void 0;return g===void 0?{waiting:!0,idleMs:m,reason:`no-work`,anchor:r.currentTask||o[0]?.summary||``,anchorId:void 0,anchorAt:p}:{waiting:!0,idleMs:m,reason:`mail-reply`,anchor:g.subject,anchorId:g.id,anchorAt:p}}function Dn(e,t){let n=Math.max(0,Math.floor((t-e)/1e3));if(n<5)return`now`;if(n<60)return`${n}s`;let r=Math.floor(n/60);return r<60?`${r}m`:`${Math.floor(r/60)}h`}function On(e,t){if(!e)return`—`;let n=Date.parse(e);if(!Number.isFinite(n))return`—`;let r=Math.max(0,Math.floor((t-n)/1e3));return r<60?`${r}s`:r<3600?`${Math.floor(r/60)}m`:r<86400?`${Math.floor(r/3600)}h`:`${Math.floor(r/86400)}d`}function kn(e){let t=new Set,n=new Set,r=new Set,i=0,a=0,o={files:0,reads:0,writes:0,edits:0,linesAdded:0,linesRemoved:0,terminalCalls:0,incomingMail:0,outgoingMail:0};for(let s of e){let e=s.agent.activity;for(let n of e?.filesTouched??[])t.add(n);o.reads+=e?.reads??0,o.writes+=e?.writes??0,o.edits+=e?.edits??0,o.linesAdded+=e?.linesAdded??0,o.linesRemoved+=e?.linesRemoved??0,o.terminalCalls+=e?.terminalCalls??0,i+=e?.mailReceived??0,a+=e?.mailSent??0;for(let e of s.mail)(e.direction===`incoming`?n:r).add(e.id)}return o.files=t.size,o.incomingMail=Math.max(i,n.size),o.outgoingMail=Math.max(a,r.size),o}function An(e,t,n){return n.map((n,r)=>({...sn(e.serverId,n.name,t.sessionId),id:`${e.serverId}:log:${n.at}:${r}`,kind:Gt(n.name),status:n.ok?`succeeded`:`failed`,startedAt:Math.max(0,n.at-n.durationMs),completedAt:n.at,durationMs:n.durationMs,summary:n.ok?`${n.name} completed`:`${n.name} failed`}))}function jn(...e){let t=[];for(let n of e.flat()){let e=n.completedAt??n.startedAt;t.some(t=>(t.id===n.id||t.toolName===n.toolName)&&Math.abs((t.completedAt??t.startedAt)-e)<2500)||t.push(n)}return t.sort((e,t)=>(t.completedAt??t.startedAt)-(e.completedAt??e.startedAt))}function Mn(...e){let t=new Map;for(let n of e.flat())t.set(n.id,n);return[...t.values()].sort((e,t)=>t.timestampMs-e.timestampMs).slice(0,12)}function Nn({kind:e,active:t}){let n=bn[e];return(0,K.jsxs)(`span`,{className:H(`agent-office__tool-glyph`,`is-${e}`,t&&`is-active`),children:[e===`read`&&(0,K.jsx)(g,{className:`agent-office__file-underlay`,"aria-hidden":`true`}),(0,K.jsx)(n,{"aria-hidden":`true`})]})}function Pn({active:e,failed:t,role:n,variant:r,motion:i}){let a=xn[n];return(0,K.jsxs)(`div`,{className:H(`agent-office__avatar`,`is-${n}`,`is-avatar-${r}`,`is-motion-${i}`,e&&`is-active`,!e&&!t&&`is-idle`,t&&`is-failed`),"aria-hidden":`true`,children:[(0,K.jsx)(`span`,{className:`agent-office__avatar-chair`}),(0,K.jsx)(`span`,{className:`agent-office__avatar-body`}),(0,K.jsxs)(`span`,{className:`agent-office__avatar-head`,children:[(0,K.jsx)(`span`,{className:`agent-office__avatar-hair`}),(0,K.jsx)(`span`,{className:`agent-office__avatar-face`}),(0,K.jsx)(`span`,{className:`agent-office__avatar-mouth`}),(0,K.jsx)(`span`,{className:`agent-office__avatar-headset`})]}),(0,K.jsx)(`span`,{className:`agent-office__avatar-arm`}),(0,K.jsx)(`span`,{className:`agent-office__avatar-prop`}),(0,K.jsx)(`span`,{className:`agent-office__avatar-role-badge`,children:(0,K.jsx)(a,{})})]})}function Fn({call:e,compact:t=!1,onSelect:n}){let r=e.status===`running`;return(0,K.jsxs)(`button`,{type:`button`,className:H(`agent-office__parcel`,`is-${e.kind}`,t&&`is-compact`,r&&`is-running`,e.status===`failed`&&`is-failed`),onClick:n,"aria-label":`${e.toolName}: ${e.summary}`,children:[(0,K.jsx)(Nn,{kind:e.kind,active:r}),(0,K.jsxs)(`span`,{className:`agent-office__parcel-copy`,children:[(0,K.jsxs)(`span`,{className:`agent-office__parcel-topline`,children:[(0,K.jsx)(`strong`,{children:e.toolName}),e.lineLabel&&(0,K.jsx)(`span`,{className:`agent-office__line-chip`,children:e.lineLabel})]}),!t&&e.target&&(0,K.jsx)(`span`,{className:`agent-office__parcel-target`,children:Tn(e.target)}),(0,K.jsx)(`span`,{className:`agent-office__parcel-summary`,children:e.summary})]}),(0,K.jsx)(`span`,{className:`agent-office__parcel-state`,"aria-hidden":`true`,children:r?(0,K.jsx)(`span`,{className:`agent-office__pulse-dot`}):e.status===`failed`?(0,K.jsx)(j,{}):(0,K.jsx)(N,{})})]})}function In({mail:e,compact:t=!1,onSelect:n}){let r=e.direction===`incoming`;return(0,K.jsxs)(`button`,{type:`button`,className:H(`agent-office__mail-parcel`,t&&`is-compact`,r?`is-incoming`:`is-outgoing`,e.unread&&`is-unread`),onClick:n,"aria-label":`${r?`Incoming`:`Outgoing`} mail: ${e.subject}`,children:[(0,K.jsx)(`span`,{className:`agent-office__mail-icon`,children:r?(0,K.jsx)(I,{"aria-hidden":`true`}):(0,K.jsx)(x,{"aria-hidden":`true`})}),(0,K.jsxs)(`span`,{className:`agent-office__parcel-copy`,children:[(0,K.jsx)(`strong`,{children:r?`${e.from} →`:`→ ${e.to}`}),(0,K.jsx)(`span`,{className:`agent-office__parcel-summary`,children:e.subject})]}),(0,K.jsx)(S,{"aria-hidden":`true`})]})}function Ln({active:e}){let{t}=V();return(0,K.jsxs)(`div`,{className:`agent-office__parcel agent-office__parcel--empty`,children:[(0,K.jsx)(`span`,{className:`agent-office__tool-glyph`,children:(0,K.jsx)(be,{"aria-hidden":`true`})}),(0,K.jsxs)(`span`,{className:`agent-office__parcel-copy`,children:[(0,K.jsx)(`strong`,{children:t(e?`activity:agentOffice.thinking`:`activity:agentOffice.waiting`)}),(0,K.jsx)(`span`,{children:t(e?`activity:agentOffice.preparing`:`activity:agentOffice.deskReady`)})]})]})}function Rn({model:e,now:t,onSelect:n,routedMailIds:r}){let{t:i}=V(),a=U(e=>e.waitThresholdMs),{agent:s,client:c,current:l,display:u,history:d,mail:p}=e,m=s.status===`active`||s.status===`streaming`,h=s.status===`error`,g=p[0],_=Sn(s),v=Cn(`${c.sessionId}:${s.serverId}:${s.name}`,_),y=En(e,t,a),b=y.reason===`mail-reply`?p.some(e=>e.id===y.anchorId):!!s.currentTask,x=Number.isFinite(y.idleMs)?Dn(t-y.idleMs,t):`—`,C=y.waiting?y.reason===`mail-reply`?i(`activity:agentOffice.waitingForReply`,{subject:y.anchor||i(`activity:agentOffice.waitingMailFallback`),duration:x}):y.reason===`telemetry`?i(`activity:agentOffice.waitingTelemetry`):i(`activity:agentOffice.waitingNoWork`,{duration:x,last:y.anchor||i(`activity:agentOffice.waitingNothingYet`)}):void 0,w=g&&t-g.timestampMs<3e4&&!r?.has(g.id)&&y.anchorId!==g.id,T=d.slice(0,6),E=T[0]?.completedAt??T[0]?.startedAt??u?.completedAt??u?.startedAt,D=l?`is-tool-${l.kind}`:void 0,O=l?l.summary:u?u.summary:y.waiting?C??i(`activity:agentOffice.waiting`):i(m?`activity:agentOffice.preparing`:`activity:agentOffice.waiting`);return(0,K.jsxs)(`article`,{className:H(`agent-office__lane`,`is-desk-${v.palette}`,`is-layout-${v.layout}`,`is-clutter-${v.clutter}`,m&&`is-active`,h&&`is-failed`,y.waiting&&`is-waiting`),children:[(0,K.jsxs)(`div`,{className:`agent-office__identity`,children:[(0,K.jsxs)(`div`,{className:`agent-office__identity-line`,children:[(0,K.jsx)(`span`,{className:H(`agent-office__status-dot`,m&&`is-active`,h&&`is-failed`)}),(0,K.jsx)(`strong`,{title:s.name,children:s.name}),(0,K.jsxs)(`span`,{className:`agent-office__agent-verified`,title:s.presenceSource===`registry`?`Verified by live session registry`:`Verified by local fleet state`,children:[(0,K.jsx)(N,{"aria-hidden":`true`}),s.presenceSource===`registry`?`LIVE`:`LOCAL`]})]}),y.waiting&&b&&(0,K.jsxs)(`button`,{type:`button`,className:H(`agent-office__wait-badge`,`is-${y.reason}`),title:C,"aria-label":C,onClick:()=>{if(y.reason===`mail-reply`){let e=p.find(e=>e.id===y.anchorId);e&&n({kind:`mail`,mail:e,agentName:s.name});return}s.currentTask&&n({kind:`task`,task:s.currentTask,taskId:s.taskId,agentName:s.name})},children:[(0,K.jsx)(R,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:x})]}),y.waiting&&!b&&(0,K.jsxs)(`span`,{role:`status`,className:H(`agent-office__wait-badge`,`is-${y.reason}`),title:C,"aria-label":C,children:[(0,K.jsx)(R,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:x})]}),(0,K.jsx)(`span`,{className:`agent-office__role`,children:s.role??(s.serverId===`leader`||s.serverId.startsWith(`leader@`)?i(`activity:agentOffice.leadAgent`):i(`activity:agentOffice.agent`))}),(0,K.jsxs)(`div`,{className:`agent-office__agent-meta`,children:[(0,K.jsx)(`span`,{children:c.branch?`⎇ ${c.branch}`:c.type.toUpperCase()}),(0,K.jsx)(`span`,{children:i(`activity:agentOffice.callsCount`,{count:s.toolCalls})}),s.model&&(0,K.jsx)(`span`,{className:`agent-office__model-chip`,title:s.model,children:wn(s.model)})]}),s.currentTask&&(0,K.jsxs)(`button`,{type:`button`,className:`agent-office__agent-task`,onClick:()=>n({kind:`task`,task:s.currentTask??``,taskId:s.taskId,agentName:s.name}),children:[(0,K.jsx)(P,{"aria-hidden":`true`}),(0,K.jsxs)(`span`,{children:[(0,K.jsx)(`strong`,{children:i(`activity:agentOffice.currentTask`)}),(0,K.jsx)(`small`,{children:s.currentTask})]})]}),!s.currentTask&&m&&(0,K.jsxs)(`div`,{className:`agent-office__agent-task is-missing`,children:[(0,K.jsx)(z,{"aria-hidden":`true`}),(0,K.jsxs)(`span`,{children:[(0,K.jsx)(`strong`,{children:i(`activity:agentOffice.currentTask`)}),(0,K.jsx)(`small`,{children:c.todos===void 0?i(`activity:agentOffice.telemetryWaiting`):i(`activity:agentOffice.taskNotReported`)})]})]}),g&&(0,K.jsxs)(`button`,{type:`button`,className:H(`agent-office__identity-mail`,g.unread&&`is-unread`),onClick:()=>n({kind:`mail`,mail:g,agentName:s.name}),"aria-label":`${p.length} mail messages. Latest: ${g.subject}`,children:[(0,K.jsx)(S,{"aria-hidden":`true`}),(0,K.jsxs)(`span`,{children:[(0,K.jsxs)(`strong`,{children:[p.length,` MAIL`]}),(0,K.jsx)(`small`,{children:g.subject})]})]})]}),(0,K.jsxs)(`div`,{className:H(`agent-office__scene`,D),children:[(0,K.jsxs)(`div`,{className:`agent-office__window`,"aria-hidden":`true`,children:[(0,K.jsx)(`span`,{}),(0,K.jsx)(`span`,{}),(0,K.jsx)(`span`,{})]}),(0,K.jsxs)(`div`,{className:`agent-office__plant`,"aria-hidden":`true`,children:[(0,K.jsx)(`span`,{}),(0,K.jsx)(`i`,{}),(0,K.jsx)(`b`,{})]}),(0,K.jsxs)(`div`,{className:`agent-office__desk-zone`,"aria-hidden":`true`,children:[(0,K.jsx)(Pn,{active:m,failed:h,role:_,variant:v.avatar,motion:v.motion}),(0,K.jsx)(`span`,{className:`agent-office__monitor`,children:u?(0,K.jsx)(Nn,{kind:u.kind,active:l!==void 0}):(0,K.jsx)(be,{})}),(0,K.jsxs)(`span`,{className:`agent-office__activity-fx`,children:[(0,K.jsx)(`span`,{}),(0,K.jsx)(`i`,{}),(0,K.jsx)(`b`,{})]}),(0,K.jsx)(`span`,{className:`agent-office__desk`}),(0,K.jsx)(`span`,{className:`agent-office__desk-lamp`}),(0,K.jsxs)(`span`,{className:`agent-office__desk-clutter`,children:[(0,K.jsx)(`i`,{}),(0,K.jsx)(`b`,{})]}),(0,K.jsxs)(`span`,{className:H(`agent-office__desk-charm`,`is-${v.charm}`),children:[(0,K.jsx)(`i`,{}),(0,K.jsx)(`b`,{})]}),(0,K.jsxs)(`span`,{className:H(`agent-office__mug`,`is-${_}`),children:[(0,K.jsx)(`i`,{"aria-hidden":`true`}),(0,K.jsx)(`b`,{"aria-hidden":`true`})]})]}),w&&(0,K.jsx)(`div`,{className:H(`agent-office__mail-flyby`,`is-${g.direction}`),children:(0,K.jsx)(In,{mail:g,compact:!0,onSelect:()=>n({kind:`mail`,mail:g,agentName:s.name})},g.id)}),(0,K.jsxs)(`div`,{className:H(`agent-office__conveyor`,l&&`is-moving`),children:[(0,K.jsxs)(`div`,{className:`agent-office__belt`,"aria-hidden":`true`,children:[(0,K.jsx)(`span`,{}),(0,K.jsx)(`span`,{}),(0,K.jsx)(`span`,{}),(0,K.jsx)(`span`,{}),(0,K.jsx)(`span`,{}),(0,K.jsx)(`span`,{})]}),(0,K.jsx)(`div`,{className:`agent-office__current-action`,children:u?(0,K.jsx)(Fn,{call:u,onSelect:()=>n({kind:`tool`,call:u,agentName:s.name})},u.id):(0,K.jsx)(Ln,{active:m})})]})]}),(0,K.jsxs)(`div`,{className:`agent-office__history`,children:[(0,K.jsxs)(`div`,{className:`agent-office__history-heading`,children:[(0,K.jsx)(`span`,{children:i(`activity:agentOffice.recent`)}),E!==void 0&&(0,K.jsx)(`span`,{children:Dn(E,t)})]}),(0,K.jsx)(`div`,{className:`agent-office__history-list`,children:T.length>0?T.map(e=>(0,K.jsx)(Fn,{call:e,compact:!0,onSelect:()=>n({kind:`tool`,call:e,agentName:s.name})},`tool:${e.id}`)):(0,K.jsx)(`span`,{className:`agent-office__history-empty`,children:s.toolCalls>0&&s.recentTools===void 0&&s.activity===void 0?i(`activity:agentOffice.telemetryReconnect`):i(`activity:agentOffice.noCalls`)})})]}),(0,K.jsxs)(`div`,{className:`agent-office__desk-metrics`,children:[(0,K.jsxs)(`span`,{className:`agent-office__metric`,title:`${i(`activity:agentOffice.tokens`)}: in ${o(s.tokensIn)} / out ${o(s.tokensOut)}`,children:[(0,K.jsx)(`strong`,{children:o(s.tokensIn+s.tokensOut)}),(0,K.jsx)(`small`,{children:`TOK`})]}),(0,K.jsxs)(`span`,{className:`agent-office__metric`,title:i(`activity:agentOffice.cost`),children:[(0,K.jsx)(`strong`,{children:f(s.costUsd)}),(0,K.jsx)(`small`,{children:`COST`})]}),(0,K.jsxs)(`span`,{className:`agent-office__metric`,title:i(`activity:agentOffice.contextUsed`),children:[(0,K.jsx)(`strong`,{children:s.ctxPct===void 0?`—`:`${Math.round(s.ctxPct)}%`}),(0,K.jsx)(`small`,{children:`CTX`}),s.ctxPct!==void 0&&(0,K.jsx)(`i`,{className:H(`agent-office__ctx-bar`,s.ctxPct>=80&&`is-high`),children:(0,K.jsx)(`b`,{style:{width:`${Math.min(100,Math.max(0,s.ctxPct))}%`}})})]}),(0,K.jsxs)(`span`,{className:`agent-office__metric agent-office__metric-action`,title:O,children:[(0,K.jsx)(z,{"aria-hidden":`true`}),(0,K.jsx)(`small`,{children:O})]})]})]})}function zn(e){return e.agent.status===`active`||e.agent.status===`streaming`||e.agent.status===`error`}function Bn({agents:e,now:t,onSelect:n}){let{t:r}=V();return(0,K.jsxs)(`section`,{className:`agent-office__lounge`,"aria-label":r(`activity:agentOffice.breakRoom`),children:[(0,K.jsxs)(`header`,{className:`agent-office__lounge-heading`,children:[(0,K.jsx)(we,{"aria-hidden":`true`}),(0,K.jsx)(`strong`,{children:r(`activity:agentOffice.breakRoom`)}),(0,K.jsx)(`span`,{children:r(`activity:agentOffice.onBreak`,{count:e.length})})]}),(0,K.jsx)(`div`,{className:`agent-office__lounge-seats`,children:e.map(e=>{let{agent:i,history:a,mail:o}=e,s=Sn(i),c=xn[s],l=o.filter(e=>e.unread).length,u=a[0]?.completedAt??a[0]?.startedAt,d=o[0],f=()=>{i.currentTask?n({kind:`task`,task:i.currentTask,taskId:i.taskId,agentName:i.name}):d&&n({kind:`mail`,mail:d,agentName:i.name})},p=!!i.currentTask||!!d;return(0,K.jsxs)(`button`,{type:`button`,className:H(`agent-office__lounge-seat`,`is-${s}`),onClick:f,disabled:!p,children:[(0,K.jsx)(`span`,{className:`agent-office__lounge-avatar`,children:(0,K.jsx)(c,{"aria-hidden":`true`})}),(0,K.jsxs)(`span`,{className:`agent-office__lounge-copy`,children:[(0,K.jsx)(`strong`,{children:i.name}),(0,K.jsx)(`small`,{children:i.role??r(`activity:agentOffice.agent`)})]}),(0,K.jsxs)(`span`,{className:`agent-office__lounge-meta`,children:[u!==void 0&&(0,K.jsx)(`span`,{children:Dn(u,t)}),l>0&&(0,K.jsxs)(`span`,{className:`agent-office__lounge-mail`,children:[(0,K.jsx)(S,{"aria-hidden":`true`}),` `,l]})]})]},e.key)})})]})}function Vn({office:e,now:t}){let{t:n}=V(),{client:r,agents:i,stats:a}=e,o=r.lastHeartbeatAt?Date.parse(r.lastHeartbeatAt):NaN,s=Number.isFinite(o)&&t-o<2e4,c=Number.isFinite(o)&&!s,l=i.some(({agent:e})=>e.presenceSource===`registry`),u=s?`VERIFIED`:c?`DELAYED`:l?`REGISTRY`:`LOCAL`,d=i.some(({agent:e})=>e.recentTools!==void 0||e.activity!==void 0),f=i.some(({agent:e})=>e.toolCalls>0&&e.recentTools===void 0&&e.activity===void 0);return(0,K.jsxs)(`header`,{className:`agent-office__client-header`,children:[(0,K.jsxs)(`div`,{className:`agent-office__client-title`,children:[(0,K.jsx)(`span`,{className:`agent-office__client-icon`,children:(0,K.jsx)(Pe,{"aria-hidden":`true`})}),(0,K.jsxs)(`div`,{className:`agent-office__client-copy`,children:[(0,K.jsx)(`strong`,{children:r.label}),(0,K.jsx)(`span`,{children:r.sublabel||r.sessionId})]}),(0,K.jsxs)(`div`,{className:`agent-office__client-presence`,children:[(0,K.jsxs)(`span`,{className:`agent-office__client-agent-count`,children:[i.length,` `,n(`activity:agentOffice.agents`)]}),(0,K.jsxs)(`span`,{className:H(`agent-office__presence-chip`,!c&&`is-live`,c&&`is-legacy`),children:[(0,K.jsx)(F,{"aria-hidden":`true`}),` `,u]}),(0,K.jsxs)(`span`,{className:`agent-office__presence-chip`,children:[(0,K.jsx)(R,{"aria-hidden":`true`}),` `,On(r.startedAt,t),` UP`]}),(0,K.jsxs)(`span`,{className:H(`agent-office__presence-chip`,f?`is-legacy`:d&&`is-telemetry`),children:[(0,K.jsx)(z,{"aria-hidden":`true`}),f?`RECONNECT`:d?`TOOLS LIVE`:`READY`]})]})]}),(0,K.jsxs)(`fieldset`,{className:`agent-office__client-stats`,"aria-label":n(`activity:agentOffice.sessionActivityTotals`),children:[(0,K.jsxs)(`span`,{title:n(`activity:agentOffice.uniqueFilesTouched`),children:[(0,K.jsx)(L,{}),` `,(0,K.jsx)(`strong`,{children:a.files}),` `,n(`activity:agentOffice.files`)]}),(0,K.jsxs)(`span`,{title:n(`activity:agentOffice.fileReads`),children:[(0,K.jsx)(b,{}),` `,(0,K.jsx)(`strong`,{children:a.reads}),` `,n(`activity:agentOffice.read`)]}),(0,K.jsxs)(`span`,{title:n(`activity:agentOffice.filesWritten`),children:[(0,K.jsx)(ve,{}),` `,(0,K.jsx)(`strong`,{children:a.writes}),` `,n(`activity:agentOffice.write`)]}),(0,K.jsxs)(`span`,{title:n(`activity:agentOffice.filesEdited`),children:[(0,K.jsx)(ve,{}),` `,(0,K.jsx)(`strong`,{children:a.edits}),` `,n(`activity:agentOffice.edit`)]}),(0,K.jsxs)(`span`,{className:`agent-office__client-delta`,title:n(`activity:agentOffice.linesAddedAndRemoved`),children:[(0,K.jsxs)(`strong`,{children:[`+`,a.linesAdded]}),` / `,(0,K.jsxs)(`b`,{children:[`−`,a.linesRemoved]})]}),(0,K.jsxs)(`span`,{title:n(`activity:agentOffice.terminalCommands`),children:[(0,K.jsx)(xe,{}),` `,(0,K.jsx)(`strong`,{children:a.terminalCalls}),` `,n(`activity:agentOffice.term`)]}),(0,K.jsxs)(`span`,{title:n(`activity:agentOffice.incomingAndOutgoingMail`),children:[(0,K.jsx)(S,{}),` `,(0,K.jsx)(`strong`,{children:a.incomingMail}),`↓ `,(0,K.jsx)(`strong`,{children:a.outgoingMail}),`↑`]})]})]})}function Hn({office:e,now:t,onSelect:n}){let{t:r}=V(),{client:i}=e,a=i.todos!==void 0,o=i.todos??[],s=o.filter(e=>e.status!==`completed`),c=o.length-s.length,l=!!i.activeInstruction,u=i.activeInstruction??i.latestPrompt,d=i.latestPromptAt!==void 0&&t-i.latestPromptAt<3e4,f=()=>n({kind:`briefing`,officeLabel:i.label,prompt:u,promptAt:i.latestPromptAt,instructionActive:l,telemetryConnected:a,todos:o});return(0,K.jsxs)(`section`,{className:`agent-office__briefing`,"aria-label":r(`activity:agentOffice.officeBriefing`),children:[(0,K.jsxs)(`button`,{type:`button`,className:H(`agent-office__prompt-card`,l&&`is-active`,d&&`is-fresh`,!a&&`is-waiting`),onClick:f,children:[(0,K.jsx)(`span`,{className:`agent-office__briefing-icon is-prompt`,children:(0,K.jsx)(Me,{"aria-hidden":`true`})}),(0,K.jsxs)(`span`,{className:`agent-office__briefing-copy`,children:[(0,K.jsx)(`span`,{children:r(l?`activity:agentOffice.activeInstruction`:`activity:agentOffice.leaderPrompt`)}),(0,K.jsx)(`strong`,{children:u??r(a?`activity:agentOffice.noPrompt`:`activity:agentOffice.telemetryWaiting`)})]}),l&&(0,K.jsxs)(`span`,{className:`agent-office__instruction-live`,children:[(0,K.jsx)(`i`,{"aria-hidden":`true`}),` `,r(`activity:agentOffice.live`)]}),i.latestPromptAt!==void 0&&(0,K.jsx)(`time`,{dateTime:new Date(i.latestPromptAt).toISOString(),children:Dn(i.latestPromptAt,t)})]}),(0,K.jsxs)(`button`,{type:`button`,className:H(`agent-office__todo-board`,s.length>0&&`has-active`,!a&&`is-waiting`),onClick:f,children:[(0,K.jsxs)(`span`,{className:`agent-office__todo-heading`,children:[(0,K.jsxs)(`span`,{children:[(0,K.jsx)(P,{"aria-hidden":`true`}),` `,r(`activity:agentOffice.activeTodos`)]}),(0,K.jsx)(`strong`,{children:a?r(`activity:agentOffice.todoProgress`,{done:c,total:o.length}):r(`activity:agentOffice.syncWaiting`)})]}),(0,K.jsxs)(`span`,{className:`agent-office__todo-preview`,children:[a?s.length>0?s.slice(0,3).map(e=>(0,K.jsxs)(`span`,{className:H(`agent-office__todo-line`,`is-${e.status}`),children:[(0,K.jsx)(`i`,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:e.activeForm||e.content})]},e.id)):(0,K.jsxs)(`span`,{className:`agent-office__todo-empty`,children:[(0,K.jsx)(re,{"aria-hidden":`true`}),o.length>0?r(`activity:agentOffice.allTodosDone`):r(`activity:agentOffice.noActiveTodos`)]}):(0,K.jsxs)(`span`,{className:`agent-office__todo-empty is-waiting`,children:[(0,K.jsx)(z,{"aria-hidden":`true`}),r(`activity:agentOffice.todoTelemetryWaiting`)]}),s.length>3&&(0,K.jsx)(`span`,{className:`agent-office__todo-more`,children:r(`activity:agentOffice.moreTodos`,{count:s.length-3})})]})]})]})}function Un(e){return e==null||!Number.isFinite(e)?`0`:e<1e3?String(Math.round(e)):e<1e6?`${(e/1e3).toFixed(1)}k`:`${(e/1e6).toFixed(1)}M`}function Wn(e,t){if(!e)return`never`;let n=Date.parse(e);if(!Number.isFinite(n))return`never`;let r=Math.max(0,Math.round((t-n)/1e3));return r<60?`${r}s ago`:r<3600?`${Math.round(r/60)}m ago`:r<86400?`${Math.round(r/3600)}h ago`:`${Math.round(r/86400)}d ago`}function Gn(e,t){if(!e)return``;let n=Date.parse(e);if(!Number.isFinite(n))return``;let r=Math.max(0,Math.round((t-n)/1e3));return r<60?`${r}s`:r<3600?`${Math.round(r/60)}m`:`${Math.round(r/3600)}h`}function Kn(e){if(!e)return;let t=e.split(`/`);return t[t.length-1]?.slice(0,18)}function qn(e,t=56){if(!e)return;let n=e.replace(/\s+/g,` `).trim();if(n)return n.length<=t?n:t<=1?`…`:`${n.slice(0,t-1).trimEnd()}…`}var Jn=370,Yn=640,Xn=380,Zn=190,Qn=150,$n=100;function er(e,t){if(e.length===0)return{positions:new Map,columns:0,rows:0,columnWidth:Xn};let n=Math.max(1,...e.map(e=>e.agentCount)),r=Math.max(Xn,Math.min(3,n)*Zn+80),i=e=>270+Math.max(1,...e.map(e=>Math.ceil(Math.max(1,e.agentCount)/3)))*Qn,a=Math.max(320,t.width),o=Math.max(240,t.height),s=1,c=-1/0,l=1/0;for(let t=1;t<=e.length;t+=1){let n=[];for(let r=0;r<e.length;r+=t)n.push(i(e.slice(r,r+t)));let u=n.length,d=Math.max(660,Math.min(t,e.length)*r),f=320+n.reduce((e,t)=>e+t,0)+Math.max(0,u-1)*$n,p=Math.min(a/d,o/f),m=Math.abs(Math.log(d/f/(a/o)));(p>c+1e-9||Math.abs(p-c)<=1e-9&&m<l)&&(s=t,c=p,l=m)}let u=new Map,d=Jn;for(let t=0;t<e.length;t+=s){let n=e.slice(t,t+s);n.forEach((e,t)=>{u.set(e.id,{x:600+(t-(n.length-1)/2)*r,y:d})}),d+=i(n)+$n}return{positions:u,columns:s,rows:Math.ceil(e.length/s),columnWidth:r}}function tr(e,t,n,r=Yn){let i=Math.min(3,n),a=Math.floor(t/i),o=t%i;return{x:e-(Math.min(i,n-a*i)-1)*Zn/2+o*Zn,y:r+a*Qn}}function nr(e){return e===`tui`?`tui`:e===`repl`||e===`cli`?`repl`:`webui`}function rr(e){return e===`tui`?`TUI`:e===`repl`?`REPL`:`WebUI`}function ir(e){switch(e){case`running`:case`active`:return`active`;case`idle`:return`idle`;case`completed`:return`completed`;case`failed`:case`error`:return`error`;case`stopped`:return`offline`;default:return`idle`}}function ar(e){if(e)return e.split(`/`).filter(Boolean).pop()??e}function or(e){let t=ar(e)??e??``;return t.length>10?`…${t.slice(-8)}`:t}function sr(e,t){let n=ar(t);if(n)return e.find(e=>ar(e.sessionId)===n)}function cr(e,t){let n=ir(t.status);return{officeId:`${e}__agent-${t.id}`,serverId:t.id,name:t.name??t.id,status:n,iteration:t.iteration??0,toolCalls:t.toolCalls??0,costUsd:t.costUsd??0,tokensIn:t.tokensIn??0,tokensOut:t.tokensOut??0,ctxPct:t.ctxPct,model:t.model,currentTool:t.currentTool,currentTask:t.description,taskId:t.taskId,presenceSource:`fleet`}}function lr(e,t){return e===`cli`?`CLI`:e===`repl`?`REPL`:rr(t)}function ur(e,t,n=[],r=new Map,i=Date.now()){let a=new Set,o=[];for(let n of e){let e=nr(n.clientType),r=lr(n.clientType,e),i=`client-${n.pid??n.sessionId}`,s=[],c=!1;for(let e of n.agents){a.add(e.id);let n=t.get(e.id),r=ir(n?.status??e.status);(r===`active`||r===`streaming`)&&(c=!0),s.push({officeId:`${i}__agent-${e.id}`,serverId:e.id,name:n?.name??e.name??e.id,status:r,iteration:n?.iteration??e.iterations??0,toolCalls:n?.toolCalls??e.toolCalls??0,costUsd:n?.costUsd??e.costUsd??0,tokensIn:n?.tokensIn??e.tokensIn??0,tokensOut:n?.tokensOut??e.tokensOut??0,ctxPct:n?.ctxPct??e.ctxPct,model:n?.model??e.model,lastActivityAt:e.lastActivityAt,currentTool:n?.currentTool??e.currentTool,currentTask:e.currentTask??n?.description,taskId:e.taskId??n?.taskId,recentTools:e.recentTools,recentMail:e.recentMail,activity:e.activity,presenceSource:`registry`})}let l=n.status===`closing`||n.status===`stale`||n.status===`lost`?`offline`:c?`active`:`idle`,u=n.agents.find(e=>e.id===`leader`);o.push({id:i,type:e,label:`${r} · ${n.pid?`PID ${n.pid}`:or(n.sessionId)}`,sublabel:[`session ${or(n.sessionId)}`,n.gitBranch?`⎇ ${n.gitBranch}`:``,n.workingDir?n.workingDir.split(/[\\/]/).filter(Boolean).pop():``].filter(Boolean).join(` · `),status:l,sessionId:n.sessionId,pid:n.pid,branch:n.gitBranch,workingDir:n.workingDir,startedAt:n.startedAt,lastHeartbeatAt:n.lastHeartbeatAt,latestPrompt:u?.latestPrompt,latestPromptAt:u?.latestPromptAt,activeInstruction:u?.status===`running`||u?.status===`streaming`?u.latestPrompt??u.currentTask:void 0,todos:u?.todos,agents:s})}for(let e of n.filter(e=>e.online)){let t=sr(o,e.sessionId);if(!t)continue;let n=e.name.trim().toLowerCase(),r=t.agents.find(t=>t.serverId===e.agentId||t.name.trim().toLowerCase()===n);r&&(a.add(e.agentId),r.mailboxId=e.agentId,r.role=e.role,r.currentTask=r.currentTask??e.currentTask,r.currentTool=r.currentTool??e.currentTool)}let s=[...t.values()].filter(e=>!a.has(e.id)),c,l=()=>{if(c)return c;let e=o.find(e=>e.type===`webui`);return e?(c=e,e):(c={id:`client-self`,type:`webui`,label:`This WebUI`,sublabel:`Web UI`,status:`idle`,agents:[]},o.push(c),c)};for(let e of s){let t=sr(o,e.sessionId)??l(),n=cr(t.id,e);(n.status===`active`||n.status===`streaming`)&&t.status!==`offline`&&(t.status=`active`),t.agents.push(n),a.add(e.id)}for(let[e,t]of r){if(a.has(e)||i-t.finishedAt>9e5)continue;let n=sr(o,t.agent.sessionId);n&&n.agents.push(cr(n.id,t.agent))}return o.length===0&&o.push({id:`client-self`,type:`webui`,label:`This WebUI`,sublabel:`Web UI · connecting…`,status:`idle`,agents:[]}),o}function dr(e){return e.startsWith(`tool`)?`hsl(var(--warning))`:e.startsWith(`mailbox`)?`hsl(var(--info))`:e.startsWith(`provider`)?`hsl(var(--primary))`:e.startsWith(`agent`)||e.startsWith(`subagent`)?`hsl(var(--success))`:e.includes(`error`)?`hsl(var(--destructive))`:`hsl(var(--primary))`}var fr=new Set([`completed`,`failed`,`timeout`,`stopped`]);function pr(e){let t=(0,G.useRef)(new Map).current;return(0,G.useMemo)(()=>{let n=Date.now(),r=new Set;for(let i of e.values())if(r.add(i.id),fr.has(i.status)){let e=t.get(i.id);e?e.agent=i:t.set(i.id,{agent:i,finishedAt:i.completedAt??n})}else t.delete(i.id);for(let[e,n]of[...t.entries()])!r.has(e)&&!fr.has(n.agent.status)&&t.set(e,{agent:{...n.agent,status:`stopped`},finishedAt:n.finishedAt});for(let[e,r]of t)n-r.finishedAt>9e5&&t.delete(e);return{map:t,now:n}},[e,t])}function mr(){let{t:e}=V(),t=$e(e=>e.liveSessions),n=$e(e=>e.aggregate),r=i(e=>e.agents),a=tt(e=>e.agents),o=tt(e=>e.messages),s=l(e=>e.toolEvents),c=d(e=>e.projectName),u=pr(r),[f,p]=(0,G.useState)(null),m=(0,G.useMemo)(()=>ur(t,r,a,u.map,u.now),[t,r,a,u]),h=(0,G.useMemo)(()=>m.flatMap(e=>e.agents.map(t=>{let n=jn(on(s,t.serverId,e.sessionId),en(t.recentTools,t.serverId,e.sessionId),An(t,e,r.get(t.serverId)?.toolLog??[])),i=t.status===`active`||t.status===`streaming`,a=n.find(e=>e.status===`running`);!a&&i&&t.currentTool&&(a=sn(t.serverId,t.currentTool,e.sessionId));let c=a??n[0],l=n.filter(e=>e.status!==`running`).slice(0,6),u=Mn(tn(t.recentMail),an(o,t,e.sessionId));return{key:t.officeId,client:e,agent:t,calls:n,current:a,display:c,history:l,mail:u}})),[m,r,o,s]),g=(0,G.useMemo)(()=>m.map(e=>{let t=h.filter(t=>t.client.id===e.id);return{client:e,agents:t,stats:kn(t)}}).filter(e=>e.agents.length>0),[m,h]),_=h.filter(({agent:e})=>e.status===`active`||e.status===`streaming`).length,v=c||t.find(e=>e.projectName)?.projectName||e(`activity:office.fleetHq`),y=Date.now();return(0,K.jsxs)(`div`,{className:`agent-office`,children:[(0,K.jsxs)(`header`,{className:`agent-office__header`,children:[(0,K.jsxs)(`div`,{className:`agent-office__title`,children:[(0,K.jsx)(`span`,{className:`agent-office__brand-mark`,children:(0,K.jsx)(Pe,{"aria-hidden":`true`})}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{children:e(`activity:agentOffice.liveProjectOffice`)}),(0,K.jsx)(`h1`,{children:v})]})]}),(0,K.jsxs)(`div`,{className:`agent-office__live-pill`,children:[(0,K.jsx)(`span`,{}),` `,e(`activity:agentOffice.live`)]}),(0,K.jsxs)(`div`,{className:`agent-office__summary`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(O,{}),(0,K.jsx)(`strong`,{children:h.length}),(0,K.jsx)(`span`,{children:e(`activity:agentOffice.agents`)})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(B,{}),(0,K.jsx)(`strong`,{children:_}),(0,K.jsx)(`span`,{children:e(`activity:agentOffice.working`)})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(z,{}),(0,K.jsx)(`strong`,{children:n.toolCalls.toLocaleString()}),(0,K.jsx)(`span`,{children:e(`activity:agentOffice.toolCalls`)})]})]})]}),(0,K.jsx)(`main`,{className:`agent-office__floor`,children:h.length>0?g.map(t=>{let n=t.agents.filter(zn),r=t.agents.filter(e=>!zn(e)),i=nn(n,y),a=new Set(i.map(e=>e.id));return(0,K.jsxs)(`section`,{className:`agent-office__client-office`,children:[(0,K.jsx)(Vn,{office:t,now:y}),(0,K.jsx)(Hn,{office:t,now:y,onSelect:p}),n.length>0&&(0,K.jsxs)(`div`,{className:`agent-office__column-headings`,"aria-hidden":`true`,children:[(0,K.jsx)(`span`,{children:e(`activity:agentOffice.team`)}),(0,K.jsx)(`span`,{children:e(`activity:agentOffice.liveDesk`)}),(0,K.jsx)(`span`,{children:e(`activity:agentOffice.lastActions`)})]}),(0,K.jsxs)(`div`,{className:`agent-office__client-desks`,children:[n.map(e=>(0,K.jsx)(Rn,{model:e,now:y,onSelect:p,routedMailIds:a},e.key)),i.length>0&&(0,K.jsx)(`div`,{className:`agent-office__mail-routes`,"aria-hidden":`true`,children:i.map(e=>(0,K.jsx)(`div`,{className:`agent-office__mail-route`,style:{"--from":`${(e.fromIndex+.5)/n.length*100}%`,"--to":`${(e.toIndex+.5)/n.length*100}%`},children:(0,K.jsx)(`span`,{className:`agent-office__mail-route-parcel`,children:(0,K.jsx)(S,{"aria-hidden":`true`})})},e.id))}),n.length===0&&(0,K.jsxs)(`div`,{className:`agent-office__desks-empty`,children:[(0,K.jsx)(we,{"aria-hidden":`true`}),e(`activity:agentOffice.desksEmpty`)]})]}),r.length>0&&(0,K.jsx)(Bn,{agents:r,now:y,onSelect:p})]},t.client.id)}):(0,K.jsxs)(`div`,{className:`agent-office__empty-state`,children:[(0,K.jsx)(`span`,{children:(0,K.jsx)(F,{"aria-hidden":`true`})}),(0,K.jsx)(`h2`,{children:e(`activity:agentOffice.readyTitle`)}),(0,K.jsx)(`p`,{children:e(`activity:agentOffice.readyBody`)})]})}),(0,K.jsxs)(`footer`,{className:`agent-office__footer`,children:[(0,K.jsxs)(`span`,{children:[(0,K.jsx)(`span`,{className:`agent-office__status-dot is-active`}),` `,e(`activity:agentOffice.liveEvent`)]}),(0,K.jsxs)(`span`,{children:[(0,K.jsx)(Te,{}),` `,e(`activity:agentOffice.connectedSessions`,{count:t.length})]}),(0,K.jsxs)(`span`,{children:[(0,K.jsx)(R,{}),` `,e(`activity:agentOffice.detailHint`)]})]}),f&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`button`,{type:`button`,className:`agent-office__detail-backdrop`,onClick:()=>p(null),"aria-label":e(`activity:agentOffice.closeToolDetails`)}),(0,K.jsx)(gn,{selected:f,onClose:()=>p(null)})]})]})}function hr(e){if(e<1e3)return`${e}ms`;let t=Math.round(e/100);return t<600?`${(t/10).toFixed(1)}s`:`${Math.floor(t/600)}m ${Math.round(t%600/10)}s`}var gr={user:{Icon:T,labelKey:`activity:message.roleYou`,avatarBg:`bg-primary`,avatarColor:`text-primary-foreground`,avatarRing:`ring-2 ring-offset-2 ring-offset-background ring-primary/20`,bubbleBg:`bg-transparent`,bubbleBorder:`border-primary/40`,textColor:`text-foreground`},assistant:{Icon:O,labelKey:`activity:message.roleAssistant`,avatarBg:`bg-accent`,avatarColor:`text-accent-foreground`,avatarRing:`ring-2 ring-offset-2 ring-offset-background ring-accent/20`,bubbleBg:`bg-card`,bubbleBorder:`border-border`,textColor:`text-foreground`},tool:{Icon:Ee,labelKey:`activity:message.roleTool`,avatarBg:`bg-secondary`,avatarColor:`text-secondary-foreground`,avatarRing:`ring-2 ring-offset-2 ring-offset-background ring-secondary/20`,bubbleBg:`bg-muted/80`,bubbleBorder:`border-border`,textColor:`text-foreground`},system:{Icon:O,labelKey:`activity:transcript.kindSystem`,avatarBg:`bg-muted`,avatarColor:`text-muted-foreground`,avatarRing:`ring-2 ring-offset-2 ring-offset-background ring-muted/20`,bubbleBg:`bg-muted/50`,bubbleBorder:`border-border`,textColor:`text-muted-foreground`},error:{Icon:y,labelKey:`activity:transcript.kindError`,avatarBg:`bg-destructive`,avatarColor:`text-destructive-foreground`,avatarRing:`ring-2 ring-offset-2 ring-offset-background ring-destructive/20`,bubbleBg:`bg-destructive/5`,bubbleBorder:`border-destructive/20`,textColor:`text-destructive`}};function _r({entry:e}){let{t}=V();return e.role===`error`?(0,K.jsx)(ut,{text:e.text}):e.role===`tool`?(0,K.jsxs)(`div`,{className:`flex flex-col gap-1.5 tool-details`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5 text-sm font-medium text-foreground`,children:[(0,K.jsx)(Ee,{className:`h-3 w-3`}),(0,K.jsx)(`span`,{className:`font-mono`,children:e.tool??t(`activity:watch.toolFallback`)}),e.durationMs!==void 0&&(0,K.jsxs)(`span`,{className:`ml-auto text-[10px] text-muted-foreground font-normal tabular-nums`,children:[(0,K.jsx)(De,{className:`h-3 w-3 inline mr-0.5 align-text-bottom`}),hr(e.durationMs)]})]}),e.input!==void 0&&e.input!==null&&(0,K.jsx)(`div`,{className:`p-3 bg-muted/50 rounded-lg overflow-x-auto`,children:(0,K.jsx)(at,{input:e.input})}),e.output!==void 0&&e.output!==null?(0,K.jsx)(`div`,{className:`text-sm leading-relaxed markdown-content`,children:typeof e.output==`string`?(0,K.jsx)(lt,{remarkPlugins:[nt],rehypePlugins:it,components:ft,children:e.output}):(0,K.jsx)(`pre`,{className:`whitespace-pre-wrap font-mono text-xs bg-card rounded-lg p-2 border border-border overflow-x-auto`,children:JSON.stringify(e.output,null,2)})}):e.text?(0,K.jsx)(`div`,{className:`text-sm leading-relaxed markdown-content`,children:(0,K.jsx)(lt,{remarkPlugins:[nt],rehypePlugins:it,components:ft,children:e.text})}):null,e.isError&&(0,K.jsxs)(`div`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 px-3 py-2`,children:[(0,K.jsx)(`span`,{className:`text-xs font-medium text-destructive`,children:t(`activity:watch.toolFailed`)}),e.text&&(0,K.jsx)(`pre`,{className:`mt-1 text-xs whitespace-pre-wrap text-destructive/80`,children:e.text})]})]}):(0,K.jsx)(`div`,{className:`text-sm leading-relaxed markdown-content`,children:(0,K.jsx)(lt,{remarkPlugins:[nt],rehypePlugins:it,components:ft,children:e.text})})}function vr({entry:e,isContinuation:t=!1}){let{t:n}=V(),r=gr[e.role],i=r.Icon;return(0,K.jsxs)(`div`,{className:`group flex gap-3 animate-message msg-bubble rounded-lg transition-shadow`,children:[t?(0,K.jsx)(`div`,{className:`flex-shrink-0 w-8`}):(0,K.jsx)(`div`,{className:H(`flex-shrink-0 w-8 h-8 rounded-full flex items-center justify-center`,r.avatarBg,r.avatarColor,r.avatarRing),children:(0,K.jsx)(i,{className:`h-4 w-4`})}),(0,K.jsxs)(`div`,{className:`flex flex-col gap-1.5 min-w-0 flex-1`,children:[!t&&(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:H(`text-xs font-medium`,r.textColor),children:e.role===`tool`&&e.tool?e.tool:n(r.labelKey)}),(0,K.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:new Date(e.ts).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}),e.role===`tool`&&e.durationMs!==void 0&&(0,K.jsxs)(`span`,{className:`text-[10px] text-muted-foreground tabular-nums`,children:[`· `,hr(e.durationMs)]})]}),(0,K.jsx)(`div`,{className:H(`rounded-2xl px-4 py-3 border`,e.role===`user`&&`rounded-br-md`,e.role===`assistant`&&`rounded-bl-md`,e.role===`tool`&&`rounded-bl-sm`,e.role===`system`&&`rounded-bl-sm opacity-70`,e.role===`error`&&`rounded-bl-sm`,r.bubbleBg,r.bubbleBorder),children:(0,K.jsx)(`div`,{className:H(`text-sm leading-relaxed markdown-content`,r.textColor),children:(0,K.jsx)(_r,{entry:e})})}),e.text&&e.role!==`error`&&(0,K.jsx)(`div`,{className:`opacity-0 group-hover:opacity-100 transition-opacity`,children:(0,K.jsx)(ot,{text:e.text,label:n(`common:action.copy`)})})]})]})}var yr=[`steer`,`ask`,`assign`,`note`],br=2500;function xr({sessionId:e,limit:t=200}){let[n,r]=(0,G.useState)(null),{t:i}=V(),[a,o]=(0,G.useState)(null),[s,c]=(0,G.useState)(``),[l,u]=(0,G.useState)(!1),[d,f]=(0,G.useState)(null),[p,m]=(0,G.useState)(`steer`),[h,g]=(0,G.useState)(`high`),[_,v]=(0,G.useState)([]),[y,b]=(0,G.useState)(!1),x=(0,G.useRef)(null),S=(0,G.useRef)(!0),C=(0,G.useRef)(!0),w=$e(e=>e.liveSessions),T=(0,G.useMemo)(()=>w.find(t=>t.sessionId===e),[w,e]),E=(0,G.useMemo)(()=>{let e=T;return e?`${e.status}|${e.agents.map(e=>`${e.id}:${e.status}:${e.toolCalls??0}:${e.iterations??0}`).join(`,`)}`:``},[T]),D=T?.status===`active`||(T?.agents.some(e=>e.status===`running`||e.status===`streaming`)??!1),k=(0,G.useMemo)(()=>{if(!T)return null;let e=T.agents.find(e=>e.status===`running`||e.status===`streaming`);return e?.currentTool?`🔧 ${e.currentTool}`:e?i(`activity:sessionWatch.working`,{name:e.name??e.id}):null},[T,i]),A=(0,G.useMemo)(()=>{if(!T)return null;let e=T.agents.find(e=>e.partialText&&(e.status===`streaming`||e.status===`running`))??T.agents.find(e=>e.partialText);return e?.partialText?{label:e.id===`leader`?i(`activity:sessionWatch.claude`):e.name||e.id,text:e.partialText}:null},[T,i]),j=(0,G.useCallback)(async()=>{try{let n=await fetch(`/api/sessions/${encodeURIComponent(e)}/events?limit=${t}`);if(!n.ok)throw Error(`HTTP ${n.status}`);let i=await n.json();C.current&&(r(i),o(null))}catch(e){C.current&&o(e instanceof Error?e.message:String(e))}},[e,t]),M=(0,G.useCallback)(async()=>{try{let t=await fetch(`/api/sessions/${encodeURIComponent(e)}/mailbox`);if(!t.ok)return;let n=await t.json();C.current&&Array.isArray(n.thread)&&v(n.thread)}catch{}},[e]);(0,G.useEffect)(()=>{C.current=!0,r(null),o(null),v([]),j(),M();let e=setInterval(()=>{document.hidden||(j(),M())},br);return()=>{C.current=!1,clearInterval(e)}},[j,M]),(0,G.useEffect)(()=>{E&&j()},[E,j]),(0,G.useEffect)(()=>{S.current&&x.current&&(x.current.scrollTop=x.current.scrollHeight)},[n,A]);let ee=()=>{let e=x.current;e&&(S.current=e.scrollHeight-e.scrollTop-e.clientHeight<40)},N=async()=>{let t=s.trim();if(t&&!l){u(!0),f(null);try{let n=await fetch(`/api/sessions/${encodeURIComponent(e)}/message`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({text:t,type:p,priority:h})});if(!n.ok)throw Error(`HTTP ${n.status}`);c(``),f(D?Ae.t(`activity:sessionWatch.sentRunning`):Ae.t(`activity:sessionWatch.sentIdle`)),M()}catch(e){f(Ae.t(`activity:sessionWatch.sentFailed`,{error:e instanceof Error?e.message:String(e)}))}finally{u(!1)}}},P=async()=>{if(!y){b(!0),f(null);try{let t=await fetch(`/api/sessions/${encodeURIComponent(e)}/interrupt`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({reason:Ae.t(`activity:sessionWatch.interruptReason`)})});if(!t.ok)throw Error(`HTTP ${t.status}`);f(Ae.t(`activity:sessionWatch.interruptSent`)),M()}catch(e){f(Ae.t(`activity:sessionWatch.interruptFailed`,{error:e instanceof Error?e.message:String(e)}))}finally{b(!1)}}},F=n?.entries??[];return(0,K.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between mb-1.5 shrink-0`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] uppercase tracking-wide text-muted-foreground`,children:[(0,K.jsx)(`span`,{className:H(`h-1.5 w-1.5 rounded-full`,D?`bg-success animate-pulse`:`bg-muted-foreground`)}),i(`activity:sessionWatch.liveStream`)]}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[n&&(0,K.jsxs)(`div`,{className:`text-[10px] text-muted-foreground`,children:[i(`activity:sessionWatch.events`,{count:n.total}),` · `,n.status]}),D&&(0,K.jsx)(`button`,{type:`button`,onClick:()=>void P(),disabled:y,title:i(`activity:sessionWatch.interruptTitle`),className:`rounded border border-destructive/40 bg-destructive/15 px-1.5 py-0.5 text-[10px] text-destructive hover:bg-destructive/25 disabled:opacity-40 transition-colors`,children:i(y?`activity:sessionWatch.interrupting`:`activity:sessionWatch.interrupt`)})]})]}),k&&(0,K.jsxs)(`div`,{className:`mb-1.5 shrink-0 text-[10px] text-foreground truncate`,children:[`▶ `,k]}),a&&(0,K.jsxs)(`div`,{className:`text-[11px] text-destructive mb-1 shrink-0`,children:[`· `,a]}),(0,K.jsxs)(`div`,{ref:x,onScroll:ee,className:`min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain space-y-1.5 pr-1`,children:[F.length===0&&!a&&(0,K.jsx)(`div`,{className:`text-[11px] text-muted-foreground italic`,children:i(`activity:sessionWatch.loading`)}),F.map((e,t)=>(0,K.jsx)(vr,{entry:e,isContinuation:t>0&&F[t-1].role===e.role},`${e.ts}-${t}`)),A&&(0,K.jsxs)(`div`,{className:`flex gap-3 animate-message`,children:[(0,K.jsx)(`div`,{className:`flex-shrink-0 w-8 h-8 rounded-full flex items-center justify-center bg-accent text-accent-foreground ring-2 ring-offset-2 ring-offset-background ring-accent/20`,children:(0,K.jsx)(O,{className:`h-4 w-4 animate-pulse`})}),(0,K.jsxs)(`div`,{className:`flex flex-col gap-1.5 max-w-[85%] min-w-0`,children:[(0,K.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground px-1`,children:A.label}),(0,K.jsx)(`div`,{className:`rounded-2xl rounded-bl-md px-4 py-3 bg-card border border-border`,children:(0,K.jsxs)(`span`,{className:`text-sm leading-relaxed text-foreground whitespace-pre-wrap break-words`,children:[A.text,(0,K.jsx)(`span`,{className:`animate-pulse text-primary`,children:`▋`})]})})]})]})]}),_.length>0&&(0,K.jsxs)(`div`,{className:`mt-2 pt-2 border-t border-border shrink-0 max-h-28 overflow-y-auto space-y-1`,children:[(0,K.jsx)(`div`,{className:`text-[9px] uppercase tracking-wide text-muted-foreground`,children:i(`activity:mailbox.messages`)}),_.slice(-6).map(e=>{let t=e.completed?i(`activity:sessionWatch.done`):e.readByLeader?i(`activity:sessionWatch.read`):i(`activity:sessionWatch.delivered`);return(0,K.jsxs)(`div`,{className:`text-[10px] leading-snug`,children:[(0,K.jsx)(`span`,{className:H(`font-semibold mr-1.5`,e.fromLeader?`text-accent`:`text-primary`),children:e.fromLeader?i(`activity:sessionWatch.agent`):i(`activity:sessionWatch.you`)}),(0,K.jsx)(`span`,{className:`text-foreground whitespace-pre-wrap break-words`,children:e.body}),!e.fromLeader&&(0,K.jsx)(`span`,{className:H(`ml-1.5 text-[9px]`,e.completed?`text-success`:e.readByLeader?`text-primary`:`text-muted-foreground`),children:t})]},e.id)})]}),(0,K.jsxs)(`div`,{className:`mt-2 pt-2 border-t border-border shrink-0`,children:[(0,K.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5`,children:[(0,K.jsx)(`select`,{value:p,onChange:e=>m(e.target.value),title:i(`activity:sessionWatch.msgType.${p}Hint`),className:`rounded bg-muted border border-border px-1.5 py-0.5 text-[10px] text-foreground focus:outline-none focus:ring-1 focus:ring-ring`,children:yr.map(e=>(0,K.jsx)(`option`,{value:e,children:i(`activity:sessionWatch.msgType.${e}Label`)},e))}),(0,K.jsxs)(`select`,{value:h,onChange:e=>g(e.target.value),title:i(`activity:sessionWatch.priority`),className:`rounded bg-muted border border-border px-1.5 py-0.5 text-[10px] text-foreground focus:outline-none focus:ring-1 focus:ring-ring`,children:[(0,K.jsx)(`option`,{value:`high`,children:`high`}),(0,K.jsx)(`option`,{value:`normal`,children:`normal`}),(0,K.jsx)(`option`,{value:`low`,children:`low`})]})]}),(0,K.jsxs)(`div`,{className:`flex items-end gap-1.5`,children:[(0,K.jsx)(`textarea`,{value:s,onChange:e=>c(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),N())},rows:2,placeholder:i(`activity:sessionWatch.placeholder`,{label:i(`activity:sessionWatch.msgType.${p}Label`)}),className:`flex-1 resize-none rounded-md bg-muted border border-border px-2 py-1 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring`}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>void N(),disabled:l||!s.trim(),className:`shrink-0 rounded-md bg-primary text-primary-foreground px-2.5 py-1.5 text-xs hover:bg-primary/90 disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:l?`…`:i(`activity:sessionWatch.send`)})]}),d&&(0,K.jsx)(`div`,{className:`mt-1 text-[10px] text-muted-foreground`,children:d}),(0,K.jsx)(`div`,{className:`mt-0.5 text-[9px] text-muted-foreground`,children:i(`activity:sessionWatch.sendHint`)})]})]})}var Q={primary:`hsl(var(--primary))`,info:`hsl(var(--info))`,success:`hsl(var(--success))`,warning:`hsl(var(--warning))`,destructive:`hsl(var(--destructive))`,muted:`hsl(var(--muted-foreground))`},Sr=.12;function Cr(e){return Math.min(100,Math.max(0,e??0))}function wr({status:e,small:t,activity:n=0}){let r=t?`w-2 h-2`:`w-3 h-3`,i=t?4+n*4:6+n*6,a={idle:`bg-muted-foreground`,active:`bg-success`,streaming:`bg-primary`,completed:`bg-primary`,error:`bg-destructive`,offline:`bg-muted-foreground/60`},o={idle:Q.muted,active:Q.success,streaming:Q.primary,completed:Q.primary,error:Q.destructive,offline:Q.muted};return(0,K.jsx)(`span`,{className:H(`rounded-full`,r,n>0&&`animate-pulse`,a[e]),style:{boxShadow:n>0?`0 0 ${i}px ${o[e]}`:void 0}})}function Tr(){let e={opacity:0,width:1,height:1,minWidth:0,border:`none`,background:`transparent`};return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Fe,{type:`target`,position:Be.Top,style:e,isConnectable:!1}),(0,K.jsx)(Fe,{type:`source`,position:Be.Bottom,style:e,isConnectable:!1})]})}function Er({data:e}){let{t}=V();return(0,K.jsxs)(`div`,{className:`mt-2 flex items-center justify-between border-t border-border/60 pt-1.5 text-[10px] text-muted-foreground`,children:[(0,K.jsxs)(`span`,{children:[(0,K.jsx)(`span`,{className:`font-mono text-foreground`,children:e.agentCount??0}),` `,t(`activity:office.agentsSuffix`)]}),e.startedAt&&(0,K.jsx)(`span`,{children:t(`activity:office.upPrefix`,{time:Gn(e.startedAt,Date.now())})})]})}function Dr({data:e}){let{t}=V(),n=e.status===`active`||e.status===`streaming`,r=e.status===`error`,i=e.status===`offline`,a=e.color||Q.info;return(0,K.jsxs)(`div`,{className:H(`rounded-xl border-2 p-4 min-w-[180px] transition-all backdrop-blur-sm`,n&&`shadow-lg shadow-primary/15`,r&&`border-destructive/50 bg-destructive/10`,i&&`border-border/70 bg-muted/35 opacity-60`,!n&&!r&&!i&&`border-primary/30 bg-primary/10`),children:[(0,K.jsx)(Tr,{}),(0,K.jsxs)(`div`,{className:`flex items-center gap-3 mb-3`,children:[(0,K.jsx)(`div`,{className:H(`flex items-center justify-center w-10 h-10 rounded-lg`,n?`bg-primary/15`:`bg-primary/10`),children:(0,K.jsx)(Se,{className:`h-5 w-5`,style:{color:a}})}),(0,K.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,K.jsx)(`div`,{className:`text-xs font-bold truncate`,style:{color:a},children:e.label}),(0,K.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:t(`activity:office.webuiClient`)})]}),(0,K.jsx)(wr,{status:e.status,activity:e.vizActivity??0})]}),e.sublabel&&(0,K.jsx)(`div`,{className:`mb-2 truncate text-[10px] text-muted-foreground`,children:e.sublabel}),(0,K.jsx)(`div`,{className:`flex items-center gap-2 text-[10px] text-muted-foreground`,children:i?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(C,{className:`h-3 w-3 text-muted-foreground`}),(0,K.jsx)(`span`,{children:t(`activity:office.disconnected`)})]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(F,{className:`h-3 w-3 text-success`}),(0,K.jsx)(`span`,{children:t(`activity:office.connected`)})]})}),n&&(0,K.jsx)(`div`,{className:`mt-2 h-1 overflow-hidden rounded-full bg-primary/20`,children:(0,K.jsx)(`div`,{className:`h-full animate-pulse bg-primary`,style:{width:`60%`}})}),(0,K.jsx)(Er,{data:e})]})}function Or({data:e}){let{t}=V(),n=e.status===`active`||e.status===`streaming`,r=e.status===`error`,i=e.color||Q.success;return(0,K.jsxs)(`div`,{className:H(`rounded-xl border-2 p-4 min-w-[180px] transition-all backdrop-blur-sm`,n&&`shadow-lg shadow-success/15`,r&&`border-destructive/50 bg-destructive/10`,!n&&!r&&`border-success/30 bg-success/10`),children:[(0,K.jsx)(Tr,{}),(0,K.jsxs)(`div`,{className:`flex items-center gap-3 mb-3`,children:[(0,K.jsx)(`div`,{className:H(`flex items-center justify-center w-10 h-10 rounded-lg`,n?`bg-success/15`:`bg-success/10`),children:(0,K.jsx)(Ee,{className:`h-5 w-5`,style:{color:i}})}),(0,K.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,K.jsx)(`div`,{className:`text-xs font-bold truncate`,style:{color:i},children:e.label}),(0,K.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:t(`activity:office.tuiClient`)})]}),(0,K.jsx)(wr,{status:e.status,activity:e.vizActivity??0})]}),e.sublabel&&(0,K.jsx)(`div`,{className:`mb-2 truncate text-[10px] text-muted-foreground`,children:e.sublabel}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] text-muted-foreground`,children:[(0,K.jsx)(Ee,{className:`h-3 w-3 text-success`}),(0,K.jsx)(`span`,{children:t(`activity:office.terminal`)})]}),(0,K.jsx)(Er,{data:e})]})}function kr({data:e}){let{t}=V(),n=e.status===`active`||e.status===`streaming`,r=e.color||Q.warning;return(0,K.jsxs)(`div`,{className:H(`rounded-xl border-2 p-4 min-w-[160px] transition-all backdrop-blur-sm`,n&&`shadow-lg shadow-warning/15`,!n&&`border-warning/30 bg-warning/10`),children:[(0,K.jsx)(Tr,{}),(0,K.jsxs)(`div`,{className:`flex items-center gap-3 mb-3`,children:[(0,K.jsx)(`div`,{className:H(`flex items-center justify-center w-10 h-10 rounded-lg`,n?`bg-warning/15`:`bg-warning/10`),children:(0,K.jsx)(Ee,{className:`h-5 w-5`,style:{color:r}})}),(0,K.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,K.jsx)(`div`,{className:`text-xs font-bold truncate`,style:{color:r},children:e.label}),(0,K.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:t(`activity:office.repl`)})]}),(0,K.jsx)(wr,{status:e.status,activity:e.vizActivity??0})]}),e.sublabel&&(0,K.jsx)(`div`,{className:`mb-1 truncate text-[10px] text-muted-foreground`,children:e.sublabel}),(0,K.jsx)(Er,{data:e})]})}function Ar({data:e}){let{t}=V(),n=e.status===`active`||e.status===`streaming`,r=e.color||Q.primary;return(0,K.jsxs)(`div`,{className:`relative min-w-[200px] rounded-xl border-2 border-border/70 bg-card/90 p-4 shadow-lg backdrop-blur-sm transition-all`,children:[(0,K.jsx)(Tr,{}),(0,K.jsx)(`div`,{className:`absolute -top-3 left-1/2 -translate-x-1/2 rounded-full bg-primary px-2 py-0.5 text-[11px] font-bold text-primary-foreground`,children:t(`activity:office.coordinator`)}),(0,K.jsxs)(`div`,{className:`flex items-center gap-3 mb-3 mt-2`,children:[(0,K.jsx)(`div`,{className:H(`flex items-center justify-center w-12 h-12 rounded-xl`,n?`bg-primary/15`:`bg-primary/10`),children:(0,K.jsx)(te,{className:`h-6 w-6`,style:{color:r}})}),(0,K.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,K.jsx)(`div`,{className:`text-sm font-bold truncate`,style:{color:r},children:e.label}),(0,K.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:e.sublabel||t(`activity:office.fleetSummary`)})]}),(0,K.jsx)(wr,{status:e.status,activity:e.vizActivity??0})]}),(0,K.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 text-[10px] mb-2`,children:[(0,K.jsxs)(`div`,{className:`rounded bg-muted/40 p-1.5 text-center`,children:[(0,K.jsxs)(`div`,{className:`font-mono`,children:[(0,K.jsx)(`span`,{className:`text-success`,children:e.agentsActive||0}),(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:` / `}),(0,K.jsx)(`span`,{className:`text-primary`,children:e.agentsTotal||0})]}),(0,K.jsx)(`div`,{className:`text-muted-foreground`,children:t(`activity:officeMap.agents`)})]}),(0,K.jsxs)(`div`,{className:`rounded bg-muted/40 p-1.5 text-center`,children:[(0,K.jsx)(`div`,{className:`font-mono text-warning`,children:(e.toolCalls||0).toLocaleString()}),(0,K.jsx)(`div`,{className:`text-muted-foreground`,children:t(`activity:office.toolCallsLabel`)})]}),(0,K.jsxs)(`div`,{className:`rounded bg-muted/40 p-1.5 text-center`,children:[(0,K.jsx)(`div`,{className:`font-mono text-foreground`,children:Un(e.tokensIn)}),(0,K.jsx)(`div`,{className:`text-muted-foreground`,children:t(`activity:office.tokensLabel`)})]}),(0,K.jsxs)(`div`,{className:`rounded bg-muted/40 p-1.5 text-center`,children:[(0,K.jsxs)(`div`,{className:`font-mono text-success`,children:[`$`,(e.costUsd||0).toFixed(3)]}),(0,K.jsx)(`div`,{className:`text-muted-foreground`,children:t(`activity:office.cost`)})]})]}),n&&(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] text-primary`,children:[(0,K.jsx)(`span`,{className:`h-2 w-2 animate-pulse rounded-full bg-primary`}),t(`activity:office.coordinatingFleet`)]})]})}function jr({data:e}){let{t}=V(),n=e.status===`active`||e.status===`streaming`,r=e.status===`error`,i=e.status===`completed`,a=e.color||Q.primary,o=Cr(e.ctxPct);return(0,K.jsxs)(`div`,{className:H(`w-[170px] min-w-0 max-w-[170px] overflow-hidden rounded-lg border p-3 transition-all backdrop-blur-sm`,n&&`border-primary/50 bg-primary/10 shadow-lg shadow-primary/10`,r&&`border-destructive/50 bg-destructive/10`,i&&`border-border/70 bg-muted/35`,!n&&!r&&!i&&`border-primary/30 bg-primary/10`),children:[(0,K.jsx)(Tr,{}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2 mb-1.5`,children:[(0,K.jsx)(O,{className:`h-4 w-4 shrink-0`,style:{color:a}}),(0,K.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,K.jsx)(`div`,{className:`text-[11px] font-bold truncate`,style:{color:a},children:e.label}),e.model&&(0,K.jsx)(`div`,{className:`truncate text-[10px] text-muted-foreground`,children:Kn(e.model)})]}),(0,K.jsx)(wr,{status:e.status,small:!0,activity:e.vizActivity??0})]}),e.currentTask&&(0,K.jsxs)(`div`,{className:`mb-1.5 flex min-w-0 items-center gap-1 overflow-hidden text-[11px] text-primary`,children:[(0,K.jsx)(`span`,{className:H(`h-1.5 w-1.5 shrink-0 rounded-full bg-primary`,n&&`animate-pulse`)}),(0,K.jsx)(`span`,{className:`min-w-0 truncate font-mono`,title:e.currentTask,children:qn(e.currentTask,72)})]}),(0,K.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-2 gap-y-0.5 text-[11px] mb-1.5`,children:[(0,K.jsxs)(`div`,{className:`flex justify-between`,children:[(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:`iter`}),(0,K.jsx)(`span`,{className:`font-mono text-foreground`,children:e.iteration||0})]}),(0,K.jsxs)(`div`,{className:`flex justify-between`,children:[(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:`tools`}),(0,K.jsx)(`span`,{className:`font-mono text-warning`,children:e.toolCalls||0})]}),(0,K.jsxs)(`div`,{className:`flex justify-between`,children:[(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:`tok`}),(0,K.jsx)(`span`,{className:`font-mono text-foreground`,children:Un((e.tokensIn||0)+(e.tokensOut||0))})]}),(0,K.jsxs)(`div`,{className:`flex justify-between`,children:[(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:`cost`}),(0,K.jsxs)(`span`,{className:`font-mono text-success`,children:[`$`,(e.costUsd||0).toFixed(3)]})]})]}),o>0&&(0,K.jsxs)(`div`,{className:`mb-1`,children:[(0,K.jsxs)(`div`,{className:`mb-0.5 flex justify-between text-[10px] text-muted-foreground`,children:[(0,K.jsx)(`span`,{children:`ctx`}),(0,K.jsxs)(`span`,{className:H(`font-mono`,o>=90?`text-destructive`:o>=70?`text-warning`:`text-muted-foreground`),children:[o,`%`]})]}),(0,K.jsx)(`div`,{className:`h-1 overflow-hidden rounded-full bg-muted`,children:(0,K.jsx)(`div`,{className:H(`h-full`,o>=90?`bg-destructive`:o>=70?`bg-warning`:`bg-primary`),style:{width:`${o}%`}})})]}),e.lastActivityAt&&(0,K.jsxs)(`div`,{className:H(`flex items-center gap-1 text-[10px]`,n?`text-muted-foreground/70`:`text-muted-foreground`),children:[i&&(0,K.jsx)(`span`,{className:`text-success`,children:t(`activity:office.donePrefix`)}),r&&(0,K.jsx)(`span`,{className:`text-destructive`,children:t(`activity:office.failedPrefix`)}),(0,K.jsx)(`span`,{children:t(`activity:office.seenPrefix`,{time:Wn(e.lastActivityAt,Date.now())})})]})]})}function Mr({data:e}){let{t}=V();return(0,K.jsxs)(`div`,{className:H(`rounded-lg border border-dashed p-3 min-w-[120px] transition-all opacity-40`,`border-border/70 bg-muted/30`),children:[(0,K.jsx)(Tr,{}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,K.jsx)(me,{className:`h-4 w-4 text-muted-foreground`}),(0,K.jsx)(`div`,{className:`flex-1 min-w-0`,children:(0,K.jsx)(`div`,{className:`truncate text-[10px] text-muted-foreground`,children:e.label})}),(0,K.jsx)(wr,{status:e.status,small:!0,activity:e.vizActivity??0})]}),(0,K.jsx)(`div`,{className:`text-[11px] text-muted-foreground`,children:t(`activity:office.availableDesk`)})]})}function Nr({data:e}){let{t}=V(),n=e.color||Q.warning,r=(e.unreadCount||0)>0;return(0,K.jsxs)(`div`,{className:H(`rounded-xl border-2 p-4 min-w-[160px] transition-all backdrop-blur-sm`,r&&`border-warning/50 bg-warning/10 shadow-lg shadow-warning/10`,!r&&`border-warning/30 bg-warning/6`),children:[(0,K.jsx)(Tr,{}),(0,K.jsxs)(`div`,{className:`flex items-center gap-3 mb-3`,children:[(0,K.jsx)(`div`,{className:H(`flex items-center justify-center w-10 h-10 rounded-lg`,r?`bg-warning/18`:`bg-warning/10`),children:(0,K.jsx)(S,{className:`h-5 w-5`,style:{color:n}})}),(0,K.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,K.jsx)(`div`,{className:`text-xs font-bold`,style:{color:n},children:t(`activity:office.mailboxHub`)}),(0,K.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:r?t(`activity:office.unreadSuffix`,{count:e.unreadCount||0}):t(`activity:office.allClear`)})]}),r&&(0,K.jsx)(`div`,{className:`flex h-5 w-5 items-center justify-center rounded-full bg-warning text-[10px] font-bold text-background`,children:e.unreadCount})]}),(0,K.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 text-[10px]`,children:[(0,K.jsxs)(`div`,{className:`rounded bg-muted/40 p-1.5 text-center`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-center gap-1 text-warning`,children:[(0,K.jsx)(x,{className:`h-3 w-3`}),(0,K.jsx)(`span`,{children:e.messageCount||0})]}),(0,K.jsx)(`div`,{className:`text-muted-foreground`,children:t(`activity:office.total`)})]}),(0,K.jsxs)(`div`,{className:`rounded bg-muted/40 p-1.5 text-center`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-center gap-1 text-success`,children:[(0,K.jsx)(I,{className:`h-3 w-3`}),(0,K.jsx)(`span`,{children:e.unreadCount||0})]}),(0,K.jsx)(`div`,{className:`text-muted-foreground`,children:t(`activity:office.unreadLabel`)})]})]}),e.sublabel&&(0,K.jsxs)(`div`,{className:`mt-2 truncate border-t border-border/60 pt-1.5 text-[11px] text-muted-foreground`,children:[`✉ `,e.sublabel]})]})}var Pr={webui:Dr,tui:Or,repl:kr,coordinator:Ar,agent:jr,mailbox:Nr,desk:Mr};function Fr({broadcastOpen:e,labels:t,onArrange:n,onBroadcastToggle:r,onFeedToggle:i,showFeed:a}){return(0,K.jsxs)(qe,{position:`top-right`,className:`flex items-center gap-2`,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:n,title:t.arrangeTitle,className:`flex items-center gap-1.5 rounded-md border border-border/70 bg-card/90 px-2.5 py-1.5 text-xs text-foreground shadow-sm transition-colors hover:bg-accent`,children:[(0,K.jsx)(ae,{className:`h-3.5 w-3.5`}),t.arrange]}),(0,K.jsxs)(`button`,{type:`button`,onClick:i,title:t.feedTitle,className:H(`flex items-center gap-1.5 px-2.5 py-1.5 rounded-md border text-xs transition-colors`,a?`border-primary/35 bg-primary/10 text-primary`:`border-border/70 bg-card/90 text-muted-foreground hover:bg-accent hover:text-foreground`),children:[(0,K.jsx)(ye,{className:`h-3.5 w-3.5`}),t.feed]}),(0,K.jsxs)(`button`,{type:`button`,onClick:r,title:t.broadcastTitle,className:H(`flex items-center gap-1.5 px-2.5 py-1.5 rounded-md border text-xs transition-colors`,e?`border-warning/35 bg-warning/10 text-warning`:`border-border/70 bg-card/90 text-muted-foreground hover:bg-accent hover:text-foreground`),children:[(0,K.jsx)(x,{className:`h-3.5 w-3.5`}),t.broadcast]})]})}function Ir(){return(0,K.jsx)(We,{className:`rounded-lg border border-border/70 bg-card/90`,nodeColor:e=>{switch(e.data.kind){case`coordinator`:return Q.primary;case`webui`:return Q.info;case`tui`:return Q.success;case`repl`:case`mailbox`:return Q.warning;default:return Q.primary}},maskColor:`hsl(var(--background) / 0.72)`})}function Lr({closeTitle:e,label:t,onClose:n,sessionId:r,streamTitle:i}){return(0,K.jsxs)(`div`,{className:`absolute inset-y-0 right-0 z-30 flex w-[min(680px,92%)] flex-col border-l border-border bg-background shadow-2xl`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border px-4 py-2.5 shrink-0 bg-card`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,K.jsx)(O,{className:`h-4 w-4 text-primary shrink-0`}),(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`div`,{className:`truncate text-sm font-bold text-foreground`,children:t}),(0,K.jsx)(`div`,{className:`text-[10px] uppercase tracking-wide text-muted-foreground`,children:i})]})]}),(0,K.jsx)(`button`,{type:`button`,onClick:n,title:e,className:`text-muted-foreground hover:text-foreground text-xl leading-none shrink-0`,children:`×`})]}),(0,K.jsx)(`div`,{className:`flex-1 min-h-0 p-4`,children:(0,K.jsx)(xr,{sessionId:r,limit:500})})]})}var Rr={wire:({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:i,targetPosition:a,data:o,selected:s})=>{let c=o?.color||Q.primary,l=U(e=>e.animateEdges),u=o?.animated&&l?Math.max(.15,o?.intensity??.6):0,[d,f,p]=ze({sourceX:e,sourceY:t,sourcePosition:i??Be.Bottom,targetX:n,targetY:r,targetPosition:a??Be.Top,curvature:.28}),m=5+u*7,h=5+u*4,g=m+h,_=`${Math.max(.5,1.6-u).toFixed(2)}s`;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`path`,{d,fill:`none`,stroke:c,strokeWidth:s?2.5:1.4,strokeOpacity:s?.9:.28,className:`react-flow__edge-path`}),u>.05&&(0,K.jsx)(`path`,{d,fill:`none`,stroke:c,strokeWidth:2.2,strokeOpacity:.45+u*.5,strokeDasharray:`${m} ${h}`,strokeLinecap:`round`,style:{filter:`drop-shadow(0 0 ${2+u*4}px ${c})`},children:(0,K.jsx)(`animate`,{attributeName:`stroke-dashoffset`,from:g,to:`0`,dur:_,repeatCount:`indefinite`})}),o?.label&&u>.1&&(0,K.jsx)(Ve,{children:(0,K.jsx)(`div`,{style:{position:`absolute`,transform:`translate(-50%, -50%) translate(${f}px, ${p}px)`},className:`pointer-events-none max-w-[220px] truncate whitespace-nowrap rounded-full border border-border/70 bg-card/90 px-1.5 py-0.5 text-[8px] font-medium text-foreground backdrop-blur-sm`,children:o.label})})]})}};function zr(){let{t:e}=V(),{clientCounts:t,currentSession:n,totalAgents:r,activeAgents:i,aggregate:a}=$e(ge(e=>({clientCounts:e.clientCounts,currentSession:e.currentSession,totalAgents:e.totalAgents,activeAgents:e.activeAgents,aggregate:e.aggregate}))),o=t.tui+t.webui+t.repl,s=e=>e?.toLocaleString()??`0`;return(0,K.jsxs)(`div`,{className:`absolute left-4 top-20 z-10 rounded-xl border border-border/70 bg-card/90 p-3 text-foreground shadow-xl backdrop-blur`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,K.jsx)(z,{className:`h-3.5 w-3.5 text-success`}),(0,K.jsx)(`span`,{className:`text-[10px] font-bold uppercase text-muted-foreground`,children:e(`activity:office.sessionStats`)})]}),(0,K.jsxs)(`div`,{className:`space-y-1.5 text-[10px]`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,K.jsx)(h,{className:`h-3 w-3 text-muted-foreground`}),(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:e(`activity:office.clients`)})]}),(0,K.jsxs)(`span`,{className:`font-mono text-foreground`,children:[i,` `,(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:`/`}),` `,(0,K.jsx)(`span`,{className:`text-success`,children:o})]})]}),(0,K.jsxs)(`div`,{className:`flex items-center gap-3 pl-4 text-[9px]`,children:[t.tui>0&&(0,K.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,K.jsx)(Ee,{className:`h-2.5 w-2.5 text-success`}),(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:e(`activity:hud.tui`)}),(0,K.jsx)(`span`,{className:`font-mono text-success`,children:t.tui})]}),t.webui>0&&(0,K.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,K.jsx)(Se,{className:`h-2.5 w-2.5 text-primary`}),(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:e(`activity:hud.webui`)}),(0,K.jsx)(`span`,{className:`font-mono text-primary`,children:t.webui})]}),t.repl>0&&(0,K.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,K.jsx)(Ee,{className:`h-2.5 w-2.5 text-warning`}),(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:e(`activity:hud.repl`)}),(0,K.jsx)(`span`,{className:`font-mono text-warning`,children:t.repl})]})]}),(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,K.jsx)(O,{className:`h-3 w-3 text-muted-foreground`}),(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:e(`activity:officeMap.agents`)})]}),(0,K.jsxs)(`span`,{className:`font-mono text-foreground`,children:[i,` `,(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:`/`}),` `,(0,K.jsx)(`span`,{className:`text-primary`,children:r})]})]}),n.model&&(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,K.jsx)(te,{className:`h-3 w-3 text-muted-foreground`}),(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:e(`activity:officeMap.model`)})]}),(0,K.jsx)(`span`,{className:`max-w-[120px] truncate font-mono text-primary`,title:n.model,children:n.model.split(`/`).pop()?.slice(0,16)})]}),n.mode&&(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,K.jsx)(B,{className:`h-3 w-3 text-muted-foreground`}),(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:e(`activity:officeMap.mode`)})]}),(0,K.jsx)(`span`,{className:H(`font-mono uppercase text-[9px] px-1.5 py-0.5 rounded`,n.mode===`auto`&&`bg-primary/10 text-primary`,n.mode===`suggest`&&`bg-success/10 text-success`,n.mode===`off`&&`bg-muted text-muted-foreground`,![`auto`,`suggest`,`off`].includes(n.mode||``)&&`bg-muted text-muted-foreground`),children:n.mode})]}),(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,K.jsx)(de,{className:`h-3 w-3 text-muted-foreground`}),(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:e(`activity:office.toolCallsLabel`)})]}),(0,K.jsx)(`span`,{className:`font-mono text-warning`,children:s(a.toolCalls)})]}),(0,K.jsxs)(`div`,{className:`mt-1.5 space-y-1 border-t border-border/70 pt-1.5`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,K.jsx)(`span`,{className:`text-[8px] text-muted-foreground`,children:`IN`}),(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:e(`activity:office.input`)})]}),(0,K.jsx)(`span`,{className:`font-mono text-[9px] text-foreground`,children:s(a.tokensIn)})]}),(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,K.jsx)(`span`,{className:`text-[8px] text-muted-foreground`,children:e(`activity:hud.out`)}),(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:e(`activity:office.output`)})]}),(0,K.jsx)(`span`,{className:`font-mono text-[9px] text-foreground`,children:s(a.tokensOut)})]})]}),(0,K.jsxs)(`div`,{className:`mt-1.5 flex items-center justify-between gap-4 border-t border-border/70 pt-1.5`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,K.jsx)(D,{className:`h-3 w-3 text-muted-foreground`}),(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:e(`activity:office.cost`)})]}),(0,K.jsx)(`span`,{className:`font-mono font-medium text-success`,children:(e=>e==null?`$0.0000`:`$${e.toFixed(4)}`)(a.costUsd)})]})]})]})}function Br({events:e,now:t}){let{t:n}=V(),r=e.slice(0,14);return(0,K.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0 z-10 pointer-events-none px-3 pb-3`,children:(0,K.jsxs)(`div`,{className:`pointer-events-auto mx-auto max-w-3xl rounded-lg border border-border/70 bg-card/90 px-3 py-2 shadow-xl backdrop-blur`,children:[(0,K.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-1.5 text-[10px] uppercase text-primary`,children:[(0,K.jsx)(z,{className:`h-3 w-3`}),n(`activity:office.liveActivity`)]}),r.length===0?(0,K.jsx)(`div`,{className:`text-[11px] italic text-muted-foreground`,children:n(`activity:office.waitingActivity`)}):(0,K.jsx)(`div`,{className:`flex flex-col gap-0.5 max-h-32 overflow-hidden`,children:r.map(e=>{let r=Math.max(0,Math.round((t-e.timestamp)/1e3));return(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] leading-tight`,children:[(0,K.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full shrink-0`,style:{backgroundColor:dr(e.kind)}}),(0,K.jsx)(`span`,{className:`flex-1 truncate text-foreground`,children:e.label}),(0,K.jsx)(`span`,{className:`shrink-0 tabular-nums text-muted-foreground`,children:r<1?n(`activity:office.now`):`${r}s`})]},e.id)})})]})})}function Vr(){let{t:e}=V();return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`absolute bottom-4 left-4 z-10 rounded-lg border border-border/70 bg-card/90 p-3 text-[10px] shadow-xl backdrop-blur`,children:[(0,K.jsx)(`div`,{className:`mb-2 font-bold text-foreground`,children:e(`activity:office.legendStatus`)}),(0,K.jsxs)(`div`,{className:`space-y-1`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`h-2 w-2 animate-pulse rounded-full bg-success`}),(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:e(`activity:office.legendActive`)})]}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`h-2 w-2 rounded-full bg-muted-foreground`}),(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:e(`activity:office.legendIdle`)})]}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`h-2 w-2 animate-pulse rounded-full bg-destructive`}),(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:e(`activity:office.legendError`)})]})]})]}),(0,K.jsxs)(`div`,{className:`absolute bottom-4 right-4 z-10 rounded-lg border border-border/70 bg-card/90 p-3 text-[10px] shadow-xl backdrop-blur`,children:[(0,K.jsx)(`div`,{className:`mb-2 font-bold text-foreground`,children:e(`activity:office.legendConnections`)}),(0,K.jsxs)(`div`,{className:`space-y-1`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`text-warning`,children:`✉`}),(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:e(`activity:office.legendMail`)})]}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`text-primary`,children:`→`}),(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:e(`activity:office.legendTask`)})]}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`text-success`,children:`●`}),(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:e(`activity:office.legendStatusConn`)})]})]})]})]})}function Hr({draft:e,isSending:t,result:n,onClose:r,onDraftChange:i,onSend:a}){let{t:o}=V();return(0,K.jsxs)(`div`,{className:`absolute right-4 top-16 z-30 w-80 rounded-xl border border-warning/35 bg-card/95 p-3 shadow-2xl backdrop-blur`,children:[(0,K.jsxs)(`div`,{className:`mb-1.5 flex items-center justify-between`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] font-semibold text-warning`,children:[(0,K.jsx)(x,{className:`h-3.5 w-3.5`}),` `,o(`activity:office.broadcastToAll`)]}),(0,K.jsx)(`button`,{type:`button`,onClick:r,className:`text-base leading-none text-muted-foreground hover:text-foreground`,children:`×`})]}),(0,K.jsx)(`textarea`,{value:e,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),a())},rows:3,placeholder:o(`activity:office.broadcastPlaceholder`),className:`w-full resize-none rounded-md border border-border/70 bg-background/70 px-2 py-1 text-[11px] text-foreground placeholder:text-muted-foreground focus:border-warning/45 focus:outline-none`}),(0,K.jsxs)(`div`,{className:`mt-1.5 flex items-center justify-between`,children:[(0,K.jsx)(`span`,{className:`text-[9px] text-muted-foreground`,children:o(`activity:office.broadcastSendHint`)}),(0,K.jsx)(`button`,{type:`button`,onClick:a,disabled:t||!e.trim(),className:`rounded-md border border-warning/35 bg-warning/12 px-2.5 py-1 text-[11px] text-warning transition-colors hover:bg-warning/18 disabled:cursor-not-allowed disabled:opacity-40`,children:t?`…`:o(`activity:office.broadcast`)})]}),n&&(0,K.jsx)(`div`,{className:`mt-1 text-[10px] text-muted-foreground`,children:n})]})}function $({k:e,v:t,accent:n}){return(0,K.jsxs)(`div`,{className:`flex justify-between gap-3`,children:[(0,K.jsx)(`span`,{className:`text-muted-foreground shrink-0`,children:e}),(0,K.jsx)(`span`,{className:H(`font-mono truncate text-right`,n??`text-foreground/80`),children:t})]})}function Ur({selectedNode:e,selectedAgentTranscript:t,mailboxMessages:n,onClose:r,onOpenWatch:i}){let{t:a}=V(),o=e.data,s=Date.now(),c=o.kind===`agent`,l=o.kind===`webui`||o.kind===`tui`||o.kind===`repl`,u=(o.tokensIn||0)+(o.tokensOut||0),d=Cr(o.ctxPct);return(0,K.jsxs)(`div`,{className:H(`absolute top-20 right-4 bg-background border border-border rounded-lg p-4 shadow-xl z-20`,o.kind===`agent`?`w-[28rem] max-w-[calc(100%-2rem)]`:o.sessionId?`w-80`:`w-64`),children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[o.kind===`webui`&&(0,K.jsx)(Se,{className:`h-4 w-4 text-info`}),o.kind===`tui`&&(0,K.jsx)(Ee,{className:`h-4 w-4 text-success`}),o.kind===`coordinator`&&(0,K.jsx)(te,{className:`h-4 w-4 text-primary`}),o.kind===`agent`&&(0,K.jsx)(O,{className:`h-4 w-4 text-primary`}),o.kind===`mailbox`&&(0,K.jsx)(S,{className:`h-4 w-4 text-warning`}),(0,K.jsx)(`span`,{className:`text-sm font-bold text-foreground`,children:o.label})]}),(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[o.sessionId&&(0,K.jsx)(`button`,{type:`button`,title:a(`activity:office.openFullView`),onClick:()=>i({sessionId:o.sessionId,label:o.label}),className:`text-muted-foreground hover:text-primary`,children:(0,K.jsx)(je,{className:`h-3.5 w-3.5`})}),(0,K.jsx)(`button`,{type:`button`,onClick:r,className:`text-muted-foreground hover:text-foreground text-lg leading-none`,children:`×`})]})]}),(0,K.jsxs)(`div`,{className:`space-y-1.5 text-xs`,children:[(0,K.jsx)($,{k:`Status`,v:String(o.status).toUpperCase(),accent:H(o.status===`active`&&`text-success`,o.status===`streaming`&&`text-primary`,o.status===`error`&&`text-destructive`,o.status===`idle`&&`text-muted-foreground`,o.status===`offline`&&`text-muted-foreground/70`)}),c&&(0,K.jsxs)(K.Fragment,{children:[o.model&&(0,K.jsx)($,{k:`Model`,v:Kn(o.model),accent:`text-primary`}),o.currentTask&&(0,K.jsxs)(`div`,{className:`pt-1`,children:[(0,K.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground`,children:a(`activity:agentOffice.currentTask`)}),(0,K.jsx)(`div`,{className:`mt-1 max-h-32 overflow-y-auto whitespace-pre-wrap break-words font-mono text-[10px] text-primary`,children:o.currentTask})]}),(0,K.jsx)($,{k:`Iterations`,v:o.iteration||0,accent:`text-primary`}),(0,K.jsx)($,{k:`Tool calls`,v:o.toolCalls||0,accent:`text-warning`}),(0,K.jsx)($,{k:`Tokens in`,v:Un(o.tokensIn)}),(0,K.jsx)($,{k:`Tokens out`,v:Un(o.tokensOut)}),(0,K.jsx)($,{k:`Tokens total`,v:Un(u)}),d>0&&(0,K.jsx)($,{k:`Context`,v:`${d}%`,accent:d>=90?`text-destructive`:d>=70?`text-warning`:`text-foreground/70`}),(0,K.jsx)($,{k:`Cost`,v:`$${(o.costUsd||0).toFixed(4)}`,accent:`text-success`}),o.lastActivityAt&&(0,K.jsx)($,{k:`Last seen`,v:Wn(o.lastActivityAt,s),accent:`text-muted-foreground`}),(0,K.jsx)(`div`,{className:`pt-2`,children:(0,K.jsx)(rt,{entries:t,agentName:o.label,compact:!0,maxHeightClassName:`max-h-64`})})]}),l&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)($,{k:`Surface`,v:rr(o.kind),accent:`text-foreground/80`}),o.branch&&(0,K.jsx)($,{k:`Branch`,v:`⎇ ${o.branch}`,accent:`text-foreground/70`}),o.pid!=null&&(0,K.jsx)($,{k:`PID`,v:o.pid}),o.workingDir&&(0,K.jsx)($,{k:`Dir`,v:o.workingDir,accent:`text-muted-foreground`}),(0,K.jsx)($,{k:`Agents`,v:o.agentCount??0,accent:`text-primary`}),o.startedAt&&(0,K.jsx)($,{k:`Uptime`,v:Gn(o.startedAt,s),accent:`text-foreground/70`})]}),o.kind===`mailbox`&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)($,{k:`Total messages`,v:o.messageCount||0,accent:`text-warning`}),(0,K.jsx)($,{k:`Unread`,v:o.unreadCount||0,accent:`text-warning`}),n.length>0&&(0,K.jsxs)(`div`,{className:`mt-1 space-y-1 border-t border-border pt-2`,children:[(0,K.jsx)(`div`,{className:`text-[10px] uppercase tracking-wide text-muted-foreground`,children:a(`activity:office.recent`)}),[...n].sort((e,t)=>Date.parse(t.timestamp)-Date.parse(e.timestamp)).slice(0,6).map(e=>{let t=!e.completed&&(e.readByCount??0)===0;return(0,K.jsxs)(`div`,{className:`flex items-start gap-1.5 text-[10px]`,children:[(0,K.jsx)(`span`,{className:H(`mt-1 h-1.5 w-1.5 shrink-0 rounded-full`,t?`bg-warning`:e.completed?`bg-success`:`bg-muted`)}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`div`,{className:`truncate text-foreground/80`,children:e.subject||a(`activity:office.noSubject`)}),(0,K.jsxs)(`div`,{className:`truncate font-mono text-[9px] text-muted-foreground`,children:[e.from,` → `,e.to,` · `,Wn(e.timestamp,s),e.audience===`leaders`?` · ${a(`activity:mailbox.audienceLeaders`)}`:``]})]})]},e.id)})]})]}),o.kind===`coordinator`&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)($,{k:`Connections`,v:o.connections||0,accent:`text-primary`}),(0,K.jsx)($,{k:`Iterations`,v:o.iteration||0,accent:`text-primary`})]}),(c||l)&&o.sessionId&&(0,K.jsx)(`div`,{className:`mt-2 border-t border-border pt-2 h-72`,children:(0,K.jsx)(xr,{sessionId:o.sessionId})})]})]})}function Wr(e){let t=e.split(`__agent-`)[0];return t&&t!==e?`${t}->${e}`:`coordinator->${e}`}function Gr(){let{t:e}=V(),{fitView:t}=Ge(),n=(0,G.useRef)(null),[r,a]=(0,G.useState)({width:1280,height:720});(0,G.useEffect)(()=>{let e=n.current;if(!e)return;let t=()=>{let{width:t,height:n}=e.getBoundingClientRect();t<1||n<1||a(e=>Math.abs(e.width-t)<2&&Math.abs(e.height-n)<2?e:{width:t,height:n})};t();let r=new ResizeObserver(t);return r.observe(e),()=>r.disconnect()},[]);let o=l(e=>e.events),s=i(e=>e.agents),u=i(e=>e.agentTranscripts),f=i(e=>e.leaderId),p=$e(e=>e.liveSessions),m=tt(e=>e.messages),h=tt(e=>e.agents),g=d(e=>e.session),_=pr(s),v=(0,G.useMemo)(()=>ur(p,s,h,_.map,_.now),[p,s,h,_]),y=U(e=>e.showHud),b=U(e=>e.showLegend),x=U(e=>e.showMinimap),S=U(e=>e.showControls),C=U(e=>e.showFeed),w=U(e=>e.setShowFeed),T=U(e=>e.background),[E,D,O]=Re([]),[k,A,j]=Le([]),[M,ee]=(0,G.useState)(null),[N,P]=(0,G.useState)(null),[F,te]=(0,G.useState)(!1),[ne,re]=(0,G.useState)(``),[ie,ae]=(0,G.useState)(!1),[oe,se]=(0,G.useState)(null),ce=(0,G.useMemo)(()=>{if(M?.data.kind!==`agent`)return c;let e=M.data.serverId??(M.id.includes(`__agent-`)?M.id.split(`__agent-`).pop():M.id.replace(/^agent-/,``));return e?u.get(e)??c:c},[u,M]),le=(0,G.useCallback)(async()=>{let e=ne.trim();if(e&&!ie){ae(!0),se(null);try{let t=await fetch(`/api/fleet/broadcast`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({text:e})});if(!t.ok)throw Error(`HTTP ${t.status}`);let n=await t.json();re(``),se(`Delivered to ${n.delivered??0}/${n.targets??0} session(s)`)}catch(e){se(`Failed: ${e instanceof Error?e.message:String(e)}`)}finally{ae(!1)}}},[ne,ie]),I=(0,G.useRef)(new Map),ue=4e3,L=(0,G.useRef)(new Map),R=(0,G.useRef)(new Map),de=(0,G.useRef)(new Map),fe=(0,G.useRef)(new Map),pe=(0,G.useRef)(``);(0,G.useEffect)(()=>{let n=[],i=[],a=Date.now(),o=er(v.map(e=>({id:e.id,agentCount:e.agents.length})),r),c=m.filter(e=>!e.completed&&(e.readByCount??0)===0).length,l=m.length?[...m].sort((e,t)=>Date.parse(t.timestamp)-Date.parse(e.timestamp))[0]:void 0;n.push({id:`mailbox`,type:`mailbox`,position:{x:830,y:50},data:{label:e(`activity:office.mailboxHub`),kind:`mailbox`,status:c>0?`active`:`idle`,unreadCount:c,messageCount:m.length,sublabel:l?`${l.from} → ${l.to}: ${l.subject}`:void 0,color:Q.warning}});let u=0,d=0,p=0,h=0,g=0;for(let e of v)for(let t of e.agents)d+=1,(t.status===`active`||t.status===`streaming`)&&(u+=1),p+=t.toolCalls,h+=t.costUsd,g+=t.tokensIn+t.tokensOut;let _=f?s.get(f):null,y=u>0;n.push({id:`coordinator`,type:`coordinator`,position:{x:370,y:50},data:{label:e(`activity:office.fleetHqLabel`),sublabel:e(`activity:office.clientsSuffix`,{count:v.length}),kind:`coordinator`,status:_?.status===`failed`?`error`:y?`active`:`idle`,connections:v.length,agentsActive:u,agentsTotal:d,toolCalls:p,costUsd:h,tokensIn:g,color:Q.primary}});let b={tui:Q.success,webui:Q.info,repl:Q.warning};for(let t of v){let r=o.positions.get(t.id)??{x:600,y:370},s=r.x,l=r.y,u=b[t.type],d=t.status===`active`;if(n.push({id:t.id,type:t.type,position:{x:s,y:l},data:{label:t.label,sublabel:t.sublabel,kind:t.type,status:t.status,sessionId:t.sessionId,pid:t.pid,branch:t.branch,workingDir:t.workingDir,startedAt:t.startedAt,agentCount:t.agents.length,color:u}}),i.push({id:`${t.id}->coordinator`,source:t.id,target:`coordinator`,type:`wire`,animated:d,data:{color:u,animated:d,label:e(`activity:office.controlLabel`),flowType:`task`}}),i.push({id:`mailbox->${t.id}`,source:`mailbox`,target:t.id,type:`wire`,animated:c>0,data:{color:Q.warning,animated:c>0,label:c>0?`${c}`:void 0,flowType:`mail`}}),t.agents.length===0){n.push({id:`desk-${t.id}`,type:`desk`,position:{x:s,y:l+270},data:{label:e(`activity:office.idleDesk`),kind:`agent`,status:`idle`,color:Q.muted}});continue}t.agents.forEach((r,o)=>{let c=r.status===`active`||r.status===`streaming`,u=fe.current.get(r.serverId);if(u&&(r.toolCalls>u.toolCalls||r.iteration>u.iteration)||c){I.current.set(r.officeId,a+ue);let e=R.current.get(r.officeId)??0;R.current.set(r.officeId,Math.min(1,e+(1-e)*.5));for(let e of[`${t.id}->${r.officeId}`,`${t.id}->coordinator`]){let t=L.current.get(e)??0;L.current.set(e,Math.min(1,t+.5))}}fe.current.set(r.serverId,{toolCalls:r.toolCalls,iteration:r.iteration}),n.push({id:r.officeId,type:`agent`,position:tr(s,o,t.agents.length,l+270),data:{label:r.name,kind:`agent`,status:r.status,serverId:r.serverId,sessionId:t.sessionId,currentTask:r.currentTask,iteration:r.iteration,toolCalls:r.toolCalls,costUsd:r.costUsd,tokensIn:r.tokensIn,tokensOut:r.tokensOut,ctxPct:r.ctxPct,model:r.model,lastActivityAt:r.lastActivityAt,color:Q.primary}}),i.push({id:`${t.id}->${r.officeId}`,source:t.id,target:r.officeId,type:`wire`,animated:c,data:{color:Q.primary,animated:c,label:c?qn(r.currentTask,48)??e(`activity:office.taskFallback`):void 0,flowType:`task`}})})}let x=new Set(v.flatMap(e=>e.agents.map(e=>e.serverId)));for(let e of[...fe.current.keys()])x.has(e)||fe.current.delete(e);for(let[e,t]of[...I.current])t<=a&&I.current.delete(e);let S=n.map(e=>{let t=I.current.get(e.id),n=R.current.get(e.id)??0;return t&&t>a&&e.data.status!==`error`&&e.data.status!==`offline`?{...e,data:{...e.data,status:`active`,vizActivity:n}}:{...e,data:{...e.data,vizActivity:n}}}),C=i.map(e=>{let t=L.current.get(e.id)??0;return t>.05?{...e,animated:!0,data:{...e.data,animated:!0,intensity:t}}:e}),w=new Map;for(let e of S)w.set(e.id,{...e.position});de.current=w,D(S),A(C);let T=[`${Math.round(r.width)}x${Math.round(r.height)}`,`${o.columns}x${o.rows}`,v.map(e=>`${e.id}:${e.agents.length}`).join(`|`),S.map(e=>e.id).sort().join(`|`)].join(`:`);if(T!==pe.current){pe.current=T;let e=setTimeout(()=>t({padding:Sr,duration:300}),50);return()=>clearTimeout(e)}},[v,f,s,m,g,r,ue,D,A,t]);let me=(0,G.useMemo)(()=>{let e=v.flatMap(e=>e.agents.map(t=>({clientId:e.id,clientType:e.type,officeId:t.officeId,serverId:t.serverId}))),t=new Map;for(let n of e)(!t.has(n.serverId)||n.clientType===`webui`)&&t.set(n.serverId,n.officeId);return{renderedAgents:e,serverIdToOffice:t,clientIds:v.map(e=>e.id)}},[v]),he=(0,G.useCallback)(e=>{let t=e=>me.serverIdToOffice.get(e)??`agent-${e}`;switch(e.kind){case`mailbox:send`:case`mailbox:deliver`:return{nodes:[`mailbox`],edges:e.kind===`mailbox:send`?me.clientIds.map(e=>`mailbox->${e}`):[],status:`active`};case`agent:spawned`:{let n=t(e.source);return{nodes:[`coordinator`,n],edges:[Wr(n)],status:`active`}}case`agent:tool`:case`tool:started`:case`tool:progress`:{let n=t(e.source);return{nodes:[`coordinator`,n],edges:[Wr(n)],status:e.kind===`tool:progress`||e.kind===`tool:started`?`streaming`:`active`}}case`tool:executed`:{let n=t(e.target??e.source);return{nodes:[n],edges:[Wr(n)],status:`active`}}case`provider:call`:case`provider:delta`:case`provider:response`:return{nodes:[`coordinator`],edges:[],status:e.kind===`provider:delta`?`streaming`:`active`};case`iteration:start`:case`iteration:end`:return{nodes:[`coordinator`],edges:me.renderedAgents.map(e=>Wr(e.officeId)),status:e.kind===`iteration:start`?`streaming`:`active`};case`agent:text`:{let n=t(e.source);return{nodes:[n],edges:[Wr(n)],status:`streaming`}}case`agent:status`:{let n=t(e.source);return{nodes:[`coordinator`,n],edges:[Wr(n)],status:e.data&&typeof e.data==`object`&&`status`in e.data&&String(e.data.status)===`failed`?`error`:`completed`}}case`agent:ctx`:return{nodes:[t(e.source)],edges:[],status:`active`};case`budget:extended`:return{nodes:[`coordinator`,t(e.source)],edges:[],status:`active`};case`context:compacted`:case`context:repaired`:return{nodes:[`coordinator`],edges:[],status:`active`};case`error`:return{nodes:e.source?[t(e.source)]:[],edges:[],status:`error`};case`cost:update`:return{nodes:[`coordinator`],edges:[],status:`active`};case`fleet:snapshot`:{let n=e.data?.sessions??[],r=[`coordinator`];for(let e of n)if(e.agents)for(let n of e.agents){let e=t(n.id);r.includes(e)||r.push(e)}return{nodes:r,edges:[],status:`active`}}default:return{nodes:[],edges:[],status:`idle`}}},[me]),ge=(0,G.useRef)(null),z=(0,G.useRef)(!1);(0,G.useEffect)(()=>{if(o.length===0)return;if(!z.current){z.current=!0,ge.current=o[0]?.id??null;return}let e=ge.current;ge.current=o[0]?.id??null;let t=e?o.findIndex(t=>t.id===e):-1;if(t===0)return;let n=t===-1?o.length:t,r=Date.now(),i=new Map,a=new Set;for(let e=n-1;e>=0;e--){let t=o[e];if(!t)continue;let{nodes:n,edges:s,status:c}=he(t);for(let e of n){I.current.set(e,r+ue);let t=R.current.get(e)??0;R.current.set(e,Math.min(1,t+(1-t)*.5)),i.set(e,c)}for(let e of s){let t=L.current.get(e)??0;L.current.set(e,Math.min(1,t+.5)),a.add(e)}}i.size>0&&D(e=>e.map(e=>{let t=i.get(e.id);return t===void 0?e:{...e,data:{...e.data,status:t,vizActivity:R.current.get(e.id)??0}}})),a.size>0&&A(e=>e.map(e=>a.has(e.id)?{...e,animated:!0,data:{...e.data,animated:!0,intensity:L.current.get(e.id)??1}}:e))},[o,he,D,A,ue]),(0,G.useEffect)(()=>{let e=setInterval(()=>{let e=new Map,t=!1;for(let[n,r]of L.current){let i=r*.85;i<.05?(L.current.delete(n),e.set(n,{intensity:0,animated:!1}),t=!0):(L.current.set(n,i),e.set(n,{intensity:i,animated:!0}),t=!0)}t&&A(t=>t.map(t=>{let n=e.get(t.id);return n?{...t,animated:n.animated,data:{...t.data,animated:n.animated,intensity:n.intensity}}:t}));let n=new Map,r=!1;for(let[e,t]of R.current){let i=t*.9;i<.03?(R.current.delete(e),n.set(e,0),r=!0):(R.current.set(e,i),n.set(e,i),r=!0)}r&&D(e=>e.map(e=>{let t=n.get(e.id);return t===void 0?e:{...e,data:{...e.data,vizActivity:t}}}))},1e3);return()=>clearInterval(e)},[A,D]);let _e=(0,G.useCallback)(e=>A(t=>He({...e,type:`wire`},t)),[A]),B=(0,G.useCallback)((e,t)=>{ee(t)},[]),ve=(0,G.useCallback)(()=>{ee(null)},[]);(0,G.useEffect)(()=>{if(!N)return;let e=e=>{e.key===`Escape`&&P(null)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[N]);let ye=(0,G.useCallback)(()=>{D(e=>e.map(e=>{let t=de.current.get(e.id);return t?{...e,position:{...t}}:e})),setTimeout(()=>t({padding:Sr,duration:300}),50)},[D,t]),[,be]=(0,G.useState)(0);return(0,G.useEffect)(()=>{let e=setInterval(()=>{document.hidden||be(e=>e+1)},2e3);return()=>clearInterval(e)},[]),(0,K.jsxs)(`div`,{ref:n,className:`relative h-full w-full overflow-hidden bg-[hsl(var(--surface-2)/0.55)]`,children:[(0,K.jsx)(`div`,{className:`absolute inset-0 opacity-[0.03]`,style:{backgroundImage:`
10
+ linear-gradient(hsl(var(--foreground) / 0.1) 1px, transparent 1px),
11
+ linear-gradient(90deg, hsl(var(--foreground) / 0.1) 1px, transparent 1px)
12
+ `,backgroundSize:`40px 40px`}}),y&&(0,K.jsx)(zr,{}),(0,K.jsx)(`div`,{className:`absolute top-3 left-1/2 -translate-x-1/2 z-10`,children:(0,K.jsx)(`div`,{className:`rounded-lg border border-border/70 bg-card/90 px-4 py-2 shadow-xl backdrop-blur`,children:(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-bold text-foreground`,children:[(0,K.jsx)(Pe,{className:`h-4 w-4 text-primary`}),e(`activity:office.fleetHq`),(0,K.jsx)(`span`,{className:`ml-2 h-2 w-2 animate-pulse rounded-full bg-success`}),(0,K.jsx)(`span`,{className:`text-[10px] font-normal text-muted-foreground`,children:e(`activity:office.live`)})]})})}),b&&(0,K.jsx)(Vr,{}),(0,K.jsxs)(Ye,{nodes:E,edges:k,onNodesChange:O,onEdgesChange:j,onConnect:_e,onNodeClick:B,onPaneClick:ve,nodeTypes:Pr,edgeTypes:Rr,fitView:!0,fitViewOptions:{padding:Sr},minZoom:.15,maxZoom:1.5,defaultEdgeOptions:{type:`wire`},proOptions:{hideAttribution:!0},children:[(0,K.jsx)(Fr,{broadcastOpen:F,labels:{arrange:e(`activity:office.arrange`),arrangeTitle:e(`activity:office.arrangeTitle`),broadcast:e(`activity:office.broadcast`),broadcastTitle:e(`activity:office.broadcastTitle`),feed:e(`activity:office.feed`),feedTitle:e(`activity:office.feedTitle`)},onArrange:ye,onBroadcastToggle:()=>te(e=>!e),onFeedToggle:()=>w(!C),showFeed:C}),T!==`none`&&(0,K.jsx)(Je,{variant:T===`lines`?Ue.Lines:T===`cross`?Ue.Cross:Ue.Dots,gap:20,size:1,color:`hsl(var(--border) / 0.35)`}),S&&(0,K.jsx)(Ke,{className:`rounded-lg border border-border/70 bg-card/90 [&>button]:bg-card [&>button]:text-foreground`}),x&&(0,K.jsx)(Ir,{})]}),C&&(0,K.jsx)(Br,{events:o,now:Date.now()}),F&&(0,K.jsx)(Hr,{draft:ne,isSending:ie,result:oe,onClose:()=>te(!1),onDraftChange:re,onSend:()=>void le()}),M&&(0,K.jsx)(Ur,{selectedNode:M,selectedAgentTranscript:ce,mailboxMessages:m,onClose:ve,onOpenWatch:P}),N&&(0,K.jsx)(Lr,{closeTitle:e(`activity:office.closeEsc`),label:N.label,onClose:()=>P(null),sessionId:N.sessionId,streamTitle:e(`activity:office.fullOperationStream`)})]})}function Kr(){let{t:e}=V(),t=U(e=>e.viewMode),n=U(e=>e.setViewMode),r=[{id:`office`,label:e(`activity:agentOffice.office`),description:e(`activity:agentOffice.officeDescription`),icon:fe},{id:`topology`,label:e(`activity:agentOffice.topology`),description:e(`activity:agentOffice.topologyDescription`),icon:Oe}],i=(e,t)=>{let i;if(e.key===`ArrowLeft`&&(i=(t-1+r.length)%r.length),e.key===`ArrowRight`&&(i=(t+1)%r.length),e.key===`Home`&&(i=0),e.key===`End`&&(i=r.length-1),i===void 0)return;e.preventDefault();let a=r[i];a&&(n(a.id),e.currentTarget.parentElement?.querySelectorAll(`[role="tab"]`)[i]?.focus())};return(0,K.jsxs)(`div`,{className:`flex h-full min-h-0 w-full flex-col bg-background`,children:[(0,K.jsx)(`nav`,{"aria-label":`${e(`activity:agentOffice.office`)} / ${e(`activity:agentOffice.topology`)}`,className:`relative z-[60] shrink-0 border-b border-border bg-card/95 px-3 pt-2 shadow-[0_8px_28px_hsl(var(--shadow-color)/0.1)] backdrop-blur-xl sm:px-5`,children:(0,K.jsx)(`div`,{role:`tablist`,"aria-orientation":`horizontal`,className:`mx-auto grid w-full max-w-3xl grid-cols-2 gap-1`,children:r.map((e,r)=>{let a=e.icon,o=t===e.id;return(0,K.jsxs)(`button`,{id:`office-map-tab-${e.id}`,type:`button`,role:`tab`,"aria-selected":o,"aria-controls":`office-map-view-panel`,tabIndex:o?0:-1,onClick:()=>n(e.id),onKeyDown:e=>i(e,r),className:H(`group relative flex min-w-0 items-center gap-2.5 border-b-2 px-3 py-2.5 text-left transition-all duration-200 sm:gap-3 sm:px-5`,o?`border-primary bg-primary/[0.07] text-foreground`:`border-transparent text-muted-foreground hover:border-border hover:bg-accent/60 hover:text-foreground`),children:[(0,K.jsx)(`span`,{className:H(`grid h-8 w-8 shrink-0 place-items-center rounded-lg border transition-colors`,o?`border-primary/35 bg-primary/15 text-primary`:`border-border bg-background/70 text-muted-foreground group-hover:text-foreground`),children:(0,K.jsx)(a,{className:`h-4 w-4`,"aria-hidden":`true`})}),(0,K.jsxs)(`span`,{className:`min-w-0`,children:[(0,K.jsx)(`strong`,{className:`block truncate font-display text-xs font-semibold sm:text-sm`,children:e.label}),(0,K.jsx)(`small`,{className:`hidden truncate font-mono text-[9px] font-normal text-muted-foreground sm:block`,children:e.description})]}),(0,K.jsx)(`span`,{"aria-hidden":`true`,className:H(`ml-auto h-1.5 w-1.5 shrink-0 rounded-full transition-all`,o?`bg-primary shadow-[0_0_0_4px_hsl(var(--primary)/0.12)]`:`bg-border`)})]},e.id)})})}),(0,K.jsx)(`div`,{id:`office-map-view-panel`,role:`tabpanel`,"aria-labelledby":`office-map-tab-${t}`,className:`relative min-h-0 flex-1`,children:t===`office`?(0,K.jsx)(mr,{}):(0,K.jsx)(Ie,{children:(0,K.jsx)(Gr,{})})})]})}function qr({label:e,checked:t,onChange:n}){return(0,K.jsxs)(`button`,{type:`button`,onClick:()=>n(!t),className:`flex w-full items-center justify-between px-2 py-1.5 rounded text-xs hover:bg-accent/50 transition-colors`,children:[(0,K.jsx)(`span`,{className:`text-foreground`,children:e}),(0,K.jsx)(`span`,{className:H(`relative inline-flex h-4 w-7 shrink-0 items-center rounded-full transition-colors`,t?`bg-primary`:`bg-muted`),children:(0,K.jsx)(`span`,{className:H(`inline-block h-3 w-3 transform rounded-full bg-background transition-transform`,t?`translate-x-3.5`:`translate-x-0.5`)})})]})}var Jr=[{value:`dots`,labelKey:`bgDots`},{value:`lines`,labelKey:`bgLines`},{value:`cross`,labelKey:`bgCross`},{value:`none`,labelKey:`bgNone`}];function Yr(){let{t:e}=V(),{showHud:t,showLegend:n,showMinimap:r,showControls:i,animateEdges:a,background:o,waitThresholdMs:s,setShowHud:c,setShowLegend:l,setShowMinimap:u,setShowControls:d,setAnimateEdges:f,setBackground:p,setWaitThresholdMs:m}=U(ge(e=>({showHud:e.showHud,showLegend:e.showLegend,showMinimap:e.showMinimap,showControls:e.showControls,animateEdges:e.animateEdges,background:e.background,waitThresholdMs:e.waitThresholdMs,setShowHud:e.setShowHud,setShowLegend:e.setShowLegend,setShowMinimap:e.setShowMinimap,setShowControls:e.setShowControls,setAnimateEdges:e.setAnimateEdges,setBackground:e.setBackground,setWaitThresholdMs:e.setWaitThresholdMs}))),{clientCounts:g,currentSession:_,totalAgents:v,activeAgents:y}=$e(ge(e=>({clientCounts:e.clientCounts,currentSession:e.currentSession,totalAgents:e.totalAgents,activeAgents:e.activeAgents}))),b=g.tui+g.webui+g.repl;return(0,K.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col gap-4 overflow-y-auto overscroll-contain p-3`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-2`,children:e(`activity:officeMap.liveHeading`)}),(0,K.jsxs)(`div`,{className:`space-y-1.5 text-xs`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,K.jsxs)(`span`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,K.jsx)(h,{className:`h-3.5 w-3.5`}),` `,e(`activity:officeMap.clients`)]}),(0,K.jsx)(`span`,{className:`font-mono`,children:b})]}),(0,K.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,K.jsxs)(`span`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,K.jsx)(O,{className:`h-3.5 w-3.5`}),` `,e(`activity:officeMap.agents`)]}),(0,K.jsxs)(`span`,{className:`font-mono`,children:[y,(0,K.jsxs)(`span`,{className:`text-muted-foreground`,children:[` / `,v]})]})]}),_.model&&(0,K.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,K.jsxs)(`span`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,K.jsx)(te,{className:`h-3.5 w-3.5`}),` `,e(`activity:officeMap.model`)]}),(0,K.jsx)(`span`,{className:`font-mono truncate max-w-[140px]`,title:_.model,children:_.model.split(`/`).pop()})]}),_.mode&&(0,K.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,K.jsxs)(`span`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,K.jsx)(B,{className:`h-3.5 w-3.5`}),` `,e(`activity:officeMap.mode`)]}),(0,K.jsx)(`span`,{className:`font-mono uppercase text-xs`,children:_.mode})]}),(0,K.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,K.jsxs)(`span`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,K.jsx)(z,{className:`h-3.5 w-3.5`}),` `,e(`activity:officeMap.toolCalls`)]}),(0,K.jsx)(`span`,{className:`font-mono`,children:(e=>e?.toLocaleString()??`0`)(_.toolCalls)})]})]})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1`,children:e(`activity:officeMap.displayHeading`)}),(0,K.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,K.jsx)(qr,{label:e(`activity:officeMap.statsHud`),checked:t,onChange:c}),(0,K.jsx)(qr,{label:e(`activity:officeMap.legends`),checked:n,onChange:l}),(0,K.jsx)(qr,{label:e(`activity:officeMap.minimap`),checked:r,onChange:u}),(0,K.jsx)(qr,{label:e(`activity:officeMap.zoomControls`),checked:i,onChange:d}),(0,K.jsx)(qr,{label:e(`activity:officeMap.animateWires`),checked:a,onChange:f})]})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1.5 px-2`,children:e(`activity:officeMap.backgroundHeading`)}),(0,K.jsx)(`div`,{className:`flex flex-wrap gap-1 px-2`,children:Jr.map(t=>(0,K.jsx)(`button`,{type:`button`,onClick:()=>p(t.value),className:H(`px-2 py-1 text-xs rounded transition-colors`,o===t.value?`bg-primary text-primary-foreground`:`bg-muted text-muted-foreground hover:bg-accent`),children:e(`activity:officeMap.${t.labelKey}`)},t.value))})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5 mb-1.5 px-2 text-xs font-semibold text-muted-foreground uppercase tracking-wide`,children:[(0,K.jsx)(R,{className:`h-3 w-3`}),e(`activity:officeMap.waitThresholdHeading`)]}),(0,K.jsx)(`p`,{className:`mb-1.5 px-2 text-[11px] text-muted-foreground`,children:e(`activity:officeMap.waitThresholdHint`)}),(0,K.jsx)(`div`,{className:`flex flex-wrap gap-1 px-2`,children:Qe.map(e=>(0,K.jsx)(`button`,{type:`button`,onClick:()=>m(e),className:H(`px-2 py-1 text-xs rounded transition-colors font-mono`,s===e?`bg-primary text-primary-foreground`:`bg-muted text-muted-foreground hover:bg-accent`),children:Xr(e)},e))})]})]})}function Xr(e){let t=e/1e3;return t%60==0&&t>=60?`${t/60}m`:`${t}s`}function Zr(){let[e,t]=(0,G.useState)([]),[r,i]=(0,G.useState)(Ct),[a,o]=(0,G.useState)(!1),[s,c]=(0,G.useState)(null),l=(0,G.useCallback)(async()=>{o(!0),c(null);try{let e=await W(`agent-roster.list`,{});e.stats&&t(e.stats),e.catalog?.length&&i(e.catalog)}catch(e){c(e instanceof Error?e.message:`Failed to load roster`)}o(!1)},[]);return(0,G.useEffect)(()=>{l()},[l]),(0,G.useEffect)(()=>{let e=null,t=n().on(`agent-roster.updated`,()=>{e&&clearTimeout(e),e=setTimeout(()=>{e=null,l()},300)});return()=>{e&&clearTimeout(e),t()}},[l]),{customStats:e,catalog:r,rosterLoading:a,rosterError:s,loadRoster:l}}function Qr({customStats:e,catalog:t,onRefresh:r}){let{t:i}=V(),[a,o]=(0,G.useState)(null),[s,c]=(0,G.useState)(null),[l,u]=(0,G.useState)(``),[d,f]=(0,G.useState)(null),[p,m]=(0,G.useState)(!1),[h,g]=(0,G.useState)(null),[v,y]=(0,G.useState)(!1),[b,x]=(0,G.useState)({name:``,role:``,baseRole:`generic`,purpose:``,taskTypes:``}),S=(0,G.useMemo)(()=>a?e.find(e=>e.role===a):null,[a,e]),C=(0,G.useMemo)(()=>{let e=t.find(e=>e.role===a);return e?.systemProtected??!e?.custom},[t,a]),w=(0,G.useCallback)(async(e,t)=>{m(!0),g(null),o(e);try{let n=await W(`agent-roster.read-customization`,{role:e});u(t===`config`?`${JSON.stringify(n.config??{},null,2)}\n`:n[t]??``),c(t),f(null)}catch(e){g(e instanceof Error?e.message:i(`activity:agentRoster.loadCustomizationFailed`))}finally{m(!1)}},[]),T=(0,G.useCallback)(async e=>{m(!0),g(null),o(e);try{let t=await W(`agent-roster.read-customization`,{role:e});f(t.config??{}),c(null)}catch(e){g(e instanceof Error?e.message:i(`activity:agentRoster.loadRuntimePolicyFailed`))}finally{m(!1)}},[]),E=(0,G.useCallback)(async e=>{if(a){m(!0),g(null);try{await W(`agent-roster.update-config`,{role:a,config:e}),f(null),r()}catch(e){g(e instanceof Error?e.message:i(`activity:agentRoster.runtimePolicySaveFailed`))}finally{m(!1)}}},[r,a]),D=(0,G.useCallback)(async()=>{if(a&&s){m(!0);try{let e={identity:`agent-roster.update-identity`,learned:`agent-roster.update-learned`,config:`agent-roster.update-config`},t={role:a};if(s===`config`)try{t.config=JSON.parse(l)}catch{g(`config.json must contain valid JSON`),m(!1);return}else t.content=l;await W(e[s],t),c(null),g(null),r()}catch(e){g(e instanceof Error?e.message:i(`activity:agentRoster.saveFailed`))}m(!1)}},[a,s,l,r]),O=(0,G.useCallback)(async()=>{if(a)try{let e=await W(`agent-roster.llm-improve`,{role:a,prompt:`Improve this agent for optimal project performance`});if(!e.instruction)throw Error(`No improvement instruction generated`);let t=et.getState();t.addMessage({role:`user`,content:e.instruction}),t.setLoading(!0),n().sendMessage(e.instruction);let r=Ze.getState();r.setSidebarOpen(!1),r.setCurrentView(`chat`)}catch(e){g(e instanceof Error?e.message:i(`activity:agentRoster.llmImprovementFailed`))}},[a]),k=(0,G.useCallback)(async e=>{if(window.confirm(i(`activity:agentRoster.resetConfirm`,{role:e})))try{await W(`agent-roster.reset`,{role:e}),o(null),r()}catch{}},[r]),A=(0,G.useCallback)(async()=>{let e=b.taskTypes.split(/[\n,]+/).map(e=>e.trim()).filter(Boolean);m(!0),g(null);try{let t=await W(`agent-roster.create`,{name:b.name,role:b.role,baseRole:b.baseRole,purpose:b.purpose,taskTypes:e});y(!1),x({name:``,role:``,baseRole:`generic`,purpose:``,taskTypes:``}),o(t.role),r()}catch(e){g(e instanceof Error?e.message:i(`activity:agentRoster.agentCreationFailed`))}finally{m(!1)}},[b,r]),j=(0,G.useMemo)(()=>[...e].sort((e,t)=>{let n=+!!e.hasIdentity+ +(e.entryCount>0)+ +!!e.hasConfig;return+!!t.hasIdentity+ +(t.entryCount>0)+ +!!t.hasConfig-n}),[e]);return(0,K.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:[(0,K.jsxs)(`div`,{className:`w-80 shrink-0 border-r border-border/50 flex flex-col overflow-hidden`,children:[(0,K.jsx)(`div`,{className:`shrink-0 border-b border-border/50 px-3 py-2`,children:(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,K.jsxs)(`h3`,{className:`flex items-center gap-1.5 text-xs font-semibold`,children:[(0,K.jsx)(_,{className:`h-3.5 w-3.5`}),i(`activity:agentRoster.projectAgents`)]}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>{y(!0),o(null),f(null),g(null)},className:`rounded border border-primary/40 px-1.5 py-1 text-[9px] text-primary hover:bg-primary/10`,children:i(`activity:agentRoster.clone`)})]})}),(0,K.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-2 space-y-1`,children:[j.map(e=>(0,K.jsxs)(`button`,{type:`button`,onClick:()=>{o(e.role),f(null),c(null)},className:H(`w-full text-left rounded-lg border px-3 py-2 transition-colors`,a===e.role?`border-primary/50 bg-primary/[0.06]`:`border-border/60 hover:border-primary/30`),children:[(0,K.jsx)(`div`,{className:`text-xs font-semibold`,children:e.role}),(0,K.jsxs)(`div`,{className:`flex gap-2 mt-0.5 text-[9px] text-muted-foreground`,children:[e.hasIdentity&&(0,K.jsx)(`span`,{className:`text-primary`,children:`id`}),e.entryCount>0&&(0,K.jsxs)(`span`,{className:`text-brand-2`,children:[e.entryCount,`e`]}),e.hasConfig&&(0,K.jsx)(`span`,{children:`cfg`})]})]},e.role)),j.length===0&&(0,K.jsx)(`div`,{className:`text-[10px] text-muted-foreground text-center py-4`,children:i(`activity:agentRoster.noCustomizations`)})]})]}),(0,K.jsxs)(`div`,{className:`flex-1 min-h-0 min-w-0 overflow-y-auto p-4`,children:[v&&(0,K.jsxs)(`div`,{className:`max-w-2xl space-y-4`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`h3`,{className:`text-base font-semibold`,children:i(`activity:agentRoster.createOrCloneTitle`)}),(0,K.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:i(`activity:agentRoster.createOrCloneHint`)})]}),(0,K.jsxs)(`label`,{className:`block space-y-1 text-xs`,children:[(0,K.jsx)(`span`,{className:`font-medium`,children:i(`activity:agentRoster.cloneFromRole`)}),(0,K.jsx)(`select`,{value:b.baseRole,onChange:e=>x(t=>({...t,baseRole:e.target.value})),className:`h-9 w-full rounded border border-border bg-card px-2`,children:[...t].sort((e,t)=>e.name.localeCompare(t.name)).map(e=>(0,K.jsxs)(`option`,{value:e.role,children:[e.name,` (`,e.role,`)`]},e.role))}),(0,K.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:i(`activity:agentRoster.cloneHint`)})]}),(0,K.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,K.jsxs)(`label`,{className:`space-y-1 text-xs`,children:[(0,K.jsx)(`span`,{className:`font-medium`,children:i(`activity:agentRoster.displayName`)}),(0,K.jsx)(`input`,{value:b.name,onChange:e=>x(t=>({...t,name:e.target.value})),placeholder:i(`activity:agentRoster.abc`),className:`h-9 w-full rounded border border-border bg-card px-2`})]}),(0,K.jsxs)(`label`,{className:`space-y-1 text-xs`,children:[(0,K.jsx)(`span`,{className:`font-medium`,children:i(`activity:agentRoster.roleIdOptional`)}),(0,K.jsx)(`input`,{value:b.role,onChange:e=>x(t=>({...t,role:e.target.value})),placeholder:i(`activity:agentRoster.abcGeneratedFromName`),className:`h-9 w-full rounded border border-border bg-card px-2 font-mono`})]})]}),(0,K.jsxs)(`label`,{className:`block space-y-1 text-xs`,children:[(0,K.jsx)(`span`,{className:`font-medium`,children:i(`activity:agentRoster.purpose`)}),(0,K.jsx)(`textarea`,{value:b.purpose,onChange:e=>x(t=>({...t,purpose:e.target.value})),placeholder:i(`activity:agentRoster.descriptionPlaceholder`),className:`h-24 w-full resize-y rounded border border-border bg-card p-2`})]}),(0,K.jsxs)(`label`,{className:`block space-y-1 text-xs`,children:[(0,K.jsx)(`span`,{className:`font-medium`,children:i(`activity:agentRoster.taskTypesCommaOrOnePer`)}),(0,K.jsx)(`textarea`,{value:b.taskTypes,onChange:e=>x(t=>({...t,taskTypes:e.target.value})),placeholder:i(`activity:agentRoster.taskTypesPlaceholder`),className:`h-24 w-full resize-y rounded border border-border bg-card p-2`})]}),h&&(0,K.jsx)(`p`,{className:`text-xs text-destructive`,children:h}),(0,K.jsxs)(`div`,{className:`flex gap-2`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:A,disabled:p||!b.name.trim()||b.purpose.trim().length<10||!b.taskTypes.trim(),className:`rounded bg-primary px-3 py-1.5 text-xs text-primary-foreground disabled:opacity-50`,children:p?i(`activity:agentRoster.creating`):`Clone Agent`}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>y(!1),className:`rounded border border-border px-3 py-1.5 text-xs hover:bg-accent`,children:i(`activity:agentRoster.cancel`)})]})]}),!v&&!a&&(0,K.jsx)(`div`,{className:`flex items-center justify-center h-full text-muted-foreground`,children:i(`activity:agentRoster.selectAnAgentToEditCustomizations`)}),!v&&a&&S&&(0,K.jsxs)(`div`,{className:`space-y-4 max-w-2xl`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,K.jsx)(`h3`,{className:`text-base font-semibold`,children:a}),(0,K.jsxs)(`div`,{className:`flex gap-1`,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:O,className:`inline-flex items-center gap-1 rounded border border-border/50 px-2 py-1 text-[10px] hover:bg-accent transition-colors`,children:[(0,K.jsx)(pe,{className:`h-3 w-3 text-brand-2`}),` `,i(`activity:agentRoster.llmImprove`)]}),(0,K.jsxs)(`button`,{type:`button`,onClick:()=>k(a),className:`inline-flex items-center gap-1 rounded border border-destructive/30 px-2 py-1 text-[10px] text-destructive hover:bg-destructive/10 transition-colors`,children:[(0,K.jsx)(ne,{className:`h-3 w-3`}),` `,i(`activity:agentRoster.reset`)]})]})]}),(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[S.hasIdentity&&(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded bg-primary/10 px-2 py-1 text-[10px] text-primary`,children:[(0,K.jsx)(ie,{className:`h-3 w-3`}),` identity.md`]}),S.hasConfig&&(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded bg-muted px-2 py-1 text-[10px] text-muted-foreground`,children:[(0,K.jsx)(_,{className:`h-3 w-3`}),` config.json`]}),S.hasKnowledge&&(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded bg-muted px-2 py-1 text-[10px] text-muted-foreground`,children:[(0,K.jsx)(le,{className:`h-3 w-3`}),` knowledge.json`]}),S.entryCount>0&&(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded bg-brand-2/10 px-2 py-1 text-[10px] text-brand-2`,children:[(0,K.jsx)(Ce,{className:`h-3 w-3`}),` `,S.entryCount,` learned entries`]})]}),(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:()=>w(a,`identity`),className:`inline-flex items-center gap-1 rounded border border-border/50 px-3 py-1.5 text-xs hover:bg-accent transition-colors`,children:[(0,K.jsx)(ie,{className:`h-3.5 w-3.5`}),` `,i(`activity:agentRoster.editIdentityMd`)]}),(0,K.jsxs)(`button`,{type:`button`,onClick:()=>w(a,`learned`),className:`inline-flex items-center gap-1 rounded border border-border/50 px-3 py-1.5 text-xs hover:bg-accent transition-colors`,children:[(0,K.jsx)(Ce,{className:`h-3.5 w-3.5`}),` `,i(`activity:agentRoster.editLearnedMd`)]}),(0,K.jsxs)(`button`,{type:`button`,onClick:()=>T(a),className:`inline-flex items-center gap-1 rounded border border-primary/40 bg-primary/5 px-3 py-1.5 text-xs text-primary hover:bg-primary/10 transition-colors`,children:[(0,K.jsx)(Ne,{className:`h-3.5 w-3.5`}),` `,i(`activity:agentRoster.runtimePolicy`)]}),(0,K.jsxs)(`button`,{type:`button`,onClick:()=>w(a,`config`),className:`inline-flex items-center gap-1 rounded border border-border/50 px-3 py-1.5 text-xs hover:bg-accent transition-colors`,children:[(0,K.jsx)(_,{className:`h-3.5 w-3.5`}),` `,i(`activity:agentRoster.editConfigJson`)]})]}),h&&(0,K.jsx)(`p`,{className:`text-xs text-destructive`,children:h}),d&&(0,K.jsx)(bt,{initialConfig:d,systemProtected:C,saving:p,onSave:E,onCancel:()=>f(null)},a),s&&(0,K.jsxs)(`div`,{className:`space-y-2`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,K.jsxs)(`span`,{className:`text-xs font-medium`,children:[s,`.md / `,s,`.json`]}),(0,K.jsxs)(`div`,{className:`flex gap-1`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:D,disabled:p,className:`inline-flex items-center gap-1 rounded bg-primary px-3 py-1.5 text-xs text-primary-foreground hover:bg-primary/90 transition-colors disabled:opacity-50`,children:i(p?`activity:agentRoster.saving`:`common:action.save`)}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>c(null),className:`inline-flex items-center gap-1 rounded border border-border/50 px-3 py-1.5 text-xs hover:bg-accent transition-colors`,children:i(`activity:agentRoster.cancel`)})]})]}),(0,K.jsx)(`textarea`,{className:`w-full h-48 font-mono text-xs p-2 bg-card border border-border rounded resize-y`,value:l,onChange:e=>u(e.target.value),placeholder:s===`config`?`{ "tools": [...], "budget": {...} }`:`# Project identity for ${a}\n\nDescribe this agent's role…`})]})]})]})]})}function $r({className:e,initialTab:t=`live`}){let{t:n}=V(),r=Ze(e=>e.agentRosterActiveTab),i=Ze(e=>e.setAgentRosterActiveTab),[a,o]=(0,G.useState)(t),s=r??a,c=(0,G.useCallback)(e=>{o(e),typeof i==`function`&&i(e)},[i]),[l,u]=(0,G.useState)(Date.now()),{customStats:d,catalog:f,rosterLoading:p,rosterError:m,loadRoster:h}=Zr();return(0,G.useEffect)(()=>{let e=setInterval(()=>{document.hidden||u(Date.now())},2e3);return()=>clearInterval(e)},[]),(0,K.jsxs)(`div`,{className:H(`flex h-full min-h-0 min-w-0 w-full flex-col overflow-hidden`,e),children:[(0,K.jsx)(wt,{customStats:d,rosterLoading:p,onRefresh:h}),(0,K.jsx)(Tt,{activeTab:s,onTabChange:c}),(0,K.jsxs)(`div`,{className:`flex min-h-0 min-w-0 w-full flex-1 overflow-hidden bg-background/50`,children:[m&&(0,K.jsxs)(`div`,{className:`flex items-center justify-center w-full text-destructive text-xs gap-2`,children:[(0,K.jsx)(ue,{className:`h-4 w-4`}),m,(0,K.jsx)(`button`,{type:`button`,onClick:h,className:`underline`,children:n(`activity:agentRoster.retry`)})]}),s===`live`&&(0,K.jsx)(Mt,{nowTick:l}),s===`officemap`&&(0,K.jsxs)(`div`,{className:`flex min-h-0 min-w-0 w-full`,children:[(0,K.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-hidden`,children:(0,K.jsx)(Kr,{})}),(0,K.jsx)(`aside`,{className:`w-60 shrink-0 overflow-y-auto border-l border-border/60`,children:(0,K.jsx)(Yr,{})})]}),s===`catalog`&&(0,K.jsx)(xt,{customStats:d,catalog:f}),s===`learning`&&(0,K.jsx)(Rt,{customStats:d,onRefresh:h}),s===`memory`&&(0,K.jsx)(pt,{}),s===`customize`&&(0,K.jsx)(Qr,{customStats:d,catalog:f,onRefresh:h})]})]})}export{$r as AgentRosterView};