@wrongstack/webui 0.287.0 → 0.289.0

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 (276) hide show
  1. package/dist/App.d.ts.map +1 -1
  2. package/dist/assets/AnalyticsDashboard-qGVC0XiK.js +1 -0
  3. package/dist/assets/AudienceMemoryPanel-CxAGL0gP.js +3 -0
  4. package/dist/assets/ChangesView-Bc6demyA.js +1 -0
  5. package/dist/assets/ChronicleDashboard-CwWcOmB3.js +1 -0
  6. package/dist/assets/CodeEditor-JY7CfGGl.js +1 -0
  7. package/dist/assets/CodeMap-BDgG3Rjz.js +1 -0
  8. package/dist/assets/CronJobsPanel-CqA5Tmx-.js +1 -0
  9. package/dist/assets/DebugDashboard-DlSJuEnl.js +1 -0
  10. package/dist/assets/DesignGalleryView-Cw9pbmsU.js +1 -0
  11. package/dist/assets/GoalView-B9BA9Jlk.js +1 -0
  12. package/dist/assets/KanbanView-CvKWtMXO.js +1 -0
  13. package/dist/assets/MailboxDetailView-dtLgBAb5.js +1 -0
  14. package/dist/assets/MemoryManager-BX9vS8Sc.js +1 -0
  15. package/dist/assets/OfficeMapPanel-D87MJFyb.css +1 -0
  16. package/dist/assets/OfficeMapPanel-DBafq6N3.js +4 -0
  17. package/dist/assets/ProcessMonitor-B0wlr4xu.js +1 -0
  18. package/dist/assets/QueuePanel-Cbd6WEUu.js +1 -0
  19. package/dist/assets/RefreshDebugView-BU6_CzHg.js +1 -0
  20. package/dist/assets/SddBoardView-ChpDmoWH.js +2 -0
  21. package/dist/assets/SddFlowGraph-ZGRYKvG4.js +1 -0
  22. package/dist/assets/SddWizard-C9EU3uMP.js +1 -0
  23. package/dist/assets/SessionsDashboard-BZjGcI8m.js +1 -0
  24. package/dist/assets/SetupScreen-OLD-xwmi.js +1 -0
  25. package/dist/assets/SkillDetailView-cBe0gnN1.js +3 -0
  26. package/dist/assets/SpecsView-BXqQnduk.js +1 -0
  27. package/dist/assets/TechStackView-whP83IaE.js +1 -0
  28. package/dist/assets/TerminalPanel-DYJvz1GK.js +1 -0
  29. package/dist/assets/activity-B6TyDCwd.js +5 -0
  30. package/dist/assets/activity-BZm_Psbt.js +5 -0
  31. package/dist/assets/activity-Bhoxw076.js +5 -0
  32. package/dist/assets/activity-CWFY3Fhi.js +5 -0
  33. package/dist/assets/activity-DVZ7t5as.js +5 -0
  34. package/dist/assets/activity-DiuZra5w.js +5 -0
  35. package/dist/assets/activity-DkwwCy23.js +5 -0
  36. package/dist/assets/chat-store-BJ55HZKb.js +13 -0
  37. package/dist/assets/{commandPalette-C5U6qfth.js → commandPalette-CGMq-qlP.js} +1 -1
  38. package/dist/assets/{commandPalette-C4o2rUOp.js → commandPalette-CUh_kgfp.js} +1 -1
  39. package/dist/assets/{commandPalette-CBJfByB7.js → commandPalette-Dfk74u87.js} +1 -1
  40. package/dist/assets/{commandPalette-DUootORZ.js → commandPalette-DpaemFux.js} +1 -1
  41. package/dist/assets/{commandPalette-BcMV6x3_.js → commandPalette-Nlxs0V7J.js} +1 -1
  42. package/dist/assets/{commandPalette-CrYfIhnW.js → commandPalette-aaAou3Tl.js} +1 -1
  43. package/dist/assets/{commandPalette-Dgd8HfNm.js → commandPalette-tFxIIhvU.js} +1 -1
  44. package/dist/assets/i18n-BcnwAuXt.js +2 -0
  45. package/dist/assets/index-MIiPbE0D.js +151 -0
  46. package/dist/assets/index-dpcVzvHS.css +1 -0
  47. package/dist/assets/markdown-CF2fGOZh.js +44 -0
  48. package/dist/assets/{monaco-MjnRih9i.js → monaco-BgFAljXl.js} +201 -201
  49. package/dist/assets/{monaco-theme-DhdHiZEb.js → monaco-theme-DxkhltWi.js} +1 -1
  50. package/dist/assets/{session-store-zbDVE9MI.js → session-store-CgCoJmdF.js} +1 -1
  51. package/dist/assets/settings-4BR882HN.js +1 -0
  52. package/dist/assets/settings-B5P4V9M6.js +1 -0
  53. package/dist/assets/settings-Cjxo5UVP.js +1 -0
  54. package/dist/assets/settings-CnViO4_M.js +1 -0
  55. package/dist/assets/settings-CyzkAhwD.js +1 -0
  56. package/dist/assets/settings-jrfJX8W2.js +1 -0
  57. package/dist/assets/settings-llUXRsji.js +1 -0
  58. package/dist/assets/shared-aqSRO8IM.js +1 -0
  59. package/dist/assets/ui-store-lBwi9h6q.js +1 -0
  60. package/dist/assets/utils-BLVofF8S.js +1 -0
  61. package/dist/assets/{vendor-BShi5_Dg.css → vendor-BBksTEZc.css} +1 -1
  62. package/dist/assets/vendor-JNPeA-SL.js +76 -0
  63. package/dist/assets/ws-client-3f38Kop2.js +1 -0
  64. package/dist/components/AgentOfficeView.d.ts +3 -0
  65. package/dist/components/AgentOfficeView.d.ts.map +1 -0
  66. package/dist/components/AnalyticsDashboard.d.ts.map +1 -1
  67. package/dist/components/AudienceMemoryPanel.d.ts +2 -0
  68. package/dist/components/AudienceMemoryPanel.d.ts.map +1 -0
  69. package/dist/components/BoardView.d.ts +2 -2
  70. package/dist/components/ChatInput/slash-routing.d.ts +4 -4
  71. package/dist/components/ChatInput/slash-routing.d.ts.map +1 -1
  72. package/dist/components/ChatInput.d.ts.map +1 -1
  73. package/dist/components/CheckpointTimeline.d.ts.map +1 -1
  74. package/dist/components/ChronicleDashboard.d.ts +2 -0
  75. package/dist/components/ChronicleDashboard.d.ts.map +1 -0
  76. package/dist/components/CodeMap.d.ts +9 -0
  77. package/dist/components/CodeMap.d.ts.map +1 -0
  78. package/dist/components/CommandPalette/index.d.ts.map +1 -1
  79. package/dist/components/ContextDashboard.d.ts.map +1 -1
  80. package/dist/components/DebugDashboard.d.ts.map +1 -1
  81. package/dist/components/DesignGalleryView.d.ts.map +1 -1
  82. package/dist/components/FleetPanel.d.ts.map +1 -1
  83. package/dist/components/{AutoPhaseView.d.ts → GoalView.d.ts} +4 -4
  84. package/dist/components/GoalView.d.ts.map +1 -0
  85. package/dist/components/InspectorPanel.d.ts.map +1 -1
  86. package/dist/components/KanbanCleanerAlert.d.ts +6 -0
  87. package/dist/components/KanbanCleanerAlert.d.ts.map +1 -0
  88. package/dist/components/KanbanView.d.ts +14 -0
  89. package/dist/components/KanbanView.d.ts.map +1 -1
  90. package/dist/components/MailboxDetailView.d.ts.map +1 -1
  91. package/dist/components/MailboxPanel.d.ts.map +1 -1
  92. package/dist/components/MemoryManager/MemoryDetail.d.ts +17 -0
  93. package/dist/components/MemoryManager/MemoryDetail.d.ts.map +1 -0
  94. package/dist/components/MemoryManager/MemoryDrawer.d.ts +25 -0
  95. package/dist/components/MemoryManager/MemoryDrawer.d.ts.map +1 -0
  96. package/dist/components/MemoryManager/MemoryEditor.d.ts +12 -0
  97. package/dist/components/MemoryManager/MemoryEditor.d.ts.map +1 -0
  98. package/dist/components/MemoryManager/MemoryFilters.d.ts +19 -0
  99. package/dist/components/MemoryManager/MemoryFilters.d.ts.map +1 -0
  100. package/dist/components/MemoryManager/MemoryGraph.d.ts +4 -35
  101. package/dist/components/MemoryManager/MemoryGraph.d.ts.map +1 -1
  102. package/dist/components/MemoryManager/MemoryList.d.ts +13 -0
  103. package/dist/components/MemoryManager/MemoryList.d.ts.map +1 -0
  104. package/dist/components/MemoryManager/index.d.ts +0 -13
  105. package/dist/components/MemoryManager/index.d.ts.map +1 -1
  106. package/dist/components/MemoryManager/shared.d.ts +51 -0
  107. package/dist/components/MemoryManager/shared.d.ts.map +1 -0
  108. package/dist/components/MessageBubble/index.d.ts.map +1 -1
  109. package/dist/components/OfficeMapCanvas/edges.d.ts +15 -0
  110. package/dist/components/OfficeMapCanvas/edges.d.ts.map +1 -0
  111. package/dist/components/OfficeMapCanvas/nodes.d.ts +53 -0
  112. package/dist/components/OfficeMapCanvas/nodes.d.ts.map +1 -0
  113. package/dist/components/OfficeMapCanvas/resolve.d.ts +17 -2
  114. package/dist/components/OfficeMapCanvas/resolve.d.ts.map +1 -1
  115. package/dist/components/OfficeMapCanvas/utils.d.ts +28 -1
  116. package/dist/components/OfficeMapCanvas/utils.d.ts.map +1 -1
  117. package/dist/components/OfficeMapCanvas.d.ts.map +1 -1
  118. package/dist/components/OfficeMapPanel.d.ts.map +1 -1
  119. package/dist/components/PhasePanel.d.ts.map +1 -1
  120. package/dist/components/RefinePanel.d.ts +5 -1
  121. package/dist/components/RefinePanel.d.ts.map +1 -1
  122. package/dist/components/SddWizard.d.ts.map +1 -1
  123. package/dist/components/SessionsDashboard.d.ts.map +1 -1
  124. package/dist/components/SettingsPanel/ChimeraSettingsPanel.d.ts +10 -0
  125. package/dist/components/SettingsPanel/ChimeraSettingsPanel.d.ts.map +1 -0
  126. package/dist/components/SettingsPanel/index.d.ts.map +1 -1
  127. package/dist/components/SetupScreen.d.ts.map +1 -1
  128. package/dist/components/SidePanel/AgentsPanel.d.ts.map +1 -1
  129. package/dist/components/SidePanel/SessionPanel.d.ts.map +1 -1
  130. package/dist/components/SidePanel/index.d.ts.map +1 -1
  131. package/dist/components/SkillDetailView.d.ts.map +1 -1
  132. package/dist/components/TaskActivityTimeline.d.ts +31 -0
  133. package/dist/components/TaskActivityTimeline.d.ts.map +1 -0
  134. package/dist/components/TaskExecutionAttempts.d.ts +28 -0
  135. package/dist/components/TaskExecutionAttempts.d.ts.map +1 -0
  136. package/dist/components/TaskIntelligencePanel.d.ts +42 -0
  137. package/dist/components/TaskIntelligencePanel.d.ts.map +1 -0
  138. package/dist/components/TaskRiskPanel.d.ts +31 -0
  139. package/dist/components/TaskRiskPanel.d.ts.map +1 -0
  140. package/dist/components/TechStackView/DependencyDetail.d.ts +20 -0
  141. package/dist/components/TechStackView/DependencyDetail.d.ts.map +1 -0
  142. package/dist/components/TechStackView/DependencyTable.d.ts +17 -0
  143. package/dist/components/TechStackView/DependencyTable.d.ts.map +1 -0
  144. package/dist/components/TechStackView/FindingsPanel.d.ts +15 -0
  145. package/dist/components/TechStackView/FindingsPanel.d.ts.map +1 -0
  146. package/dist/components/TechStackView/TechStackToolbar.d.ts +26 -0
  147. package/dist/components/TechStackView/TechStackToolbar.d.ts.map +1 -0
  148. package/dist/components/TechStackView/index.d.ts +18 -0
  149. package/dist/components/TechStackView/index.d.ts.map +1 -0
  150. package/dist/components/TechStackView/shared.d.ts +73 -0
  151. package/dist/components/TechStackView/shared.d.ts.map +1 -0
  152. package/dist/components/TodosPanel.d.ts.map +1 -1
  153. package/dist/components/activity-bar/index.d.ts.map +1 -1
  154. package/dist/components/codemap-model.d.ts +64 -0
  155. package/dist/components/codemap-model.d.ts.map +1 -0
  156. package/dist/components/index.d.ts +1 -1
  157. package/dist/components/index.d.ts.map +1 -1
  158. package/dist/hooks/index.d.ts +1 -0
  159. package/dist/hooks/index.d.ts.map +1 -1
  160. package/dist/hooks/useGlobalKeyboardShortcuts.d.ts.map +1 -1
  161. package/dist/hooks/useHorizontalScroll.d.ts +17 -0
  162. package/dist/hooks/useHorizontalScroll.d.ts.map +1 -0
  163. package/dist/hooks/useMemoryForFile.d.ts +30 -0
  164. package/dist/hooks/useMemoryForFile.d.ts.map +1 -0
  165. package/dist/hooks/useScrollPosition.d.ts +16 -0
  166. package/dist/hooks/useScrollPosition.d.ts.map +1 -0
  167. package/dist/hooks/useWebSocket.d.ts +30 -22
  168. package/dist/hooks/useWebSocket.d.ts.map +1 -1
  169. package/dist/hooks/ws-handlers/fleet-handlers.d.ts.map +1 -1
  170. package/dist/hooks/ws-handlers/misc-handlers.d.ts +4 -4
  171. package/dist/hooks/ws-handlers/misc-handlers.d.ts.map +1 -1
  172. package/dist/hooks/ws-handlers/session-handlers.d.ts.map +1 -1
  173. package/dist/hooks/ws-handlers/techstack-handlers.d.ts +13 -0
  174. package/dist/hooks/ws-handlers/techstack-handlers.d.ts.map +1 -0
  175. package/dist/hooks/ws-handlers.d.ts +3 -0
  176. package/dist/hooks/ws-handlers.d.ts.map +1 -1
  177. package/dist/index.css +2881 -2
  178. package/dist/index.css.map +3 -3
  179. package/dist/index.html +15 -17
  180. package/dist/index.js +40038 -27150
  181. package/dist/index.js.map +4 -4
  182. package/dist/lib/agent-office.d.ts +96 -0
  183. package/dist/lib/agent-office.d.ts.map +1 -0
  184. package/dist/lib/desktop-host.d.ts.map +1 -1
  185. package/dist/lib/kanban-cleaner.d.ts +28 -0
  186. package/dist/lib/kanban-cleaner.d.ts.map +1 -0
  187. package/dist/lib/kanban-metadata.d.ts +7 -0
  188. package/dist/lib/kanban-metadata.d.ts.map +1 -0
  189. package/dist/lib/plugin-enablement.d.ts +37 -0
  190. package/dist/lib/plugin-enablement.d.ts.map +1 -0
  191. package/dist/lib/view-navigation.d.ts +1 -1
  192. package/dist/lib/view-navigation.d.ts.map +1 -1
  193. package/dist/lib/ws-client.d.ts +61 -17
  194. package/dist/lib/ws-client.d.ts.map +1 -1
  195. package/dist/providers.json +30 -0
  196. package/dist/stores/chat-store.d.ts.map +1 -1
  197. package/dist/stores/codemap-activity-store.d.ts +79 -0
  198. package/dist/stores/codemap-activity-store.d.ts.map +1 -0
  199. package/dist/stores/fleet-store.d.ts.map +1 -1
  200. package/dist/stores/{autophase-store.d.ts → goal-run-store.d.ts} +12 -12
  201. package/dist/stores/goal-run-store.d.ts.map +1 -0
  202. package/dist/stores/goal-state-store.d.ts +12 -0
  203. package/dist/stores/goal-state-store.d.ts.map +1 -0
  204. package/dist/stores/index.d.ts +5 -2
  205. package/dist/stores/index.d.ts.map +1 -1
  206. package/dist/stores/kanban-store.d.ts.map +1 -1
  207. package/dist/stores/local-prefs.d.ts +26 -0
  208. package/dist/stores/local-prefs.d.ts.map +1 -1
  209. package/dist/stores/mailbox-store.d.ts +16 -0
  210. package/dist/stores/mailbox-store.d.ts.map +1 -1
  211. package/dist/stores/monitor-store.d.ts +61 -0
  212. package/dist/stores/monitor-store.d.ts.map +1 -1
  213. package/dist/stores/office-map-store.d.ts +4 -0
  214. package/dist/stores/office-map-store.d.ts.map +1 -1
  215. package/dist/stores/session-store.d.ts.map +1 -1
  216. package/dist/stores/techstack-store.d.ts +110 -0
  217. package/dist/stores/techstack-store.d.ts.map +1 -0
  218. package/dist/stores/types.d.ts +19 -0
  219. package/dist/stores/types.d.ts.map +1 -1
  220. package/dist/stores/ui-store.d.ts +19 -7
  221. package/dist/stores/ui-store.d.ts.map +1 -1
  222. package/dist/stores/viz-store.d.ts +6 -0
  223. package/dist/stores/viz-store.d.ts.map +1 -1
  224. package/dist/types.d.ts +567 -121
  225. package/dist/types.d.ts.map +1 -1
  226. package/package.json +7 -6
  227. package/dist/assets/AnalyticsDashboard-Lwr7vcaY.js +0 -1
  228. package/dist/assets/AutoPhaseView-Dm2ALbiB.js +0 -1
  229. package/dist/assets/ChangesView-CVcdAOd0.js +0 -1
  230. package/dist/assets/CodeEditor-DJCl9lsb.js +0 -1
  231. package/dist/assets/CronJobsPanel-B21inkB5.js +0 -1
  232. package/dist/assets/DebugDashboard-BppNFFs9.js +0 -1
  233. package/dist/assets/DesignGalleryView-BKfKAS1f.js +0 -1
  234. package/dist/assets/KanbanView-Bc2UIVD2.js +0 -1
  235. package/dist/assets/MailboxDetailView-b8e-UFpl.js +0 -1
  236. package/dist/assets/OfficeMapPanel-DmW-omSm.js +0 -4
  237. package/dist/assets/ProcessMonitor-4Il_i86w.js +0 -1
  238. package/dist/assets/QueuePanel-Ikqk4oth.js +0 -1
  239. package/dist/assets/RefreshDebugView-BQ7J1C4N.js +0 -1
  240. package/dist/assets/SddBoardView-B2ECODCt.js +0 -2
  241. package/dist/assets/SddFlowGraph-DmZbA2K1.js +0 -1
  242. package/dist/assets/SddWizard-CPYgixwo.js +0 -1
  243. package/dist/assets/SessionsDashboard-DZ2kQo_0.js +0 -1
  244. package/dist/assets/SetupScreen-CnfDy-Zu.js +0 -1
  245. package/dist/assets/SkillDetailView-Df1mNWLj.js +0 -3
  246. package/dist/assets/SpecsView-C0zbOk7n.js +0 -1
  247. package/dist/assets/TerminalPanel-B-fOpicS.js +0 -1
  248. package/dist/assets/activity-BlfRLrUt.js +0 -5
  249. package/dist/assets/activity-C6fV-S38.js +0 -5
  250. package/dist/assets/activity-Csy0Hk3h.js +0 -5
  251. package/dist/assets/activity-DEmOOQMt.js +0 -5
  252. package/dist/assets/activity-DFMWzed9.js +0 -5
  253. package/dist/assets/activity-Dn9wzdq-.js +0 -5
  254. package/dist/assets/activity-GAfT06yP.js +0 -5
  255. package/dist/assets/chat-store-CQq9AeA9.js +0 -5
  256. package/dist/assets/i18n-CLLrYq46.js +0 -2
  257. package/dist/assets/index-BwLKTDt1.js +0 -159
  258. package/dist/assets/index-Dk3-IFDU.css +0 -1
  259. package/dist/assets/markdown-BRAejDWd.js +0 -44
  260. package/dist/assets/settings-Bc58aJZk.js +0 -1
  261. package/dist/assets/settings-Bp9YKTVi.js +0 -1
  262. package/dist/assets/settings-C5VZmgTv.js +0 -1
  263. package/dist/assets/settings-CPPzs9tv.js +0 -1
  264. package/dist/assets/settings-D97B_3tS.js +0 -1
  265. package/dist/assets/settings-DLpAN_Sw.js +0 -1
  266. package/dist/assets/settings-KWv7WsjE.js +0 -1
  267. package/dist/assets/ui-store-Dm48nEb1.js +0 -1
  268. package/dist/assets/utils-C9L1kxOy.js +0 -1
  269. package/dist/assets/vendor-B51hXwIj.js +0 -70
  270. package/dist/assets/ws-client-Bbu1u6TM.js +0 -1
  271. package/dist/assets/xyflow-BDdNcuaV.js +0 -7
  272. package/dist/assets/xyflow-DtxX27Jz.css +0 -1
  273. package/dist/components/AutoPhaseView.d.ts.map +0 -1
  274. package/dist/lib/analytics.d.ts +0 -38
  275. package/dist/lib/analytics.d.ts.map +0 -1
  276. package/dist/stores/autophase-store.d.ts.map +0 -1
@@ -0,0 +1,4 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Ar as t,Cn as n,Ct as r,En as i,Fi as a,Hi as o,Ht as s,Jn as c,Mi as l,Qi as u,Rn as d,Sr as f,Ti as p,Tn as m,Tr as h,Ui as g,Un as _,Ut as v,Vr as y,Wr as b,Wt as ee,Yi as x,Yr as S,_ as C,a as te,ar as w,at as T,c as E,ct as D,d as ne,ea as O,f as re,fi as k,ft as A,gi as ie,h as ae,i as oe,it as j,jn as se,kr as ce,l as le,li as M,lt as ue,m as de,mn as N,o as fe,oi as P,or as pe,ot as me,p as he,pt as ge,qn as _e,r as ve,s as ye,tt as F,u as be,ur as xe,v as Se,vn as Ce,wn as we}from"./vendor-JNPeA-SL.js";import"./i18n-BcnwAuXt.js";import{s as Te}from"./ws-client-3f38Kop2.js";import{t as I}from"./utils-BLVofF8S.js";import{t as Ee}from"./session-store-CgCoJmdF.js";import{f as De}from"./markdown-CF2fGOZh.js";import{C as L,J as Oe,S as R,T as z,X as ke,b as B,nt as Ae,q as V,tt as je,u as Me,x as Ne,y as Pe}from"./index-MIiPbE0D.js";var H=e(O(),1);function Fe(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}function U(e){return typeof e==`number`&&Number.isFinite(e)?e:void 0}function W(e){return typeof e==`string`&&e.trim()?e.trim():void 0}function G(e,t){for(let n of t){let t=W(e[n]);if(t)return t}}function K(e,t){for(let n of t){let t=U(e[n]);if(t!==void 0)return t}}function q(e){return e.split(/[\\/]/).filter(Boolean).pop()??e}function Ie(e){return e?e.split(/\r?\n/).length:0}function Le(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 Re(e){let t=e.split(/\r?\n/,1)[0]?.trim()??e;return t.length>72?`${t.slice(0,69)}…`:t}function ze(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 Be(e,t){let n=(Array.isArray(e.fileTargets)?e.fileTargets:[]).flatMap(e=>{let t=Fe(e),n=G(t,[`filePath`,`file_path`,`path`]);return n?[{filePath:n,operation:W(t.operation),line:K(t,[`line`,`startLine`,`start_line`]),endLine:K(t,[`endLine`,`end_line`])}]:[]});if(n.length>0)return n;let r=G(t,[`file_path`,`filePath`,`path`,`filename`,`target_file`,`targetFile`]);return r?[{filePath:r,line:K(t,[`line`,`start_line`,`startLine`,`offset`]),endLine:K(t,[`end_line`,`endLine`])}]:[]}function Ve(e,t){let n=e?.line??K(t,[`line`,`start_line`,`startLine`,`offset`]),r=e?.endLine??K(t,[`end_line`,`endLine`]),i=K(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 He(e,t,n,r,i,a){let o=Ve(a,n),s=a?.filePath??G(n,[`file_path`,`filePath`,`path`,`filename`]),c=s?q(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=G(n,[`content`,`text`,`data`]),t=K(r,[`inputLines`])??(e?Ie(e):void 0);return{target:s,summary:t===void 0?`Writing file`:`${t.toLocaleString()} lines written`,lineLabel:o.label}}if(e===`edit`){let e=G(n,[`patch`,`diff`]),t=e?Le(e):null,i=G(n,[`old_string`,`oldString`,`search`]),a=G(n,[`new_string`,`newString`,`replacement`]),c=K(r,[`addedLines`]),l=K(r,[`removedLines`]),u=K(r,[`oldLines`]),d=K(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?Ie(i):u??0} → ${a?Ie(a):d??0} lines`:o.label?`${o.label} updated`:`Updating file`,lineLabel:o.label}}if(e===`terminal`){let e=G(n,[`command`,`cmd`,`script`,`shell`])??t;return{summary:Re(e),target:e}}if(e===`web`){let e=G(n,[`url`,`href`,`uri`]),t=G(n,[`query`,`q`,`search`]);return{target:e??t,summary:e?`Fetched ${e}`:t?`Looked up “${t}”`:`Went online`}}if(e===`search`){let e=G(n,[`query`,`pattern`,`q`,`search`])??c;return{target:s??e,summary:e?`Searched “${e}”`:`Searching project`}}if(e===`memory`){let e=G(n,[`query`,`text`,`key`]);return{target:e,summary:e?`Recalled “${e}”`:`Checking memory`}}return{target:s,summary:c?`${t} · ${c}`:t}}function Ue(e,t){let n=W(t.name)??W(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 We(e,t,n){return W(t.agentId)??W(t.subagentId)??(e.kind===`agent:tool`?e.source:void 0)??(e.source!==n&&e.source!==`filesystem`?e.source:void 0)??`leader`}function Ge(e){return W(e.parentSessionId)??W(e.sessionId)}function Ke(e,t){return e.kind===`tool:started`||e.kind===`tool:progress`?`running`:t.ok===!1?`failed`:`succeeded`}function qe(e){if(![`tool:started`,`tool:progress`,`tool:executed`,`agent:tool`].includes(e.kind))return null;let t=Fe(e.data),n=Ue(e,t);if(!n)return null;let r=We(e,t,n),i=t.input,a=Fe(i),o=Be(t,a),s=U(t.outputLines),c=ze(n),l=He(c,n,a,t,s,o[0]),u=W(t.id),d=Math.floor(e.timestamp/2e3),f=Ke(e,t),p=U(t.durationMs);return{id:u?`${r}:${u}`:`${r}:${n}:${d}`,agentId:r,agentName:W(t.agentName),sessionId:Ge(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:U(t.outputBytes),outputTokens:U(t.outputTokens),input:i,output:W(t.output),fileTargets:o,raw:e.raw??t}}function Je(e,t,n){return e?.length?Qe(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 Ye(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 Xe(e,t){return e.toLowerCase()===t.toLowerCase()}function J(e){return e?.trim().toLowerCase()??``}function Ze(e,t,n){let r=new Set([t.serverId,t.mailboxId,t.name].map(J).filter(e=>e.length>0)),i=n?`@session:${J(n)}`:``,a=J(t.role),o=J(t.serverId)===`leader`||J(t.serverId).startsWith(`leader@`)||a===`lead`||a===`leader`;return e.flatMap(e=>{let t=J(e.from),n=J(e.to),a=r.has(t),s=n===`*`||n===`all`||i.length>0&&n===i,c=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(J(e)))}]}).sort((e,t)=>t.timestampMs-e.timestampMs).slice(0,8)}function Qe(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=qe(a);if(!o||!Xe(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?!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 $e(e,t,n){let r=ze(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:[]}}function et(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 tt(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 nt(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 rt(e){if(!e)return;let t=e.split(`/`);return t[t.length-1]?.slice(0,18)}function it(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()}…`}function at(e,t){if(e.length===0)return{positions:new Map,columns:0,rows:0,columnWidth:380};let n=Math.max(1,...e.map(e=>e.agentCount)),r=Math.max(380,Math.min(3,n)*190+80),i=e=>270+Math.max(1,...e.map(e=>Math.ceil(Math.max(1,e.agentCount)/3)))*150,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)*100,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=370;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)+100}return{positions:u,columns:s,rows:Math.ceil(e.length/s),columnWidth:r}}function ot(e,t,n,r=640){let i=Math.min(3,n),a=Math.floor(t/i),o=t%i;return{x:e-(Math.min(i,n-a*i)-1)*190/2+o*190,y:r+a*150}}function st(e){return e===`tui`?`tui`:e===`repl`||e===`cli`?`repl`:`webui`}function ct(e){return e===`tui`?`TUI`:e===`repl`?`REPL`:`WebUI`}function lt(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 ut(e){let t=e.split(`/`).filter(Boolean).pop()??e;return t.length>10?`…${t.slice(-8)}`:t}function dt(e,t){return e===`cli`?`CLI`:e===`repl`?`REPL`:ct(t)}function ft(e,t,n=[]){let r=new Set,i=[];for(let n of e){let e=st(n.clientType),a=dt(n.clientType,e),o=`client-${n.pid??n.sessionId}`,s=[],c=!1;for(let e of n.agents){r.add(e.id);let n=t.get(e.id),i=lt(n?.status??e.status);(i===`active`||i===`streaming`)&&(c=!0),s.push({officeId:`${o}__agent-${e.id}`,serverId:e.id,name:n?.name??e.name??e.id,status:i,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`);i.push({id:o,type:e,label:`${a} · ${n.pid?`PID ${n.pid}`:ut(n.sessionId)}`,sublabel:[`session ${ut(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=i.find(t=>t.sessionId===e.sessionId);if(!t)continue;let n=e.name.trim().toLowerCase(),a=t.agents.find(t=>t.serverId===e.agentId||t.name.trim().toLowerCase()===n);a&&(r.add(e.agentId),a.mailboxId=e.agentId,a.role=e.role,a.currentTask=a.currentTask??e.currentTask,a.currentTool=a.currentTool??e.currentTool)}let a=[...t.values()].filter(e=>!r.has(e.id));if(a.length>0){let e=i.find(e=>e.type===`webui`);e||(e={id:`client-self`,type:`webui`,label:`This WebUI`,sublabel:`Web UI`,status:`idle`,agents:[]},i.push(e));for(let t of a){let n=lt(t.status);(n===`active`||n===`streaming`)&&(e.status=`active`),e.agents.push({officeId:`${e.id}__agent-${t.id}`,serverId:t.id,name:t.name,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`})}}return i.length===0&&i.push({id:`client-self`,type:`webui`,label:`This WebUI`,sublabel:`Web UI · connecting…`,status:`idle`,agents:[]}),i}function pt(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 Y=F(),mt=[`amber`,`mint`,`ocean`,`plum`,`rose`,`graphite`],ht=[`bot`,`cactus`,`duck`,`radio`],gt={read:v,write:p,edit:p,terminal:k,web:l,search:w,memory:we,other:a},_t={leader:b,builder:a,researcher:v,reviewer:y,planner:se,operator:k};function vt(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 yt(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);let n=t>>>0;return{palette:mt[n%mt.length]??`amber`,layout:Math.floor(n/mt.length)%4,clutter:Math.floor(n/(mt.length*4))%3,avatar:Math.floor(n/17)%5,motion:Math.floor(n/31)%4,charm:ht[Math.floor(n/47)%ht.length]??`bot`}}function bt(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 xt(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 St(e){return e===void 0?`—`:e<1e3?`${Math.round(e)} ms`:`${(e/1e3).toFixed(+(e<1e4))} s`}function Ct(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 wt(e){if(e===void 0)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function Tt(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 Et(e,t,n){return n.map((n,r)=>({...$e(e.serverId,n.name,t.sessionId),id:`${e.serverId}:log:${n.at}:${r}`,kind:ze(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 Dt(...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 Ot(...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 kt({kind:e,active:t}){let n=gt[e];return(0,Y.jsxs)(`span`,{className:I(`agent-office__tool-glyph`,`is-${e}`,t&&`is-active`),children:[e===`read`&&(0,Y.jsx)(xe,{className:`agent-office__file-underlay`,"aria-hidden":`true`}),(0,Y.jsx)(n,{"aria-hidden":`true`})]})}function At({active:e,failed:t,role:n,variant:r,motion:i}){let a=_t[n];return(0,Y.jsxs)(`div`,{className:I(`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,Y.jsx)(`span`,{className:`agent-office__avatar-chair`}),(0,Y.jsx)(`span`,{className:`agent-office__avatar-body`}),(0,Y.jsxs)(`span`,{className:`agent-office__avatar-head`,children:[(0,Y.jsx)(`span`,{className:`agent-office__avatar-hair`}),(0,Y.jsx)(`span`,{className:`agent-office__avatar-face`}),(0,Y.jsx)(`span`,{className:`agent-office__avatar-mouth`}),(0,Y.jsx)(`span`,{className:`agent-office__avatar-headset`})]}),(0,Y.jsx)(`span`,{className:`agent-office__avatar-arm`}),(0,Y.jsx)(`span`,{className:`agent-office__avatar-prop`}),(0,Y.jsx)(`span`,{className:`agent-office__avatar-role-badge`,children:(0,Y.jsx)(a,{})})]})}function jt({call:e,compact:t=!1,onSelect:n}){let r=e.status===`running`;return(0,Y.jsxs)(`button`,{type:`button`,className:I(`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,Y.jsx)(kt,{kind:e.kind,active:r}),(0,Y.jsxs)(`span`,{className:`agent-office__parcel-copy`,children:[(0,Y.jsxs)(`span`,{className:`agent-office__parcel-topline`,children:[(0,Y.jsx)(`strong`,{children:e.toolName}),e.lineLabel&&(0,Y.jsx)(`span`,{className:`agent-office__line-chip`,children:e.lineLabel})]}),!t&&e.target&&(0,Y.jsx)(`span`,{className:`agent-office__parcel-target`,children:bt(e.target)}),(0,Y.jsx)(`span`,{className:`agent-office__parcel-summary`,children:e.summary})]}),(0,Y.jsx)(`span`,{className:`agent-office__parcel-state`,"aria-hidden":`true`,children:r?(0,Y.jsx)(`span`,{className:`agent-office__pulse-dot`}):e.status===`failed`?(0,Y.jsx)(T,{}):(0,Y.jsx)(y,{})})]})}function Mt({mail:e,compact:t=!1,onSelect:n}){let r=e.direction===`incoming`;return(0,Y.jsxs)(`button`,{type:`button`,className:I(`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,Y.jsx)(`span`,{className:`agent-office__mail-icon`,children:r?(0,Y.jsx)(_,{"aria-hidden":`true`}):(0,Y.jsx)(s,{"aria-hidden":`true`})}),(0,Y.jsxs)(`span`,{className:`agent-office__parcel-copy`,children:[(0,Y.jsx)(`strong`,{children:r?`${e.from} →`:`→ ${e.to}`}),(0,Y.jsx)(`span`,{className:`agent-office__parcel-summary`,children:e.subject})]}),(0,Y.jsx)(i,{"aria-hidden":`true`})]})}function Nt({office:e,now:n}){let{t:r}=x(),{client:a,agents:o,stats:s}=e,c=a.lastHeartbeatAt?Date.parse(a.lastHeartbeatAt):NaN,l=Number.isFinite(c)&&n-c<2e4,u=Number.isFinite(c)&&!l,d=o.some(({agent:e})=>e.presenceSource===`registry`),f=l?`VERIFIED`:u?`DELAYED`:d?`REGISTRY`:`LOCAL`,m=o.some(({agent:e})=>e.recentTools!==void 0||e.activity!==void 0),h=o.some(({agent:e})=>e.toolCalls>0&&e.recentTools===void 0&&e.activity===void 0);return(0,Y.jsxs)(`header`,{className:`agent-office__client-header`,children:[(0,Y.jsxs)(`div`,{className:`agent-office__client-title`,children:[(0,Y.jsx)(`span`,{className:`agent-office__client-icon`,children:(0,Y.jsx)(b,{"aria-hidden":`true`})}),(0,Y.jsxs)(`div`,{className:`agent-office__client-copy`,children:[(0,Y.jsx)(`strong`,{children:a.label}),(0,Y.jsx)(`span`,{children:a.sublabel||a.sessionId})]}),(0,Y.jsxs)(`div`,{className:`agent-office__client-presence`,children:[(0,Y.jsxs)(`span`,{className:`agent-office__client-agent-count`,children:[o.length,` `,r(`activity:agentOffice.agents`)]}),(0,Y.jsxs)(`span`,{className:I(`agent-office__presence-chip`,!u&&`is-live`,u&&`is-legacy`),children:[(0,Y.jsx)(D,{"aria-hidden":`true`}),` `,f]}),(0,Y.jsxs)(`span`,{className:`agent-office__presence-chip`,children:[(0,Y.jsx)(t,{"aria-hidden":`true`}),` `,Ct(a.startedAt,n),` UP`]}),(0,Y.jsxs)(`span`,{className:I(`agent-office__presence-chip`,h?`is-legacy`:m&&`is-telemetry`),children:[(0,Y.jsx)(M,{"aria-hidden":`true`}),h?`RECONNECT`:m?`TOOLS LIVE`:`READY`]})]})]}),(0,Y.jsxs)(`fieldset`,{className:`agent-office__client-stats`,"aria-label":`Session activity totals`,children:[(0,Y.jsxs)(`span`,{title:`Unique files touched`,children:[(0,Y.jsx)(pe,{}),` `,(0,Y.jsx)(`strong`,{children:s.files}),` FILES`]}),(0,Y.jsxs)(`span`,{title:`File reads`,children:[(0,Y.jsx)(v,{}),` `,(0,Y.jsx)(`strong`,{children:s.reads}),` READ`]}),(0,Y.jsxs)(`span`,{title:`Files written`,children:[(0,Y.jsx)(p,{}),` `,(0,Y.jsx)(`strong`,{children:s.writes}),` WRITE`]}),(0,Y.jsxs)(`span`,{title:`Files edited`,children:[(0,Y.jsx)(p,{}),` `,(0,Y.jsx)(`strong`,{children:s.edits}),` EDIT`]}),(0,Y.jsxs)(`span`,{className:`agent-office__client-delta`,title:`Lines added and removed`,children:[(0,Y.jsxs)(`strong`,{children:[`+`,s.linesAdded]}),` / `,(0,Y.jsxs)(`b`,{children:[`−`,s.linesRemoved]})]}),(0,Y.jsxs)(`span`,{title:`Terminal commands`,children:[(0,Y.jsx)(k,{}),` `,(0,Y.jsx)(`strong`,{children:s.terminalCalls}),` TERM`]}),(0,Y.jsxs)(`span`,{title:`Incoming and outgoing mail`,children:[(0,Y.jsx)(i,{}),` `,(0,Y.jsx)(`strong`,{children:s.incomingMail}),`↓ `,(0,Y.jsx)(`strong`,{children:s.outgoingMail}),`↑`]})]})]})}function Pt({office:e,now:t,onSelect:r}){let{t:i}=x(),{client:a}=e,s=a.todos!==void 0,c=a.todos??[],l=c.filter(e=>e.status!==`completed`),u=c.length-l.length,d=!!a.activeInstruction,f=a.activeInstruction??a.latestPrompt,p=a.latestPromptAt!==void 0&&t-a.latestPromptAt<3e4,m=()=>r({kind:`briefing`,officeLabel:a.label,prompt:f,promptAt:a.latestPromptAt,instructionActive:d,telemetryConnected:s,todos:c});return(0,Y.jsxs)(`section`,{className:`agent-office__briefing`,"aria-label":i(`activity:agentOffice.officeBriefing`),children:[(0,Y.jsxs)(`button`,{type:`button`,className:I(`agent-office__prompt-card`,d&&`is-active`,p&&`is-fresh`,!s&&`is-waiting`),onClick:m,children:[(0,Y.jsx)(`span`,{className:`agent-office__briefing-icon is-prompt`,children:(0,Y.jsx)(n,{"aria-hidden":`true`})}),(0,Y.jsxs)(`span`,{className:`agent-office__briefing-copy`,children:[(0,Y.jsx)(`span`,{children:i(d?`activity:agentOffice.activeInstruction`:`activity:agentOffice.leaderPrompt`)}),(0,Y.jsx)(`strong`,{children:f??i(s?`activity:agentOffice.noPrompt`:`activity:agentOffice.telemetryWaiting`)})]}),d&&(0,Y.jsxs)(`span`,{className:`agent-office__instruction-live`,children:[(0,Y.jsx)(`i`,{"aria-hidden":`true`}),` LIVE`]}),a.latestPromptAt!==void 0&&(0,Y.jsx)(`time`,{dateTime:new Date(a.latestPromptAt).toISOString(),children:xt(a.latestPromptAt,t)})]}),(0,Y.jsxs)(`button`,{type:`button`,className:I(`agent-office__todo-board`,l.length>0&&`has-active`,!s&&`is-waiting`),onClick:m,children:[(0,Y.jsxs)(`span`,{className:`agent-office__todo-heading`,children:[(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(se,{"aria-hidden":`true`}),` `,i(`activity:agentOffice.activeTodos`)]}),(0,Y.jsx)(`strong`,{children:s?i(`activity:agentOffice.todoProgress`,{done:u,total:c.length}):i(`activity:agentOffice.syncWaiting`)})]}),(0,Y.jsxs)(`span`,{className:`agent-office__todo-preview`,children:[s?l.length>0?l.slice(0,3).map(e=>(0,Y.jsxs)(`span`,{className:I(`agent-office__todo-line`,`is-${e.status}`),children:[(0,Y.jsx)(`i`,{"aria-hidden":`true`}),(0,Y.jsx)(`span`,{children:e.activeForm||e.content})]},e.id)):(0,Y.jsxs)(`span`,{className:`agent-office__todo-empty`,children:[(0,Y.jsx)(o,{"aria-hidden":`true`}),c.length>0?i(`activity:agentOffice.allTodosDone`):i(`activity:agentOffice.noActiveTodos`)]}):(0,Y.jsxs)(`span`,{className:`agent-office__todo-empty is-waiting`,children:[(0,Y.jsx)(M,{"aria-hidden":`true`}),i(`activity:agentOffice.todoTelemetryWaiting`)]}),l.length>3&&(0,Y.jsx)(`span`,{className:`agent-office__todo-more`,children:i(`activity:agentOffice.moreTodos`,{count:l.length-3})})]})]})]})}function Ft({active:e}){let{t}=x();return(0,Y.jsxs)(`div`,{className:`agent-office__parcel agent-office__parcel--empty`,children:[(0,Y.jsx)(`span`,{className:`agent-office__tool-glyph`,children:(0,Y.jsx)(S,{"aria-hidden":`true`})}),(0,Y.jsxs)(`span`,{className:`agent-office__parcel-copy`,children:[(0,Y.jsx)(`strong`,{children:t(e?`activity:agentOffice.thinking`:`activity:agentOffice.waiting`)}),(0,Y.jsx)(`span`,{children:t(e?`activity:agentOffice.preparing`:`activity:agentOffice.deskReady`)})]})]})}function It({model:e,now:t,onSelect:n}){let{t:r}=x(),{agent:o,client:s,current:c,display:l,history:u,mail:d}=e,f=o.status===`active`||o.status===`streaming`,p=o.status===`error`,m=d[0],h=vt(o),g=yt(`${s.sessionId}:${o.serverId}:${o.name}`),_=m&&t-m.timestampMs<3e4,v=u.slice(0,6),b=v[0]?.completedAt??v[0]?.startedAt??l?.completedAt??l?.startedAt,ee=c?`is-tool-${c.kind}`:void 0;return(0,Y.jsxs)(`article`,{className:I(`agent-office__lane`,`is-desk-${g.palette}`,`is-layout-${g.layout}`,`is-clutter-${g.clutter}`,f&&`is-active`,p&&`is-failed`),children:[(0,Y.jsxs)(`div`,{className:`agent-office__identity`,children:[(0,Y.jsxs)(`div`,{className:`agent-office__identity-line`,children:[(0,Y.jsx)(`span`,{className:I(`agent-office__status-dot`,f&&`is-active`,p&&`is-failed`)}),(0,Y.jsx)(`strong`,{title:o.name,children:o.name}),(0,Y.jsxs)(`span`,{className:`agent-office__agent-verified`,title:o.presenceSource===`registry`?`Verified by live session registry`:`Verified by local fleet state`,children:[(0,Y.jsx)(y,{"aria-hidden":`true`}),o.presenceSource===`registry`?`LIVE`:`LOCAL`]})]}),(0,Y.jsx)(`span`,{className:`agent-office__role`,children:o.role??(o.serverId===`leader`||o.serverId.startsWith(`leader@`)?r(`activity:agentOffice.leadAgent`):r(`activity:agentOffice.agent`))}),(0,Y.jsxs)(`div`,{className:`agent-office__agent-meta`,children:[(0,Y.jsx)(`span`,{children:s.branch?`⎇ ${s.branch}`:s.type.toUpperCase()}),(0,Y.jsx)(`span`,{children:r(`activity:agentOffice.callsCount`,{count:o.toolCalls})})]}),o.currentTask&&(0,Y.jsxs)(`button`,{type:`button`,className:`agent-office__agent-task`,onClick:()=>n({kind:`task`,task:o.currentTask??``,taskId:o.taskId,agentName:o.name}),children:[(0,Y.jsx)(se,{"aria-hidden":`true`}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`strong`,{children:r(`activity:agentOffice.currentTask`)}),(0,Y.jsx)(`small`,{children:o.currentTask})]})]}),!o.currentTask&&f&&(0,Y.jsxs)(`div`,{className:`agent-office__agent-task is-missing`,children:[(0,Y.jsx)(M,{"aria-hidden":`true`}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`strong`,{children:r(`activity:agentOffice.currentTask`)}),(0,Y.jsx)(`small`,{children:s.todos===void 0?r(`activity:agentOffice.telemetryWaiting`):r(`activity:agentOffice.taskNotReported`)})]})]}),m&&(0,Y.jsxs)(`button`,{type:`button`,className:I(`agent-office__identity-mail`,m.unread&&`is-unread`),onClick:()=>n({kind:`mail`,mail:m,agentName:o.name}),"aria-label":`${d.length} mail messages. Latest: ${m.subject}`,children:[(0,Y.jsx)(i,{"aria-hidden":`true`}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsxs)(`strong`,{children:[d.length,` MAIL`]}),(0,Y.jsx)(`small`,{children:m.subject})]})]})]}),(0,Y.jsxs)(`div`,{className:I(`agent-office__scene`,ee),children:[(0,Y.jsxs)(`div`,{className:`agent-office__window`,"aria-hidden":`true`,children:[(0,Y.jsx)(`span`,{}),(0,Y.jsx)(`span`,{}),(0,Y.jsx)(`span`,{})]}),(0,Y.jsxs)(`div`,{className:`agent-office__plant`,"aria-hidden":`true`,children:[(0,Y.jsx)(`span`,{}),(0,Y.jsx)(`i`,{}),(0,Y.jsx)(`b`,{})]}),(0,Y.jsxs)(`div`,{className:`agent-office__desk-zone`,"aria-hidden":`true`,children:[(0,Y.jsx)(At,{active:f,failed:p,role:h,variant:g.avatar,motion:g.motion}),(0,Y.jsx)(`span`,{className:`agent-office__monitor`,children:l?(0,Y.jsx)(kt,{kind:l.kind,active:c!==void 0}):(0,Y.jsx)(a,{})}),(0,Y.jsxs)(`span`,{className:`agent-office__activity-fx`,children:[(0,Y.jsx)(`span`,{}),(0,Y.jsx)(`i`,{}),(0,Y.jsx)(`b`,{})]}),(0,Y.jsx)(`span`,{className:`agent-office__desk`}),(0,Y.jsx)(`span`,{className:`agent-office__desk-lamp`}),(0,Y.jsxs)(`span`,{className:`agent-office__desk-clutter`,children:[(0,Y.jsx)(`i`,{}),(0,Y.jsx)(`b`,{})]}),(0,Y.jsxs)(`span`,{className:I(`agent-office__desk-charm`,`is-${g.charm}`),children:[(0,Y.jsx)(`i`,{}),(0,Y.jsx)(`b`,{})]}),(0,Y.jsxs)(`span`,{className:I(`agent-office__mug`,`is-${h}`),children:[(0,Y.jsx)(`i`,{"aria-hidden":`true`}),(0,Y.jsx)(`b`,{"aria-hidden":`true`})]})]}),_&&(0,Y.jsx)(`div`,{className:I(`agent-office__mail-flyby`,`is-${m.direction}`),children:(0,Y.jsx)(Mt,{mail:m,compact:!0,onSelect:()=>n({kind:`mail`,mail:m,agentName:o.name})},m.id)}),(0,Y.jsxs)(`div`,{className:I(`agent-office__conveyor`,c&&`is-moving`),children:[(0,Y.jsxs)(`div`,{className:`agent-office__belt`,"aria-hidden":`true`,children:[(0,Y.jsx)(`span`,{}),(0,Y.jsx)(`span`,{}),(0,Y.jsx)(`span`,{}),(0,Y.jsx)(`span`,{}),(0,Y.jsx)(`span`,{}),(0,Y.jsx)(`span`,{})]}),(0,Y.jsx)(`div`,{className:`agent-office__current-action`,children:l?(0,Y.jsx)(jt,{call:l,onSelect:()=>n({kind:`tool`,call:l,agentName:o.name})},l.id):(0,Y.jsx)(Ft,{active:f})})]})]}),(0,Y.jsxs)(`div`,{className:`agent-office__history`,children:[(0,Y.jsxs)(`div`,{className:`agent-office__history-heading`,children:[(0,Y.jsx)(`span`,{children:r(`activity:agentOffice.recent`)}),b!==void 0&&(0,Y.jsx)(`span`,{children:xt(b,t)})]}),(0,Y.jsx)(`div`,{className:`agent-office__history-list`,children:v.length>0?v.map(e=>(0,Y.jsx)(jt,{call:e,compact:!0,onSelect:()=>n({kind:`tool`,call:e,agentName:o.name})},`tool:${e.id}`)):(0,Y.jsx)(`span`,{className:`agent-office__history-empty`,children:o.toolCalls>0&&o.recentTools===void 0&&o.activity===void 0?r(`activity:agentOffice.telemetryReconnect`):r(`activity:agentOffice.noCalls`)})})]})]})}function X({label:e,value:t}){return(0,Y.jsxs)(`div`,{className:`agent-office__detail-row`,children:[(0,Y.jsx)(`span`,{children:e}),(0,Y.jsx)(`strong`,{children:t})]})}function Lt({selected:e,onClose:t}){let{t:n}=x(),{call:r,agentName:i}=e,a=gt[r.kind],o=wt(r.input),s=wt(r.output);return(0,Y.jsxs)(`aside`,{className:`agent-office__detail`,"aria-label":`${r.toolName} details`,children:[(0,Y.jsxs)(`div`,{className:`agent-office__detail-header`,children:[(0,Y.jsx)(`div`,{className:I(`agent-office__detail-icon`,`is-${r.kind}`),children:(0,Y.jsx)(a,{"aria-hidden":`true`})}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`span`,{children:n(`activity:agentOffice.toolCall`)}),(0,Y.jsx)(`h2`,{children:r.toolName})]}),(0,Y.jsx)(`button`,{type:`button`,onClick:t,"aria-label":`Close details`,children:(0,Y.jsx)(T,{})})]}),(0,Y.jsxs)(`div`,{className:`agent-office__detail-status`,children:[(0,Y.jsx)(`span`,{className:I(`agent-office__status-dot`,r.status===`running`&&`is-active`,r.status===`failed`&&`is-failed`)}),(0,Y.jsx)(`strong`,{children:r.summary}),(0,Y.jsx)(`span`,{children:r.status})]}),(0,Y.jsxs)(`section`,{className:`agent-office__detail-section`,children:[(0,Y.jsx)(`h3`,{children:n(`activity:agentOffice.execution`)}),(0,Y.jsx)(X,{label:n(`activity:agentOffice.agent`),value:i}),(0,Y.jsx)(X,{label:n(`activity:agentOffice.started`),value:new Date(r.startedAt).toLocaleTimeString()}),(0,Y.jsx)(X,{label:n(`activity:agentOffice.duration`),value:St(r.durationMs)}),r.sessionId&&(0,Y.jsx)(X,{label:n(`activity:agentOffice.session`),value:bt(r.sessionId,28)})]}),(r.target||r.fileTargets.length>0)&&(0,Y.jsxs)(`section`,{className:`agent-office__detail-section`,children:[(0,Y.jsx)(`h3`,{children:n(`activity:agentOffice.target`)}),r.target&&(0,Y.jsx)(`code`,{className:`agent-office__target-code`,children:r.target}),r.fileTargets.map((e,t)=>(0,Y.jsxs)(`div`,{className:`agent-office__file-target`,children:[(0,Y.jsx)(xe,{"aria-hidden":`true`}),(0,Y.jsx)(`span`,{children:e.filePath}),(e.line||e.endLine)&&(0,Y.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,Y.jsxs)(`section`,{className:`agent-office__detail-section`,children:[(0,Y.jsx)(`h3`,{children:n(`activity:agentOffice.resultSize`)}),(0,Y.jsxs)(`div`,{className:`agent-office__metric-grid`,children:[r.outputLines!==void 0&&(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`strong`,{children:r.outputLines.toLocaleString()}),(0,Y.jsx)(`span`,{children:n(`activity:agentOffice.lines`)})]}),r.outputBytes!==void 0&&(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`strong`,{children:r.outputBytes.toLocaleString()}),(0,Y.jsx)(`span`,{children:n(`activity:agentOffice.bytes`)})]}),r.outputTokens!==void 0&&(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`strong`,{children:[`≈`,r.outputTokens.toLocaleString()]}),(0,Y.jsx)(`span`,{children:n(`activity:agentOffice.tokens`)})]})]})]}),o&&(0,Y.jsxs)(`section`,{className:`agent-office__detail-section`,children:[(0,Y.jsx)(`h3`,{children:n(`activity:agentOffice.input`)}),(0,Y.jsx)(`pre`,{children:(0,Y.jsx)(`code`,{children:o})})]}),s&&(0,Y.jsxs)(`section`,{className:`agent-office__detail-section`,children:[(0,Y.jsx)(`h3`,{children:n(`activity:agentOffice.outputPreview`)}),(0,Y.jsx)(`pre`,{children:(0,Y.jsx)(`code`,{children:s})})]})]})}function Rt({selected:e,onClose:t}){let{t:n}=x(),{mail:r,agentName:a}=e;return(0,Y.jsxs)(`aside`,{className:`agent-office__detail`,"aria-label":`${r.subject} details`,children:[(0,Y.jsxs)(`div`,{className:`agent-office__detail-header`,children:[(0,Y.jsx)(`div`,{className:`agent-office__detail-icon is-mail`,children:(0,Y.jsx)(i,{"aria-hidden":`true`})}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`span`,{children:r.direction===`incoming`?`INCOMING MAIL`:`OUTGOING MAIL`}),(0,Y.jsx)(`h2`,{children:r.subject})]}),(0,Y.jsx)(`button`,{type:`button`,onClick:t,"aria-label":`Close mail details`,children:(0,Y.jsx)(T,{})})]}),(0,Y.jsxs)(`div`,{className:`agent-office__detail-status`,children:[(0,Y.jsx)(`span`,{className:I(`agent-office__status-dot`,r.unread&&`is-active`)}),(0,Y.jsxs)(`strong`,{children:[r.from,` → `,r.to]}),(0,Y.jsx)(`span`,{children:r.type})]}),(0,Y.jsxs)(`section`,{className:`agent-office__detail-section`,children:[(0,Y.jsx)(`h3`,{children:n(`activity:mailbox.messages`)}),(0,Y.jsx)(X,{label:n(`activity:agentOffice.agent`),value:a}),(0,Y.jsx)(X,{label:n(`activity:agentOffice.started`),value:new Date(r.timestampMs).toLocaleTimeString()}),(0,Y.jsx)(X,{label:`Priority`,value:r.priority}),(0,Y.jsx)(X,{label:`Route`,value:`${r.from} → ${r.to}`})]}),(0,Y.jsxs)(`section`,{className:`agent-office__detail-section`,children:[(0,Y.jsx)(`h3`,{children:r.subject}),(0,Y.jsx)(`div`,{className:`agent-office__mail-body`,children:r.body})]})]})}function zt({selected:e,onClose:t}){let{t:n}=x();return(0,Y.jsxs)(`aside`,{className:`agent-office__detail`,"aria-label":`${e.agentName} task details`,children:[(0,Y.jsxs)(`div`,{className:`agent-office__detail-header`,children:[(0,Y.jsx)(`div`,{className:`agent-office__detail-icon is-task`,children:(0,Y.jsx)(se,{"aria-hidden":`true`})}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`span`,{children:n(`activity:agentOffice.currentTask`)}),(0,Y.jsx)(`h2`,{children:e.agentName})]}),(0,Y.jsx)(`button`,{type:`button`,onClick:t,"aria-label":`Close task details`,children:(0,Y.jsx)(T,{})})]}),(0,Y.jsxs)(`section`,{className:`agent-office__detail-section`,children:[(0,Y.jsx)(`h3`,{children:n(`activity:agentOffice.task`)}),e.taskId&&(0,Y.jsx)(X,{label:`ID`,value:e.taskId}),(0,Y.jsx)(`div`,{className:`agent-office__task-body`,children:e.task})]})]})}function Bt({selected:e,onClose:t}){let{t:r}=x(),i=e.todos.filter(e=>e.status!==`completed`).length;return(0,Y.jsxs)(`aside`,{className:`agent-office__detail`,"aria-label":`${e.officeLabel} briefing`,children:[(0,Y.jsxs)(`div`,{className:`agent-office__detail-header`,children:[(0,Y.jsx)(`div`,{className:`agent-office__detail-icon is-briefing`,children:(0,Y.jsx)(n,{"aria-hidden":`true`})}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`span`,{children:e.instructionActive?r(`activity:agentOffice.activeInstruction`):r(`activity:agentOffice.officeBriefing`)}),(0,Y.jsx)(`h2`,{children:e.officeLabel})]}),(0,Y.jsx)(`button`,{type:`button`,onClick:t,"aria-label":`Close office briefing`,children:(0,Y.jsx)(T,{})})]}),(0,Y.jsxs)(`div`,{className:`agent-office__detail-status`,children:[(0,Y.jsx)(`span`,{className:I(`agent-office__status-dot`,(e.instructionActive||i>0)&&`is-active`)}),(0,Y.jsx)(`strong`,{children:e.telemetryConnected?r(`activity:agentOffice.activeTodos`):r(`activity:agentOffice.telemetryWaiting`)}),(0,Y.jsx)(`span`,{children:e.telemetryConnected?i:`—`})]}),(0,Y.jsxs)(`section`,{className:`agent-office__detail-section`,children:[(0,Y.jsx)(`h3`,{children:e.instructionActive?r(`activity:agentOffice.activeInstruction`):r(`activity:agentOffice.leaderPrompt`)}),e.promptAt!==void 0&&(0,Y.jsx)(X,{label:r(`activity:agentOffice.promptReceived`),value:new Date(e.promptAt).toLocaleString()}),(0,Y.jsx)(`div`,{className:`agent-office__task-body`,children:e.prompt??(e.telemetryConnected?r(`activity:agentOffice.noPrompt`):r(`activity:agentOffice.telemetryWaiting`))})]}),(0,Y.jsxs)(`section`,{className:`agent-office__detail-section`,children:[(0,Y.jsx)(`h3`,{children:r(`activity:agentOffice.todos`)}),(0,Y.jsx)(`div`,{className:`agent-office__todo-detail-list`,children:e.telemetryConnected?e.todos.length>0?e.todos.map(e=>(0,Y.jsxs)(`div`,{className:I(`agent-office__todo-detail`,`is-${e.status}`),children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`strong`,{children:e.content}),(0,Y.jsx)(`small`,{children:r(`activity:agentOffice.todoStatus.${e.status}`)})]})]},e.id)):(0,Y.jsx)(`span`,{className:`agent-office__history-empty`,children:r(`activity:agentOffice.noActiveTodos`)}):(0,Y.jsx)(`span`,{className:`agent-office__history-empty`,children:r(`activity:agentOffice.todoTelemetryWaiting`)})})]})]})}function Vt({selected:e,onClose:t}){return e.kind===`tool`?(0,Y.jsx)(Lt,{selected:e,onClose:t}):e.kind===`mail`?(0,Y.jsx)(Rt,{selected:e,onClose:t}):e.kind===`task`?(0,Y.jsx)(zt,{selected:e,onClose:t}):(0,Y.jsx)(Bt,{selected:e,onClose:t})}function Ht(){let{t:e}=x(),n=Oe(e=>e.liveSessions),r=Oe(e=>e.aggregate),i=Ae(e=>e.agents),a=ke(e=>e.agents),o=ke(e=>e.messages),s=Te(e=>e.toolEvents),l=Ee(e=>e.projectName),[u,d]=(0,H.useState)(null),f=(0,H.useMemo)(()=>ft(n,i,a),[n,i,a]),p=(0,H.useMemo)(()=>f.flatMap(e=>e.agents.map(t=>{let n=Dt(Qe(s,t.serverId,e.sessionId),Je(t.recentTools,t.serverId,e.sessionId),Et(t,e,i.get(t.serverId)?.toolLog??[])),r=t.status===`active`||t.status===`streaming`,a=n.find(e=>e.status===`running`);!a&&r&&t.currentTool&&(a=$e(t.serverId,t.currentTool,e.sessionId));let c=a??n[0],l=n.filter(e=>e.status!==`running`).slice(0,6),u=Ot(Ye(t.recentMail),Ze(o,t,e.sessionId));return{key:t.officeId,client:e,agent:t,calls:n,current:a,display:c,history:l,mail:u}})),[f,i,o,s]),m=(0,H.useMemo)(()=>f.map(e=>{let t=p.filter(t=>t.client.id===e.id);return{client:e,agents:t,stats:Tt(t)}}).filter(e=>e.agents.length>0),[f,p]),h=p.filter(({agent:e})=>e.status===`active`||e.status===`streaming`).length,g=l||n.find(e=>e.projectName)?.projectName||e(`activity:office.fleetHq`),_=Date.now();return(0,Y.jsxs)(`div`,{className:`agent-office`,children:[(0,Y.jsxs)(`header`,{className:`agent-office__header`,children:[(0,Y.jsxs)(`div`,{className:`agent-office__title`,children:[(0,Y.jsx)(`span`,{className:`agent-office__brand-mark`,children:(0,Y.jsx)(b,{"aria-hidden":`true`})}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`span`,{children:e(`activity:agentOffice.liveProjectOffice`)}),(0,Y.jsx)(`h1`,{children:g})]})]}),(0,Y.jsxs)(`div`,{className:`agent-office__live-pill`,children:[(0,Y.jsx)(`span`,{}),` LIVE`]}),(0,Y.jsxs)(`div`,{className:`agent-office__summary`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(S,{}),(0,Y.jsx)(`strong`,{children:p.length}),(0,Y.jsx)(`span`,{children:e(`activity:agentOffice.agents`)})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(me,{}),(0,Y.jsx)(`strong`,{children:h}),(0,Y.jsx)(`span`,{children:e(`activity:agentOffice.working`)})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(M,{}),(0,Y.jsx)(`strong`,{children:r.toolCalls.toLocaleString()}),(0,Y.jsx)(`span`,{children:e(`activity:agentOffice.toolCalls`)})]})]})]}),(0,Y.jsx)(`main`,{className:`agent-office__floor`,children:p.length>0?m.map(t=>(0,Y.jsxs)(`section`,{className:`agent-office__client-office`,children:[(0,Y.jsx)(Nt,{office:t,now:_}),(0,Y.jsx)(Pt,{office:t,now:_,onSelect:d}),(0,Y.jsxs)(`div`,{className:`agent-office__column-headings`,"aria-hidden":`true`,children:[(0,Y.jsx)(`span`,{children:e(`activity:agentOffice.team`)}),(0,Y.jsx)(`span`,{children:e(`activity:agentOffice.liveDesk`)}),(0,Y.jsx)(`span`,{children:e(`activity:agentOffice.lastActions`)})]}),(0,Y.jsx)(`div`,{className:`agent-office__client-desks`,children:t.agents.map(e=>(0,Y.jsx)(It,{model:e,now:_,onSelect:d},e.key))})]},t.client.id)):(0,Y.jsxs)(`div`,{className:`agent-office__empty-state`,children:[(0,Y.jsx)(`span`,{children:(0,Y.jsx)(D,{"aria-hidden":`true`})}),(0,Y.jsx)(`h2`,{children:e(`activity:agentOffice.readyTitle`)}),(0,Y.jsx)(`p`,{children:e(`activity:agentOffice.readyBody`)})]})}),(0,Y.jsxs)(`footer`,{className:`agent-office__footer`,children:[(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`span`,{className:`agent-office__status-dot is-active`}),` `,e(`activity:agentOffice.liveEvent`)]}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(c,{}),` `,e(`activity:agentOffice.connectedSessions`,{count:n.length})]}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(t,{}),` `,e(`activity:agentOffice.detailHint`)]})]}),u&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`button`,{type:`button`,className:`agent-office__detail-backdrop`,onClick:()=>d(null),"aria-label":`Close tool details`}),(0,Y.jsx)(Vt,{selected:u,onClose:()=>d(null)})]})]})}function Ut(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 Wt={user:{Icon:ge,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-primary`,bubbleBorder:`border-transparent`,textColor:`text-primary-foreground`},assistant:{Icon:S,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:r,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:S,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:g,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 Gt({entry:e}){let{t}=x();return e.role===`error`?(0,Y.jsx)(B,{text:e.text}):e.role===`tool`?(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1.5 tool-details`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5 text-sm font-medium text-foreground`,children:[(0,Y.jsx)(r,{className:`h-3 w-3`}),(0,Y.jsx)(`span`,{className:`font-mono`,children:e.tool??t(`activity:watch.toolFallback`)}),e.durationMs!==void 0&&(0,Y.jsxs)(`span`,{className:`ml-auto text-[10px] text-muted-foreground font-normal tabular-nums`,children:[(0,Y.jsx)(ce,{className:`h-3 w-3 inline mr-0.5 align-text-bottom`}),Ut(e.durationMs)]})]}),e.input!==void 0&&e.input!==null&&(0,Y.jsx)(`div`,{className:`p-3 bg-muted/50 rounded-lg overflow-x-auto`,children:(0,Y.jsx)(Pe,{input:e.input})}),e.output!==void 0&&e.output!==null?(0,Y.jsx)(`div`,{className:`text-sm leading-relaxed markdown-content`,children:typeof e.output==`string`?(0,Y.jsx)(z,{remarkPlugins:[De],rehypePlugins:L,components:R,children:e.output}):(0,Y.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,Y.jsx)(`div`,{className:`text-sm leading-relaxed markdown-content`,children:(0,Y.jsx)(z,{remarkPlugins:[De],rehypePlugins:L,components:R,children:e.text})}):null,e.isError&&(0,Y.jsxs)(`div`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 px-3 py-2`,children:[(0,Y.jsx)(`span`,{className:`text-xs font-medium text-destructive`,children:t(`activity:watch.toolFailed`)}),e.text&&(0,Y.jsx)(`pre`,{className:`mt-1 text-xs whitespace-pre-wrap text-destructive/80`,children:e.text})]})]}):(0,Y.jsx)(`div`,{className:`text-sm leading-relaxed markdown-content`,children:(0,Y.jsx)(z,{remarkPlugins:[De],rehypePlugins:L,components:R,children:e.text})})}function Kt({entry:e,isContinuation:t=!1}){let{t:n}=x(),r=Wt[e.role],i=r.Icon;return(0,Y.jsxs)(`div`,{className:`group flex gap-3 animate-message msg-bubble rounded-lg transition-shadow`,children:[t?(0,Y.jsx)(`div`,{className:`flex-shrink-0 w-8`}):(0,Y.jsx)(`div`,{className:I(`flex-shrink-0 w-8 h-8 rounded-full flex items-center justify-center`,r.avatarBg,r.avatarColor,r.avatarRing),children:(0,Y.jsx)(i,{className:`h-4 w-4`})}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1.5 min-w-0 flex-1`,children:[!t&&(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:I(`text-xs font-medium`,r.textColor),children:e.role===`tool`&&e.tool?e.tool:n(r.labelKey)}),(0,Y.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,Y.jsxs)(`span`,{className:`text-[10px] text-muted-foreground tabular-nums`,children:[`· `,Ut(e.durationMs)]})]}),(0,Y.jsx)(`div`,{className:I(`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,Y.jsx)(`div`,{className:I(`text-sm leading-relaxed markdown-content`,r.textColor),children:(0,Y.jsx)(Gt,{entry:e})})}),e.text&&e.role!==`error`&&(0,Y.jsx)(`div`,{className:`opacity-0 group-hover:opacity-100 transition-opacity`,children:(0,Y.jsx)(Ne,{text:e.text,label:n(`common:action.copy`)})})]})]})}var qt=[`steer`,`ask`,`assign`,`note`],Jt=2500;function Yt({sessionId:e,limit:t=200}){let[n,r]=(0,H.useState)(null),{t:i}=x(),[a,o]=(0,H.useState)(null),[s,c]=(0,H.useState)(``),[l,d]=(0,H.useState)(!1),[f,p]=(0,H.useState)(null),[m,h]=(0,H.useState)(`steer`),[g,_]=(0,H.useState)(`high`),[v,y]=(0,H.useState)([]),[b,ee]=(0,H.useState)(!1),C=(0,H.useRef)(null),te=(0,H.useRef)(!0),w=(0,H.useRef)(!0),T=Oe(e=>e.liveSessions),E=(0,H.useMemo)(()=>T.find(t=>t.sessionId===e),[T,e]),D=(0,H.useMemo)(()=>{let e=E;return e?`${e.status}|${e.agents.map(e=>`${e.id}:${e.status}:${e.toolCalls??0}:${e.iterations??0}`).join(`,`)}`:``},[E]),ne=E?.status===`active`||(E?.agents.some(e=>e.status===`running`||e.status===`streaming`)??!1),O=(0,H.useMemo)(()=>{if(!E)return null;let e=E.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},[E,i]),re=(0,H.useMemo)(()=>{if(!E)return null;let e=E.agents.find(e=>e.partialText&&(e.status===`streaming`||e.status===`running`))??E.agents.find(e=>e.partialText);return e?.partialText?{label:e.id===`leader`?i(`activity:sessionWatch.claude`):e.name||e.id,text:e.partialText}:null},[E,i]),k=(0,H.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();w.current&&(r(i),o(null))}catch(e){w.current&&o(e instanceof Error?e.message:String(e))}},[e,t]),A=(0,H.useCallback)(async()=>{try{let t=await fetch(`/api/sessions/${encodeURIComponent(e)}/mailbox`);if(!t.ok)return;let n=await t.json();w.current&&Array.isArray(n.thread)&&y(n.thread)}catch{}},[e]);(0,H.useEffect)(()=>{w.current=!0,r(null),o(null),y([]),k(),A();let e=setInterval(()=>{document.hidden||(k(),A())},Jt);return()=>{w.current=!1,clearInterval(e)}},[k,A]),(0,H.useEffect)(()=>{D&&k()},[D,k]),(0,H.useEffect)(()=>{te.current&&C.current&&(C.current.scrollTop=C.current.scrollHeight)},[n,re]);let ie=()=>{let e=C.current;e&&(te.current=e.scrollHeight-e.scrollTop-e.clientHeight<40)},ae=async()=>{let t=s.trim();if(!(!t||l)){d(!0),p(null);try{let n=await fetch(`/api/sessions/${encodeURIComponent(e)}/message`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({text:t,type:m,priority:g})});if(!n.ok)throw Error(`HTTP ${n.status}`);c(``),p(ne?u.t(`activity:sessionWatch.sentRunning`):u.t(`activity:sessionWatch.sentIdle`)),A()}catch(e){p(u.t(`activity:sessionWatch.sentFailed`,{error:e instanceof Error?e.message:String(e)}))}finally{d(!1)}}},oe=async()=>{if(!b){ee(!0),p(null);try{let t=await fetch(`/api/sessions/${encodeURIComponent(e)}/interrupt`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({reason:u.t(`activity:sessionWatch.interruptReason`)})});if(!t.ok)throw Error(`HTTP ${t.status}`);p(u.t(`activity:sessionWatch.interruptSent`)),A()}catch(e){p(u.t(`activity:sessionWatch.interruptFailed`,{error:e instanceof Error?e.message:String(e)}))}finally{ee(!1)}}},j=n?.entries??[];return(0,Y.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between mb-1.5 shrink-0`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] uppercase tracking-wide text-muted-foreground`,children:[(0,Y.jsx)(`span`,{className:I(`h-1.5 w-1.5 rounded-full`,ne?`bg-success animate-pulse`:`bg-muted-foreground`)}),i(`activity:sessionWatch.liveStream`)]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[n&&(0,Y.jsxs)(`div`,{className:`text-[10px] text-muted-foreground`,children:[i(`activity:sessionWatch.events`,{count:n.total}),` · `,n.status]}),ne&&(0,Y.jsx)(`button`,{type:`button`,onClick:()=>void oe(),disabled:b,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(b?`activity:sessionWatch.interrupting`:`activity:sessionWatch.interrupt`)})]})]}),O&&(0,Y.jsxs)(`div`,{className:`mb-1.5 shrink-0 text-[10px] text-foreground truncate`,children:[`▶ `,O]}),a&&(0,Y.jsxs)(`div`,{className:`text-[11px] text-destructive mb-1 shrink-0`,children:[`· `,a]}),(0,Y.jsxs)(`div`,{ref:C,onScroll:ie,className:`min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain space-y-1.5 pr-1`,children:[j.length===0&&!a&&(0,Y.jsx)(`div`,{className:`text-[11px] text-muted-foreground italic`,children:i(`activity:sessionWatch.loading`)}),j.map((e,t)=>(0,Y.jsx)(Kt,{entry:e,isContinuation:t>0&&j[t-1].role===e.role},`${e.ts}-${t}`)),re&&(0,Y.jsxs)(`div`,{className:`flex gap-3 animate-message`,children:[(0,Y.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,Y.jsx)(S,{className:`h-4 w-4 animate-pulse`})}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1.5 max-w-[85%] min-w-0`,children:[(0,Y.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground px-1`,children:re.label}),(0,Y.jsx)(`div`,{className:`rounded-2xl rounded-bl-md px-4 py-3 bg-card border border-border`,children:(0,Y.jsxs)(`span`,{className:`text-sm leading-relaxed text-foreground whitespace-pre-wrap break-words`,children:[re.text,(0,Y.jsx)(`span`,{className:`animate-pulse text-primary`,children:`▋`})]})})]})]})]}),v.length>0&&(0,Y.jsxs)(`div`,{className:`mt-2 pt-2 border-t border-border shrink-0 max-h-28 overflow-y-auto space-y-1`,children:[(0,Y.jsx)(`div`,{className:`text-[9px] uppercase tracking-wide text-muted-foreground`,children:i(`activity:mailbox.messages`)}),v.slice(-6).map(e=>{let t=e.completed?i(`activity:sessionWatch.done`):e.readByLeader?i(`activity:sessionWatch.read`):i(`activity:sessionWatch.delivered`);return(0,Y.jsxs)(`div`,{className:`text-[10px] leading-snug`,children:[(0,Y.jsx)(`span`,{className:I(`font-semibold mr-1.5`,e.fromLeader?`text-accent`:`text-primary`),children:e.fromLeader?i(`activity:sessionWatch.agent`):i(`activity:sessionWatch.you`)}),(0,Y.jsx)(`span`,{className:`text-foreground whitespace-pre-wrap break-words`,children:e.body}),!e.fromLeader&&(0,Y.jsx)(`span`,{className:I(`ml-1.5 text-[9px]`,e.completed?`text-success`:e.readByLeader?`text-primary`:`text-muted-foreground`),children:t})]},e.id)})]}),(0,Y.jsxs)(`div`,{className:`mt-2 pt-2 border-t border-border shrink-0`,children:[(0,Y.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5`,children:[(0,Y.jsx)(`select`,{value:m,onChange:e=>h(e.target.value),title:i(`activity:sessionWatch.msgType.${m}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:qt.map(e=>(0,Y.jsx)(`option`,{value:e,children:i(`activity:sessionWatch.msgType.${e}Label`)},e))}),(0,Y.jsxs)(`select`,{value:g,onChange:e=>_(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,Y.jsx)(`option`,{value:`high`,children:`high`}),(0,Y.jsx)(`option`,{value:`normal`,children:`normal`}),(0,Y.jsx)(`option`,{value:`low`,children:`low`})]})]}),(0,Y.jsxs)(`div`,{className:`flex items-end gap-1.5`,children:[(0,Y.jsx)(`textarea`,{value:s,onChange:e=>c(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),ae())},rows:2,placeholder:i(`activity:sessionWatch.placeholder`,{label:i(`activity:sessionWatch.msgType.${m}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,Y.jsx)(`button`,{type:`button`,onClick:()=>void ae(),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`)})]}),f&&(0,Y.jsx)(`div`,{className:`mt-1 text-[10px] text-muted-foreground`,children:f}),(0,Y.jsx)(`div`,{className:`mt-0.5 text-[9px] text-muted-foreground`,children:i(`activity:sessionWatch.sendHint`)})]})]})}var Z={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))`},Xt=.12;function Zt(e){return Math.min(100,Math.max(0,e??0))}function Q({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:Z.muted,active:Z.success,streaming:Z.primary,completed:Z.primary,error:Z.destructive,offline:Z.muted};return(0,Y.jsx)(`span`,{className:I(`rounded-full`,r,n>0&&`animate-pulse`,a[e]),style:{boxShadow:n>0?`0 0 ${i}px ${o[e]}`:void 0}})}function $(){let e={opacity:0,width:1,height:1,minWidth:0,border:`none`,background:`transparent`};return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(ye,{type:`target`,position:C.Top,style:e,isConnectable:!1}),(0,Y.jsx)(ye,{type:`source`,position:C.Bottom,style:e,isConnectable:!1})]})}function Qt({data:e}){let{t}=x();return(0,Y.jsxs)(`div`,{className:`mt-2 flex items-center justify-between border-t border-border/60 pt-1.5 text-[8px] text-muted-foreground`,children:[(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`span`,{className:`font-mono text-foreground`,children:e.agentCount??0}),` `,t(`activity:office.agentsSuffix`)]}),e.startedAt&&(0,Y.jsx)(`span`,{children:t(`activity:office.upPrefix`,{time:nt(e.startedAt,Date.now())})})]})}function $t({data:e}){let{t}=x(),n=e.status===`active`||e.status===`streaming`,r=e.status===`error`,i=e.status===`offline`,a=e.color||Z.info;return(0,Y.jsxs)(`div`,{className:I(`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,Y.jsx)($,{}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-3 mb-3`,children:[(0,Y.jsx)(`div`,{className:I(`flex items-center justify-center w-10 h-10 rounded-lg`,n?`bg-primary/15`:`bg-primary/10`),children:(0,Y.jsx)(Ce,{className:`h-5 w-5`,style:{color:a}})}),(0,Y.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,Y.jsx)(`div`,{className:`text-xs font-bold truncate`,style:{color:a},children:e.label}),(0,Y.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:t(`activity:office.webuiClient`)})]}),(0,Y.jsx)(Q,{status:e.status,activity:e.vizActivity??0})]}),e.sublabel&&(0,Y.jsx)(`div`,{className:`mb-2 truncate text-[10px] text-muted-foreground`,children:e.sublabel}),(0,Y.jsx)(`div`,{className:`flex items-center gap-2 text-[10px] text-muted-foreground`,children:i?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(ue,{className:`h-3 w-3 text-muted-foreground`}),(0,Y.jsx)(`span`,{children:t(`activity:office.disconnected`)})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(D,{className:`h-3 w-3 text-success`}),(0,Y.jsx)(`span`,{children:t(`activity:office.connected`)})]})}),n&&(0,Y.jsx)(`div`,{className:`mt-2 h-1 overflow-hidden rounded-full bg-primary/20`,children:(0,Y.jsx)(`div`,{className:`h-full animate-pulse bg-primary`,style:{width:`60%`}})}),(0,Y.jsx)(Qt,{data:e})]})}function en({data:e}){let{t}=x(),n=e.status===`active`||e.status===`streaming`,i=e.status===`error`,a=e.color||Z.success;return(0,Y.jsxs)(`div`,{className:I(`rounded-xl border-2 p-4 min-w-[180px] transition-all backdrop-blur-sm`,n&&`shadow-lg shadow-success/15`,i&&`border-destructive/50 bg-destructive/10`,!n&&!i&&`border-success/30 bg-success/10`),children:[(0,Y.jsx)($,{}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-3 mb-3`,children:[(0,Y.jsx)(`div`,{className:I(`flex items-center justify-center w-10 h-10 rounded-lg`,n?`bg-success/15`:`bg-success/10`),children:(0,Y.jsx)(r,{className:`h-5 w-5`,style:{color:a}})}),(0,Y.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,Y.jsx)(`div`,{className:`text-xs font-bold truncate`,style:{color:a},children:e.label}),(0,Y.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:t(`activity:office.tuiClient`)})]}),(0,Y.jsx)(Q,{status:e.status,activity:e.vizActivity??0})]}),e.sublabel&&(0,Y.jsx)(`div`,{className:`mb-2 truncate text-[10px] text-muted-foreground`,children:e.sublabel}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] text-muted-foreground`,children:[(0,Y.jsx)(r,{className:`h-3 w-3 text-success`}),(0,Y.jsx)(`span`,{children:t(`activity:office.terminal`)})]}),(0,Y.jsx)(Qt,{data:e})]})}function tn({data:e}){let{t}=x(),n=e.status===`active`||e.status===`streaming`,i=e.color||Z.warning;return(0,Y.jsxs)(`div`,{className:I(`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,Y.jsx)($,{}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-3 mb-3`,children:[(0,Y.jsx)(`div`,{className:I(`flex items-center justify-center w-10 h-10 rounded-lg`,n?`bg-warning/15`:`bg-warning/10`),children:(0,Y.jsx)(r,{className:`h-5 w-5`,style:{color:i}})}),(0,Y.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,Y.jsx)(`div`,{className:`text-xs font-bold truncate`,style:{color:i},children:e.label}),(0,Y.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:t(`activity:office.repl`)})]}),(0,Y.jsx)(Q,{status:e.status,activity:e.vizActivity??0})]}),e.sublabel&&(0,Y.jsx)(`div`,{className:`mb-1 truncate text-[10px] text-muted-foreground`,children:e.sublabel}),(0,Y.jsx)(Qt,{data:e})]})}function nn({data:e}){let{t}=x(),n=e.status===`active`||e.status===`streaming`,r=e.color||Z.primary;return(0,Y.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,Y.jsx)($,{}),(0,Y.jsx)(`div`,{className:`absolute -top-3 left-1/2 -translate-x-1/2 rounded-full bg-primary px-2 py-0.5 text-[9px] font-bold text-primary-foreground`,children:t(`activity:office.coordinator`)}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-3 mb-3 mt-2`,children:[(0,Y.jsx)(`div`,{className:I(`flex items-center justify-center w-12 h-12 rounded-xl`,n?`bg-primary/15`:`bg-primary/10`),children:(0,Y.jsx)(h,{className:`h-6 w-6`,style:{color:r}})}),(0,Y.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,Y.jsx)(`div`,{className:`text-sm font-bold truncate`,style:{color:r},children:e.label}),(0,Y.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:e.sublabel||t(`activity:office.fleetSummary`)})]}),(0,Y.jsx)(Q,{status:e.status,activity:e.vizActivity??0})]}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 text-[10px] mb-2`,children:[(0,Y.jsxs)(`div`,{className:`rounded bg-muted/40 p-1.5 text-center`,children:[(0,Y.jsxs)(`div`,{className:`font-mono`,children:[(0,Y.jsx)(`span`,{className:`text-success`,children:e.agentsActive||0}),(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:` / `}),(0,Y.jsx)(`span`,{className:`text-primary`,children:e.agentsTotal||0})]}),(0,Y.jsx)(`div`,{className:`text-muted-foreground`,children:t(`activity:officeMap.agents`)})]}),(0,Y.jsxs)(`div`,{className:`rounded bg-muted/40 p-1.5 text-center`,children:[(0,Y.jsx)(`div`,{className:`font-mono text-warning`,children:(e.toolCalls||0).toLocaleString()}),(0,Y.jsx)(`div`,{className:`text-muted-foreground`,children:t(`activity:office.toolCallsLabel`)})]}),(0,Y.jsxs)(`div`,{className:`rounded bg-muted/40 p-1.5 text-center`,children:[(0,Y.jsx)(`div`,{className:`font-mono text-foreground`,children:et(e.tokensIn)}),(0,Y.jsx)(`div`,{className:`text-muted-foreground`,children:t(`activity:office.tokensLabel`)})]}),(0,Y.jsxs)(`div`,{className:`rounded bg-muted/40 p-1.5 text-center`,children:[(0,Y.jsxs)(`div`,{className:`font-mono text-success`,children:[`$`,(e.costUsd||0).toFixed(3)]}),(0,Y.jsx)(`div`,{className:`text-muted-foreground`,children:t(`activity:office.cost`)})]})]}),n&&(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] text-primary`,children:[(0,Y.jsx)(`span`,{className:`h-2 w-2 animate-pulse rounded-full bg-primary`}),t(`activity:office.coordinatingFleet`)]})]})}function rn({data:e}){let{t}=x(),n=e.status===`active`||e.status===`streaming`,r=e.status===`error`,i=e.status===`completed`,a=e.color||Z.primary,o=Zt(e.ctxPct);return(0,Y.jsxs)(`div`,{className:I(`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,Y.jsx)($,{}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 mb-1.5`,children:[(0,Y.jsx)(S,{className:`h-4 w-4 shrink-0`,style:{color:a}}),(0,Y.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,Y.jsx)(`div`,{className:`text-[11px] font-bold truncate`,style:{color:a},children:e.label}),e.model&&(0,Y.jsx)(`div`,{className:`truncate text-[8px] text-muted-foreground`,children:rt(e.model)})]}),(0,Y.jsx)(Q,{status:e.status,small:!0,activity:e.vizActivity??0})]}),e.currentTask&&(0,Y.jsxs)(`div`,{className:`mb-1.5 flex min-w-0 items-center gap-1 overflow-hidden text-[9px] text-primary`,children:[(0,Y.jsx)(`span`,{className:I(`h-1.5 w-1.5 shrink-0 rounded-full bg-primary`,n&&`animate-pulse`)}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate font-mono`,title:e.currentTask,children:it(e.currentTask,72)})]}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-2 gap-y-0.5 text-[9px] mb-1.5`,children:[(0,Y.jsxs)(`div`,{className:`flex justify-between`,children:[(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:`iter`}),(0,Y.jsx)(`span`,{className:`font-mono text-foreground`,children:e.iteration||0})]}),(0,Y.jsxs)(`div`,{className:`flex justify-between`,children:[(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:`tools`}),(0,Y.jsx)(`span`,{className:`font-mono text-warning`,children:e.toolCalls||0})]}),(0,Y.jsxs)(`div`,{className:`flex justify-between`,children:[(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:`tok`}),(0,Y.jsx)(`span`,{className:`font-mono text-foreground`,children:et((e.tokensIn||0)+(e.tokensOut||0))})]}),(0,Y.jsxs)(`div`,{className:`flex justify-between`,children:[(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:`cost`}),(0,Y.jsxs)(`span`,{className:`font-mono text-success`,children:[`$`,(e.costUsd||0).toFixed(3)]})]})]}),o>0&&(0,Y.jsxs)(`div`,{className:`mb-1`,children:[(0,Y.jsxs)(`div`,{className:`mb-0.5 flex justify-between text-[8px] text-muted-foreground`,children:[(0,Y.jsx)(`span`,{children:`ctx`}),(0,Y.jsxs)(`span`,{className:I(`font-mono`,o>=90?`text-destructive`:o>=70?`text-warning`:`text-muted-foreground`),children:[o,`%`]})]}),(0,Y.jsx)(`div`,{className:`h-1 overflow-hidden rounded-full bg-muted`,children:(0,Y.jsx)(`div`,{className:I(`h-full`,o>=90?`bg-destructive`:o>=70?`bg-warning`:`bg-primary`),style:{width:`${o}%`}})})]}),e.lastActivityAt&&(0,Y.jsxs)(`div`,{className:I(`flex items-center gap-1 text-[8px]`,n?`text-muted-foreground/70`:`text-muted-foreground`),children:[i&&(0,Y.jsx)(`span`,{className:`text-success`,children:t(`activity:office.donePrefix`)}),r&&(0,Y.jsx)(`span`,{className:`text-destructive`,children:t(`activity:office.failedPrefix`)}),(0,Y.jsx)(`span`,{children:t(`activity:office.seenPrefix`,{time:tt(e.lastActivityAt,Date.now())})})]})]})}function an({data:e}){let{t}=x();return(0,Y.jsxs)(`div`,{className:I(`rounded-lg border border-dashed p-3 min-w-[120px] transition-all opacity-40`,`border-border/70 bg-muted/30`),children:[(0,Y.jsx)($,{}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,Y.jsx)(P,{className:`h-4 w-4 text-muted-foreground`}),(0,Y.jsx)(`div`,{className:`flex-1 min-w-0`,children:(0,Y.jsx)(`div`,{className:`truncate text-[10px] text-muted-foreground`,children:e.label})}),(0,Y.jsx)(Q,{status:e.status,small:!0,activity:e.vizActivity??0})]}),(0,Y.jsx)(`div`,{className:`text-[9px] text-muted-foreground`,children:t(`activity:office.availableDesk`)})]})}function on({data:e}){let{t}=x(),n=e.color||Z.warning,r=(e.unreadCount||0)>0;return(0,Y.jsxs)(`div`,{className:I(`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,Y.jsx)($,{}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-3 mb-3`,children:[(0,Y.jsx)(`div`,{className:I(`flex items-center justify-center w-10 h-10 rounded-lg`,r?`bg-warning/18`:`bg-warning/10`),children:(0,Y.jsx)(i,{className:`h-5 w-5`,style:{color:n}})}),(0,Y.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,Y.jsx)(`div`,{className:`text-xs font-bold`,style:{color:n},children:t(`activity:office.mailboxHub`)}),(0,Y.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:r?t(`activity:office.unreadSuffix`,{count:e.unreadCount||0}):t(`activity:office.allClear`)})]}),r&&(0,Y.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,Y.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 text-[10px]`,children:[(0,Y.jsxs)(`div`,{className:`rounded bg-muted/40 p-1.5 text-center`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-center gap-1 text-warning`,children:[(0,Y.jsx)(s,{className:`h-3 w-3`}),(0,Y.jsx)(`span`,{children:e.messageCount||0})]}),(0,Y.jsx)(`div`,{className:`text-muted-foreground`,children:t(`activity:office.total`)})]}),(0,Y.jsxs)(`div`,{className:`rounded bg-muted/40 p-1.5 text-center`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-center gap-1 text-success`,children:[(0,Y.jsx)(_,{className:`h-3 w-3`}),(0,Y.jsx)(`span`,{children:e.unreadCount||0})]}),(0,Y.jsx)(`div`,{className:`text-muted-foreground`,children:t(`activity:office.unreadLabel`)})]})]}),e.sublabel&&(0,Y.jsxs)(`div`,{className:`mt-2 truncate border-t border-border/60 pt-1.5 text-[9px] text-muted-foreground`,children:[`✉ `,e.sublabel]})]})}var sn={webui:$t,tui:en,repl:tn,coordinator:nn,agent:rn,mailbox:on,desk:an},cn={wire:({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:i,targetPosition:a,data:o,selected:s})=>{let c=o?.color||Z.primary,l=V(e=>e.animateEdges),u=o?.animated&&l?Math.max(.15,o?.intensity??.6):0,[d,f,p]=Se({sourceX:e,sourceY:t,sourcePosition:i??C.Bottom,targetX:n,targetY:r,targetPosition:a??C.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,Y.jsxs)(Y.Fragment,{children:[(0,Y.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,Y.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,Y.jsx)(`animate`,{attributeName:`stroke-dashoffset`,from:g,to:`0`,dur:_,repeatCount:`indefinite`})}),o?.label&&u>.1&&(0,Y.jsx)(fe,{children:(0,Y.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 ln(){let{t:e}=x(),{clientCounts:t,currentSession:n,totalAgents:i,activeAgents:a,aggregate:o}=Oe(j(e=>({clientCounts:e.clientCounts,currentSession:e.currentSession,totalAgents:e.totalAgents,activeAgents:e.activeAgents,aggregate:e.aggregate}))),s=t.tui+t.webui+t.repl,c=e=>e?.toLocaleString()??`0`;return(0,Y.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,Y.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,Y.jsx)(M,{className:`h-3.5 w-3.5 text-success`}),(0,Y.jsx)(`span`,{className:`text-[10px] font-bold uppercase text-muted-foreground`,children:e(`activity:office.sessionStats`)})]}),(0,Y.jsxs)(`div`,{className:`space-y-1.5 text-[10px]`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(A,{className:`h-3 w-3 text-muted-foreground`}),(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:e(`activity:office.clients`)})]}),(0,Y.jsxs)(`span`,{className:`font-mono text-foreground`,children:[a,` `,(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:`/`}),` `,(0,Y.jsx)(`span`,{className:`text-success`,children:s})]})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-3 pl-4 text-[9px]`,children:[t.tui>0&&(0,Y.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Y.jsx)(r,{className:`h-2.5 w-2.5 text-success`}),(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:`TUI`}),(0,Y.jsx)(`span`,{className:`font-mono text-success`,children:t.tui})]}),t.webui>0&&(0,Y.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Y.jsx)(Ce,{className:`h-2.5 w-2.5 text-primary`}),(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:`WebUI`}),(0,Y.jsx)(`span`,{className:`font-mono text-primary`,children:t.webui})]}),t.repl>0&&(0,Y.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Y.jsx)(r,{className:`h-2.5 w-2.5 text-warning`}),(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:`REPL`}),(0,Y.jsx)(`span`,{className:`font-mono text-warning`,children:t.repl})]})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(S,{className:`h-3 w-3 text-muted-foreground`}),(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:e(`activity:officeMap.agents`)})]}),(0,Y.jsxs)(`span`,{className:`font-mono text-foreground`,children:[a,` `,(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:`/`}),` `,(0,Y.jsx)(`span`,{className:`text-primary`,children:i})]})]}),n.model&&(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(h,{className:`h-3 w-3 text-muted-foreground`}),(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:e(`activity:officeMap.model`)})]}),(0,Y.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,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(me,{className:`h-3 w-3 text-muted-foreground`}),(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:e(`activity:officeMap.mode`)})]}),(0,Y.jsx)(`span`,{className:I(`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,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(_e,{className:`h-3 w-3 text-muted-foreground`}),(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:e(`activity:office.toolCallsLabel`)})]}),(0,Y.jsx)(`span`,{className:`font-mono text-warning`,children:c(o.toolCalls)})]}),(0,Y.jsxs)(`div`,{className:`mt-1.5 space-y-1 border-t border-border/70 pt-1.5`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`text-[8px] text-muted-foreground`,children:`IN`}),(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:e(`activity:office.input`)})]}),(0,Y.jsx)(`span`,{className:`font-mono text-[9px] text-foreground`,children:c(o.tokensIn)})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`text-[8px] text-muted-foreground`,children:`OUT`}),(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:e(`activity:office.output`)})]}),(0,Y.jsx)(`span`,{className:`font-mono text-[9px] text-foreground`,children:c(o.tokensOut)})]})]}),(0,Y.jsxs)(`div`,{className:`mt-1.5 flex items-center justify-between gap-4 border-t border-border/70 pt-1.5`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(f,{className:`h-3 w-3 text-muted-foreground`}),(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:e(`activity:office.cost`)})]}),(0,Y.jsx)(`span`,{className:`font-mono font-medium text-success`,children:(e=>e==null?`$0.0000`:`$${e.toFixed(4)}`)(o.costUsd)})]})]})]})}function un({events:e,now:t}){let{t:n}=x(),r=e.slice(0,14);return(0,Y.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0 z-10 pointer-events-none px-3 pb-3`,children:(0,Y.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,Y.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-1.5 text-[10px] uppercase text-primary`,children:[(0,Y.jsx)(M,{className:`h-3 w-3`}),n(`activity:office.liveActivity`)]}),r.length===0?(0,Y.jsx)(`div`,{className:`text-[11px] italic text-muted-foreground`,children:n(`activity:office.waitingActivity`)}):(0,Y.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,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] leading-tight`,children:[(0,Y.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full shrink-0`,style:{backgroundColor:pt(e.kind)}}),(0,Y.jsx)(`span`,{className:`flex-1 truncate text-foreground`,children:e.label}),(0,Y.jsx)(`span`,{className:`shrink-0 tabular-nums text-muted-foreground`,children:r<1?n(`activity:office.now`):`${r}s`})]},e.id)})})]})})}function dn(){let{t:e}=x(),{fitView:t}=ae(),n=(0,H.useRef)(null),[a,o]=(0,H.useState)({width:1280,height:720});(0,H.useEffect)(()=>{let e=n.current;if(!e)return;let t=()=>{let{width:t,height:n}=e.getBoundingClientRect();t<1||n<1||o(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 c=Te(e=>e.events),l=Ae(e=>e.agents),u=Ae(e=>e.agentTranscripts),f=Ae(e=>e.leaderId),p=Oe(e=>e.liveSessions),g=ke(e=>e.messages),_=ke(e=>e.agents),v=Ee(e=>e.session),y=(0,H.useMemo)(()=>ft(p,l,_),[p,l,_]),C=V(e=>e.showHud),w=V(e=>e.showLegend),T=V(e=>e.showMinimap),D=V(e=>e.showControls),O=V(e=>e.showFeed),k=V(e=>e.setShowFeed),A=V(e=>e.background),[ie,j,se]=de([]),[ce,M,ue]=he([]),[N,fe]=(0,H.useState)(null),[P,pe]=(0,H.useState)(null),[me,ge]=(0,H.useState)(!1),[_e,ye]=(0,H.useState)(``),[F,be]=(0,H.useState)(!1),[xe,Se]=(0,H.useState)(null),we=(0,H.useMemo)(()=>{if(N?.data.kind!==`agent`)return je;let e=N.data.serverId??(N.id.includes(`__agent-`)?N.id.split(`__agent-`).pop():N.id.replace(/^agent-/,``));return e?u.get(e)??je:je},[u,N]),De=(0,H.useCallback)(async()=>{let e=_e.trim();if(!(!e||F)){be(!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();ye(``),Se(`Delivered to ${n.delivered??0}/${n.targets??0} session(s)`)}catch(e){Se(`Failed: ${e instanceof Error?e.message:String(e)}`)}finally{be(!1)}}},[_e,F]),L=(0,H.useRef)(new Map),R=4e3,z=(0,H.useRef)(new Map),B=(0,H.useRef)(new Map),Ne=(0,H.useRef)(new Map),Pe=(0,H.useRef)(new Map),Fe=(0,H.useRef)(``);(0,H.useEffect)(()=>{let n=[],r=[],i=Date.now(),o=at(y.map(e=>({id:e.id,agentCount:e.agents.length})),a),s=g.filter(e=>!e.completed&&(e.readByCount??0)===0).length,c=g.length?[...g].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:s>0?`active`:`idle`,unreadCount:s,messageCount:g.length,sublabel:c?`${c.from} → ${c.to}: ${c.subject}`:void 0,color:Z.warning}});let u=0,d=0,p=0,m=0,h=0;for(let e of y)for(let t of e.agents)d+=1,(t.status===`active`||t.status===`streaming`)&&(u+=1),p+=t.toolCalls,m+=t.costUsd,h+=t.tokensIn+t.tokensOut;let _=f?l.get(f):null,v=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:y.length}),kind:`coordinator`,status:_?.status===`failed`?`error`:v?`active`:`idle`,connections:y.length,agentsActive:u,agentsTotal:d,toolCalls:p,costUsd:m,tokensIn:h,color:Z.primary}});let b={tui:Z.success,webui:Z.info,repl:Z.warning};for(let t of y){let a=o.positions.get(t.id)??{x:600,y:370},c=a.x,l=a.y,u=b[t.type],d=t.status===`active`;if(n.push({id:t.id,type:t.type,position:{x:c,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}}),r.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`}}),r.push({id:`mailbox->${t.id}`,source:`mailbox`,target:t.id,type:`wire`,animated:s>0,data:{color:Z.warning,animated:s>0,label:s>0?`${s}`:void 0,flowType:`mail`}}),t.agents.length===0){n.push({id:`desk-${t.id}`,type:`desk`,position:{x:c,y:l+270},data:{label:e(`activity:office.idleDesk`),kind:`agent`,status:`idle`,color:Z.muted}});continue}t.agents.forEach((a,o)=>{let s=a.status===`active`||a.status===`streaming`,u=Pe.current.get(a.serverId);if(u&&(a.toolCalls>u.toolCalls||a.iteration>u.iteration)||s){L.current.set(a.officeId,i+R);let e=B.current.get(a.officeId)??0;B.current.set(a.officeId,Math.min(1,e+(1-e)*.5));for(let e of[`${t.id}->${a.officeId}`,`${t.id}->coordinator`]){let t=z.current.get(e)??0;z.current.set(e,Math.min(1,t+.5))}}Pe.current.set(a.serverId,{toolCalls:a.toolCalls,iteration:a.iteration}),n.push({id:a.officeId,type:`agent`,position:ot(c,o,t.agents.length,l+270),data:{label:a.name,kind:`agent`,status:a.status,serverId:a.serverId,sessionId:t.sessionId,currentTask:a.currentTask,iteration:a.iteration,toolCalls:a.toolCalls,costUsd:a.costUsd,tokensIn:a.tokensIn,tokensOut:a.tokensOut,ctxPct:a.ctxPct,model:a.model,lastActivityAt:a.lastActivityAt,color:Z.primary}}),r.push({id:`${t.id}->${a.officeId}`,source:t.id,target:a.officeId,type:`wire`,animated:s,data:{color:Z.primary,animated:s,label:s?it(a.currentTask,48)??e(`activity:office.taskFallback`):void 0,flowType:`task`}})})}let ee=new Set(y.flatMap(e=>e.agents.map(e=>e.serverId)));for(let e of[...Pe.current.keys()])ee.has(e)||Pe.current.delete(e);let x=n.map(e=>{let t=L.current.get(e.id),n=B.current.get(e.id)??0;return t&&t>i&&e.data.status!==`error`&&e.data.status!==`offline`?{...e,data:{...e.data,status:`active`,vizActivity:n}}:{...e,data:{...e.data,vizActivity:n}}}),S=r.map(e=>{let t=z.current.get(e.id)??0;return t>.05?{...e,animated:!0,data:{...e.data,animated:!0,intensity:t}}:e}),C=new Map;for(let e of x)C.set(e.id,{...e.position});Ne.current=C,j(x),M(S);let te=[`${Math.round(a.width)}x${Math.round(a.height)}`,`${o.columns}x${o.rows}`,y.map(e=>`${e.id}:${e.agents.length}`).join(`|`),x.map(e=>e.id).sort().join(`|`)].join(`:`);if(te!==Fe.current){Fe.current=te;let e=setTimeout(()=>t({padding:Xt,duration:300}),50);return()=>clearTimeout(e)}},[y,f,l,g,v,a,R,j,M,t]);let U=y.flatMap(e=>e.agents.map(t=>({clientId:e.id,clientType:e.type,officeId:t.officeId,serverId:t.serverId}))),W=y.map(e=>e.id),G=new Map;for(let e of U)(!G.has(e.serverId)||e.clientType===`webui`)&&G.set(e.serverId,e.officeId);function K(e){return G.get(e)??`agent-${e}`}function q(e){let t=e.split(`__agent-`)[0];return t&&t!==e?`${t}->${e}`:`coordinator->${e}`}function Ie(e){switch(e.kind){case`mailbox:send`:case`mailbox:deliver`:return{nodes:[`mailbox`],edges:e.kind===`mailbox:send`?W.map(e=>`mailbox->${e}`):[],status:`active`};case`agent:spawned`:{let t=K(e.source);return{nodes:[`coordinator`,t],edges:[q(t)],status:`active`}}case`agent:tool`:case`tool:started`:case`tool:progress`:{let t=K(e.source);return{nodes:[`coordinator`,t],edges:[q(t)],status:e.kind===`tool:progress`||e.kind===`tool:started`?`streaming`:`active`}}case`tool:executed`:{let t=K(e.target??e.source);return{nodes:[t],edges:[q(t)],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:U.map(e=>q(e.officeId)),status:e.kind===`iteration:start`?`streaming`:`active`};case`agent:text`:{let t=K(e.source);return{nodes:[t],edges:[q(t)],status:`streaming`}}case`agent:status`:{let t=K(e.source);return{nodes:[`coordinator`,t],edges:[q(t)],status:e.data&&typeof e.data==`object`&&`status`in e.data&&String(e.data.status)===`failed`?`error`:`completed`}}case`agent:ctx`:return{nodes:[K(e.source)],edges:[],status:`active`};case`budget:extended`:return{nodes:[`coordinator`,K(e.source)],edges:[],status:`active`};case`context:compacted`:case`context:repaired`:return{nodes:[`coordinator`],edges:[],status:`active`};case`error`:return{nodes:e.source?[K(e.source)]:[],edges:[],status:`error`};case`cost:update`:return{nodes:[`coordinator`],edges:[],status:`active`};case`fleet:snapshot`:{let t=e.data?.sessions??[],n=[`coordinator`];for(let e of t)if(e.agents)for(let t of e.agents){let e=K(t.id);n.includes(e)||n.push(e)}return{nodes:n,edges:[],status:`active`}}default:return{nodes:[],edges:[],status:`idle`}}}(0,H.useEffect)(()=>{if(c.length===0)return;let e=c[0];if(!e)return;let{nodes:t,edges:n,status:r}=Ie(e),i=Date.now();t.length>0&&(t.forEach(e=>{L.current.set(e,i+R);let t=B.current.get(e)??0;B.current.set(e,Math.min(1,t+(1-t)*.5))}),j(e=>e.map(e=>t.includes(e.id)?{...e,data:{...e.data,status:r,vizActivity:B.current.get(e.id)??0}}:e))),n.length>0&&(n.forEach(e=>{let t=z.current.get(e)??0;z.current.set(e,Math.min(1,t+.5))}),M(e=>e.map(e=>n.includes(e.id)?{...e,animated:!0,data:{...e.data,animated:!0,intensity:z.current.get(e.id)??1}}:e)))},[c,j,M,R,l]),(0,H.useEffect)(()=>{let e=setInterval(()=>{let e=new Map,t=!1;for(let[n,r]of z.current){let i=r*.85;i<.05?(z.current.delete(n),e.set(n,{intensity:0,animated:!1}),t=!0):(z.current.set(n,i),e.set(n,{intensity:i,animated:!0}),t=!0)}t&&M(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 B.current){let i=t*.9;i<.03?(B.current.delete(e),n.set(e,0),r=!0):(B.current.set(e,i),n.set(e,i),r=!0)}r&&j(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)},[M,j]);let Le=(0,H.useCallback)(e=>M(t=>ne({...e,type:`wire`},t)),[M]),Re=(0,H.useCallback)((e,t)=>{fe(t)},[]),ze=(0,H.useCallback)(()=>{fe(null)},[]);(0,H.useEffect)(()=>{if(!P)return;let e=e=>{e.key===`Escape`&&pe(null)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[P]);let Be=(0,H.useCallback)(()=>{j(e=>e.map(e=>{let t=Ne.current.get(e.id);return t?{...e,position:{...t}}:e})),setTimeout(()=>t({padding:Xt,duration:300}),50)},[j,t]),[,Ve]=(0,H.useState)(0);return(0,H.useEffect)(()=>{let e=setInterval(()=>{document.hidden||Ve(e=>e+1)},2e3);return()=>clearInterval(e)},[]),(0,Y.jsxs)(`div`,{ref:n,className:`relative h-full w-full overflow-hidden bg-[hsl(var(--surface-2)/0.55)]`,children:[(0,Y.jsx)(`div`,{className:`absolute inset-0 opacity-[0.03]`,style:{backgroundImage:`
2
+ linear-gradient(rgba(255,255,255,0.1) 1px, transparent 1px),
3
+ linear-gradient(90deg, rgba(255,255,255,0.1) 1px, transparent 1px)
4
+ `,backgroundSize:`40px 40px`}}),C&&(0,Y.jsx)(ln,{}),(0,Y.jsx)(`div`,{className:`absolute top-3 left-1/2 -translate-x-1/2 z-10`,children:(0,Y.jsx)(`div`,{className:`rounded-lg border border-border/70 bg-card/90 px-4 py-2 shadow-xl backdrop-blur`,children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-bold text-foreground`,children:[(0,Y.jsx)(b,{className:`h-4 w-4 text-primary`}),e(`activity:office.fleetHq`),(0,Y.jsx)(`span`,{className:`ml-2 h-2 w-2 animate-pulse rounded-full bg-success`}),(0,Y.jsx)(`span`,{className:`text-[10px] font-normal text-muted-foreground`,children:e(`activity:office.live`)})]})})}),w&&(0,Y.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,Y.jsx)(`div`,{className:`mb-2 font-bold text-foreground`,children:e(`activity:office.legendStatus`)}),(0,Y.jsxs)(`div`,{className:`space-y-1`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`h-2 w-2 animate-pulse rounded-full bg-success`}),(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:e(`activity:office.legendActive`)})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`h-2 w-2 rounded-full bg-muted-foreground`}),(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:e(`activity:office.legendIdle`)})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`h-2 w-2 animate-pulse rounded-full bg-destructive`}),(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:e(`activity:office.legendError`)})]})]})]}),w&&(0,Y.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,Y.jsx)(`div`,{className:`mb-2 font-bold text-foreground`,children:e(`activity:office.legendConnections`)}),(0,Y.jsxs)(`div`,{className:`space-y-1`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`text-warning`,children:`✉`}),(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:e(`activity:office.legendMail`)})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`text-primary`,children:`→`}),(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:e(`activity:office.legendTask`)})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`text-success`,children:`●`}),(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:e(`activity:office.legendStatusConn`)})]})]})]}),(0,Y.jsxs)(re,{nodes:ie,edges:ce,onNodesChange:se,onEdgesChange:ue,onConnect:Le,onNodeClick:Re,onPaneClick:ze,nodeTypes:sn,edgeTypes:cn,fitView:!0,fitViewOptions:{padding:Xt},minZoom:.15,maxZoom:1.5,defaultEdgeOptions:{type:`wire`},proOptions:{hideAttribution:!0},children:[(0,Y.jsxs)(le,{position:`top-right`,className:`flex items-center gap-2`,children:[(0,Y.jsxs)(`button`,{type:`button`,onClick:Be,title:e(`activity:office.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,Y.jsx)(d,{className:`h-3.5 w-3.5`}),e(`activity:office.arrange`)]}),(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>k(!O),title:e(`activity:office.feedTitle`),className:I(`flex items-center gap-1.5 px-2.5 py-1.5 rounded-md border text-xs transition-colors`,O?`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,Y.jsx)(ee,{className:`h-3.5 w-3.5`}),e(`activity:office.feed`)]}),(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>ge(e=>!e),title:e(`activity:office.broadcastTitle`),className:I(`flex items-center gap-1.5 px-2.5 py-1.5 rounded-md border text-xs transition-colors`,me?`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,Y.jsx)(s,{className:`h-3.5 w-3.5`}),e(`activity:office.broadcast`)]})]}),A!==`none`&&(0,Y.jsx)(ve,{variant:A===`lines`?oe.Lines:A===`cross`?oe.Cross:oe.Dots,gap:20,size:1,color:`hsl(var(--border) / 0.35)`}),D&&(0,Y.jsx)(te,{className:`rounded-lg border border-border/70 bg-card/90 [&>button]:bg-card [&>button]:text-foreground`}),T&&(0,Y.jsx)(E,{className:`rounded-lg border border-border/70 bg-card/90`,nodeColor:e=>{switch(e.data.kind){case`coordinator`:return Z.primary;case`webui`:return Z.info;case`tui`:return Z.success;case`repl`:return Z.warning;case`mailbox`:return Z.warning;case`agent`:return Z.primary;default:return Z.primary}},maskColor:`hsl(var(--background) / 0.72)`})]}),O&&(0,Y.jsx)(un,{events:c,now:Date.now()}),me&&(0,Y.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,Y.jsxs)(`div`,{className:`mb-1.5 flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] font-semibold text-warning`,children:[(0,Y.jsx)(s,{className:`h-3.5 w-3.5`}),` `,e(`activity:office.broadcastToAll`)]}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>ge(!1),className:`text-base leading-none text-muted-foreground hover:text-foreground`,children:`×`})]}),(0,Y.jsx)(`textarea`,{value:_e,onChange:e=>ye(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),De())},rows:3,placeholder:e(`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,Y.jsxs)(`div`,{className:`mt-1.5 flex items-center justify-between`,children:[(0,Y.jsx)(`span`,{className:`text-[9px] text-muted-foreground`,children:e(`activity:office.broadcastSendHint`)}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>void De(),disabled:F||!_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:F?`…`:e(`activity:office.broadcast`)})]}),xe&&(0,Y.jsx)(`div`,{className:`mt-1 text-[10px] text-muted-foreground`,children:xe})]}),N&&(0,Y.jsxs)(`div`,{className:I(`absolute top-20 right-4 bg-background border border-border rounded-lg p-4 shadow-xl z-20`,N.data.kind===`agent`?`w-[28rem] max-w-[calc(100%-2rem)]`:N.data.sessionId?`w-80`:`w-64`),children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[N.data.kind===`webui`&&(0,Y.jsx)(Ce,{className:`h-4 w-4 text-info`}),N.data.kind===`tui`&&(0,Y.jsx)(r,{className:`h-4 w-4 text-success`}),N.data.kind===`coordinator`&&(0,Y.jsx)(h,{className:`h-4 w-4 text-primary`}),N.data.kind===`agent`&&(0,Y.jsx)(S,{className:`h-4 w-4 text-primary`}),N.data.kind===`mailbox`&&(0,Y.jsx)(i,{className:`h-4 w-4 text-warning`}),(0,Y.jsx)(`span`,{className:`text-sm font-bold text-foreground`,children:N.data.label})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[N.data.sessionId&&(0,Y.jsx)(`button`,{type:`button`,title:e(`activity:office.openFullView`),onClick:()=>pe({sessionId:N.data.sessionId,label:N.data.label}),className:`text-muted-foreground hover:text-primary`,children:(0,Y.jsx)(m,{className:`h-3.5 w-3.5`})}),(0,Y.jsx)(`button`,{type:`button`,onClick:ze,className:`text-muted-foreground hover:text-foreground text-lg leading-none`,children:`×`})]})]}),(()=>{let t=N.data,n=Date.now(),r=({k:e,v:t,accent:n})=>(0,Y.jsxs)(`div`,{className:`flex justify-between gap-3`,children:[(0,Y.jsx)(`span`,{className:`text-muted-foreground shrink-0`,children:e}),(0,Y.jsx)(`span`,{className:I(`font-mono truncate text-right`,n??`text-foreground/80`),children:t})]}),i=t.kind===`agent`,a=t.kind===`webui`||t.kind===`tui`||t.kind===`repl`,o=(t.tokensIn||0)+(t.tokensOut||0),s=Zt(t.ctxPct);return(0,Y.jsxs)(`div`,{className:`space-y-1.5 text-xs`,children:[(0,Y.jsx)(r,{k:`Status`,v:String(t.status).toUpperCase(),accent:I(t.status===`active`&&`text-success`,t.status===`streaming`&&`text-primary`,t.status===`error`&&`text-destructive`,t.status===`idle`&&`text-muted-foreground`,t.status===`offline`&&`text-muted-foreground/70`)}),i&&(0,Y.jsxs)(Y.Fragment,{children:[t.model&&(0,Y.jsx)(r,{k:`Model`,v:rt(t.model),accent:`text-primary`}),t.currentTask&&(0,Y.jsxs)(`div`,{className:`pt-1`,children:[(0,Y.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground`,children:e(`activity:agentOffice.currentTask`)}),(0,Y.jsx)(`div`,{className:`mt-1 max-h-32 overflow-y-auto whitespace-pre-wrap break-words font-mono text-[10px] text-primary`,children:t.currentTask})]}),(0,Y.jsx)(r,{k:`Iterations`,v:t.iteration||0,accent:`text-primary`}),(0,Y.jsx)(r,{k:`Tool calls`,v:t.toolCalls||0,accent:`text-warning`}),(0,Y.jsx)(r,{k:`Tokens in`,v:et(t.tokensIn)}),(0,Y.jsx)(r,{k:`Tokens out`,v:et(t.tokensOut)}),(0,Y.jsx)(r,{k:`Tokens total`,v:et(o)}),s>0&&(0,Y.jsx)(r,{k:`Context`,v:`${s}%`,accent:s>=90?`text-destructive`:s>=70?`text-warning`:`text-foreground/70`}),(0,Y.jsx)(r,{k:`Cost`,v:`$${(t.costUsd||0).toFixed(4)}`,accent:`text-success`}),t.lastActivityAt&&(0,Y.jsx)(r,{k:`Last seen`,v:tt(t.lastActivityAt,n),accent:`text-muted-foreground`}),(0,Y.jsx)(`div`,{className:`pt-2`,children:(0,Y.jsx)(Me,{entries:we,agentName:t.label,compact:!0,maxHeightClassName:`max-h-64`})})]}),a&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(r,{k:`Surface`,v:ct(t.kind),accent:`text-foreground/80`}),t.branch&&(0,Y.jsx)(r,{k:`Branch`,v:`⎇ ${t.branch}`,accent:`text-foreground/70`}),t.pid!=null&&(0,Y.jsx)(r,{k:`PID`,v:t.pid}),t.workingDir&&(0,Y.jsx)(r,{k:`Dir`,v:t.workingDir,accent:`text-muted-foreground`}),(0,Y.jsx)(r,{k:`Agents`,v:t.agentCount??0,accent:`text-primary`}),t.startedAt&&(0,Y.jsx)(r,{k:`Uptime`,v:nt(t.startedAt,n),accent:`text-foreground/70`})]}),t.kind===`mailbox`&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(r,{k:`Total messages`,v:t.messageCount||0,accent:`text-warning`}),(0,Y.jsx)(r,{k:`Unread`,v:t.unreadCount||0,accent:`text-warning`}),g.length>0&&(0,Y.jsxs)(`div`,{className:`mt-1 space-y-1 border-t border-border pt-2`,children:[(0,Y.jsx)(`div`,{className:`text-[10px] uppercase tracking-wide text-muted-foreground`,children:e(`activity:office.recent`)}),[...g].sort((e,t)=>Date.parse(t.timestamp)-Date.parse(e.timestamp)).slice(0,6).map(t=>(0,Y.jsxs)(`div`,{className:`flex items-start gap-1.5 text-[10px]`,children:[(0,Y.jsx)(`span`,{className:I(`mt-1 h-1.5 w-1.5 shrink-0 rounded-full`,!t.completed&&(t.readByCount??0)===0?`bg-warning`:t.completed?`bg-success`:`bg-muted`)}),(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`div`,{className:`truncate text-foreground/80`,children:t.subject||e(`activity:office.noSubject`)}),(0,Y.jsxs)(`div`,{className:`truncate font-mono text-[9px] text-muted-foreground`,children:[t.from,` → `,t.to,` · `,tt(t.timestamp,n)]})]})]},t.id))]})]}),t.kind===`coordinator`&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(r,{k:`Connections`,v:t.connections||0,accent:`text-primary`}),(0,Y.jsx)(r,{k:`Iterations`,v:t.iteration||0,accent:`text-primary`})]}),(i||a)&&t.sessionId&&(0,Y.jsx)(`div`,{className:`mt-2 border-t border-border pt-2 h-72`,children:(0,Y.jsx)(Yt,{sessionId:t.sessionId})})]})})()]}),P&&(0,Y.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,Y.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border px-4 py-2.5 shrink-0 bg-card`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,Y.jsx)(S,{className:`h-4 w-4 text-primary shrink-0`}),(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`div`,{className:`truncate text-sm font-bold text-foreground`,children:P.label}),(0,Y.jsx)(`div`,{className:`text-[10px] uppercase tracking-wide text-muted-foreground`,children:e(`activity:office.fullOperationStream`)})]})]}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>pe(null),title:e(`activity:office.closeEsc`),className:`text-muted-foreground hover:text-foreground text-xl leading-none shrink-0`,children:`×`})]}),(0,Y.jsx)(`div`,{className:`flex-1 min-h-0 p-4`,children:(0,Y.jsx)(Yt,{sessionId:P.sessionId,limit:500})})]})]})}function fn(){let{t:e}=x(),t=V(e=>e.viewMode),n=V(e=>e.setViewMode),r=[{id:`office`,label:e(`activity:agentOffice.office`),description:e(`activity:agentOffice.officeDescription`),icon:ie},{id:`topology`,label:e(`activity:agentOffice.topology`),description:e(`activity:agentOffice.topologyDescription`),icon:N}],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,Y.jsxs)(`div`,{className:`flex h-full min-h-0 w-full flex-col bg-background`,children:[(0,Y.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,Y.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,Y.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:I(`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,Y.jsx)(`span`,{className:I(`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,Y.jsx)(a,{className:`h-4 w-4`,"aria-hidden":`true`})}),(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[(0,Y.jsx)(`strong`,{className:`block truncate font-display text-xs font-semibold sm:text-sm`,children:e.label}),(0,Y.jsx)(`small`,{className:`hidden truncate font-mono text-[9px] font-normal text-muted-foreground sm:block`,children:e.description})]}),(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:I(`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,Y.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,Y.jsx)(Ht,{}):(0,Y.jsx)(be,{children:(0,Y.jsx)(dn,{})})})]})}export{fn as OfficeMapPanel};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{At as t,Ct as n,Pt as r,Yi as i,ea as a,tt as o}from"./vendor-JNPeA-SL.js";import"./i18n-BcnwAuXt.js";import{t as s}from"./utils-BLVofF8S.js";import{A as c,N as l,O as u,P as d,at as f,k as p}from"./index-MIiPbE0D.js";var m=e(a(),1),h=o();function g({open:e,onClose:a,className:o}){let{t:g}=i(),[_,v]=(0,m.useState)([]),y=d(),b=f(e=>e.wsConnected),x=(0,m.useRef)(null),S=(0,m.useRef)(null);(0,m.useEffect)(()=>{if(!(!e||!b||!y.client?.isConnected))return y.client.send?.({type:`process.list`}),x.current=y.client.on?.(`process.list`,e=>{let t=e?.payload;t?.processes&&v(t.processes)})??null,S.current=setInterval(()=>{y.client.send?.({type:`process.list`})},3e3),()=>{x.current?.(),S.current&&clearInterval(S.current)}},[e,b,y.client]);let C=(0,m.useCallback)(e=>{y.client.send?.({type:`process.kill`,payload:{pid:e}})},[y.client]),w=(0,m.useCallback)(()=>{y.client.send?.({type:`process.killAll`})},[y.client]),T=_.filter(e=>e.status===`running`);return(0,h.jsx)(u,{open:e,onOpenChange:e=>{e||a()},children:(0,h.jsxs)(p,{className:s(`max-w-lg gap-0 p-0 overflow-hidden flex flex-col max-h-[75dvh] pt-[10dvh]`,o),showCloseButton:!1,children:[(0,h.jsx)(l,{className:`sr-only`,children:g(`activity:process.heading`)}),(0,h.jsx)(c,{className:`sr-only`,children:g(`activity:process.subtitle`,{active:T.length,total:_.length})}),(0,h.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3 border-b shrink-0`,children:[(0,h.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,h.jsx)(`span`,{className:`flex items-center justify-center w-8 h-8 rounded-lg bg-warning/10 text-warning`,children:(0,h.jsx)(n,{className:`h-4 w-4`})}),(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`h2`,{className:`text-sm font-semibold`,children:g(`activity:process.heading`)}),(0,h.jsx)(`span`,{className:`text-[10px] text-muted-foreground tabular-nums`,children:g(`activity:process.subtitle`,{active:T.length,total:_.length})})]})]}),(0,h.jsx)(`div`,{className:`flex items-center gap-1`,children:T.length>0&&(0,h.jsxs)(`button`,{type:`button`,onClick:w,className:`flex items-center gap-1.5 px-2.5 py-1.5 rounded-md text-xs text-destructive hover:bg-destructive/10 transition-colors font-medium`,children:[(0,h.jsx)(t,{className:`h-3 w-3 fill-current`}),g(`activity:process.killAll`)]})})]}),(0,h.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain`,children:_.length===0?(0,h.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16 gap-3 text-muted-foreground`,children:[(0,h.jsx)(n,{className:`h-10 w-10 opacity-15`}),(0,h.jsx)(`p`,{className:`text-sm font-medium`,children:g(`activity:process.emptyTitle`)}),(0,h.jsx)(`p`,{className:`text-xs text-center max-w-xs`,children:g(`activity:process.emptyBody`)})]}):(0,h.jsx)(`div`,{className:`divide-y`,children:_.map(e=>{let n=e.status===`running`?Math.floor((Date.now()-e.startedAt)/1e3):null,i=n?n<60?`${n}s`:`${Math.floor(n/60)}m ${n%60}s`:null,a=e.protected===!0;return(0,h.jsxs)(`div`,{className:s(`flex items-center justify-between px-4 py-3 text-xs transition-colors`,e.status===`running`?`bg-background hover:bg-muted/30`:`bg-muted/20 text-muted-foreground`),children:[(0,h.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0 flex-1`,children:[(0,h.jsx)(`span`,{className:s(`led shrink-0`,e.status===`running`?a?`text-info`:`text-success led-pulse`:`text-muted-foreground`)}),(0,h.jsxs)(`div`,{className:`min-w-0`,children:[(0,h.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,h.jsx)(`span`,{className:`font-mono text-[10px] text-muted-foreground shrink-0`,children:g(`activity:process.pidLabel`,{pid:e.pid})}),(0,h.jsx)(`span`,{className:`font-medium truncate`,children:e.tool}),a&&(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 px-1 py-0.5 rounded text-[9px] bg-info/10 text-info font-medium shrink-0`,title:g(`activity:process.protectedTitle`),children:[(0,h.jsx)(r,{className:`h-2.5 w-2.5`}),g(`activity:process.protected`)]})]}),(0,h.jsx)(`code`,{className:`text-[10px] text-muted-foreground/70 truncate block mt-0.5 font-mono`,children:e.command})]})]}),(0,h.jsxs)(`div`,{className:`flex items-center gap-3 shrink-0 ml-3`,children:[i&&(0,h.jsx)(`span`,{className:`text-[10px] text-muted-foreground tabular-nums`,children:i}),e.status===`running`&&!a&&(0,h.jsx)(`button`,{type:`button`,onClick:()=>C(e.pid),className:`p-1.5 rounded-md hover:bg-destructive/10 hover:text-destructive transition-colors`,title:g(`activity:process.killTitle`,{pid:e.pid}),children:(0,h.jsx)(t,{className:`h-3.5 w-3.5 fill-current`})})]})]},e.pid)})})})]})})}export{g as ProcessMonitor};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./chat-store-BJ55HZKb.js";import{Gi as n,Ki as r,Nn as i,Yi as a,at as o,ea as s,tt as c,xt as l}from"./vendor-JNPeA-SL.js";import"./i18n-BcnwAuXt.js";import{t as u}from"./utils-BLVofF8S.js";import{A as d,N as f,O as p,k as m}from"./index-MIiPbE0D.js";var h=e(s(),1),g=c(),_={btw:{label:`btw`,titleKey:`btwTitle`,tone:`bg-primary/10 text-primary border-primary/30`},steer:{label:`steer`,titleKey:`steerTitle`,tone:`bg-warning/10 text-warning border-warning/35`},queue:{label:`queue`,titleKey:`queueTitle`,tone:`bg-info/10 text-info border-info/30`}};function v({open:e,onClose:s,className:c}){let{t:v}=a(),y=t(e=>e.queue),b=t(e=>e.removeQueued),x=t(e=>e.clearQueue),[S,C]=(0,h.useState)(`oldest`),w=(0,h.useCallback)(e=>{b(e)},[b]),T=(0,h.useMemo)(()=>{let e=y.map((e,t)=>({item:e,sourceIdx:t}));return e.sort((e,t)=>S===`newest`?t.item.addedAt-e.item.addedAt:e.item.addedAt-t.item.addedAt),e},[y,S]);return(0,g.jsx)(p,{open:e,onOpenChange:e=>{e||s()},children:(0,g.jsxs)(m,{className:u(`max-w-lg gap-0 overflow-hidden border-border/80 bg-card p-0 pt-[10dvh] flex flex-col max-h-[70dvh]`,c),showCloseButton:!1,children:[(0,g.jsx)(f,{className:`sr-only`,children:v(`activity:queue.heading`)}),(0,g.jsx)(d,{className:`sr-only`,children:v(`activity:queue.subtitle`,{count:y.length})}),(0,g.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border/70 bg-card/95 px-4 py-3 shrink-0`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,g.jsx)(`span`,{className:`flex items-center justify-center w-8 h-8 rounded-md border border-primary/20 bg-primary/10 text-primary`,children:(0,g.jsx)(i,{className:`h-4 w-4`})}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`h2`,{className:`text-sm font-semibold`,children:v(`activity:queue.heading`)}),(0,g.jsx)(`span`,{className:`text-[10px] text-muted-foreground tabular-nums`,children:v(`activity:queue.subtitle`,{count:y.length})})]})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,g.jsxs)(`button`,{type:`button`,onClick:()=>C(e=>e===`newest`?`oldest`:`newest`),className:u(`flex items-center gap-1.5 px-2.5 py-1.5 rounded-md text-xs transition-colors font-medium`,`text-muted-foreground hover:bg-muted hover:text-foreground`),title:v(S===`newest`?`activity:queue.sortNewestTitle`:`activity:queue.sortOldestTitle`),"data-testid":`queue-sort-toggle`,children:[S===`newest`?(0,g.jsx)(r,{className:`h-3 w-3`}):(0,g.jsx)(n,{className:`h-3 w-3`}),v(S===`newest`?`activity:queue.newest`:`activity:queue.oldest`)]}),y.length>0&&(0,g.jsxs)(`button`,{type:`button`,onClick:()=>x(),className:`flex items-center gap-1.5 px-2.5 py-1.5 rounded-md text-xs text-destructive hover:bg-destructive/10 transition-colors font-medium`,title:v(`activity:queue.clearTitle`),"data-testid":`queue-clear-all`,children:[(0,g.jsx)(l,{className:`h-3 w-3`}),v(`activity:queue.clear`)]})]})]}),(0,g.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain`,children:y.length===0?(0,g.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16 gap-3 text-muted-foreground`,children:[(0,g.jsx)(i,{className:`h-10 w-10 opacity-15`}),(0,g.jsx)(`p`,{className:`text-sm font-medium`,children:v(`activity:queue.emptyTitle`)}),(0,g.jsx)(`p`,{className:`text-xs text-center max-w-xs`,children:v(`activity:queue.emptyBody`)})]}):(0,g.jsx)(`ul`,{className:`divide-y divide-border/60`,"data-testid":`queue-list`,children:T.map(({item:e,sourceIdx:t},n)=>{let r=_[e.mode];return(0,g.jsxs)(`li`,{className:`flex items-start justify-between gap-3 px-4 py-3 text-xs transition-colors hover:bg-muted/35`,"data-testid":`queue-item`,children:[(0,g.jsxs)(`div`,{className:`flex items-start gap-3 min-w-0 flex-1`,children:[(0,g.jsxs)(`span`,{className:`mt-1 text-[10px] font-mono text-muted-foreground shrink-0 w-5 text-right tabular-nums`,children:[n+1,`.`]}),(0,g.jsx)(`span`,{className:u(`shrink-0 inline-flex items-center justify-center rounded border px-1.5 py-0.5 text-[10px] font-semibold uppercase`,r.tone),title:v(`activity:queue.${r.titleKey}`),"data-testid":`queue-mode-${e.mode}`,children:r.label}),(0,g.jsx)(`p`,{className:`text-sm text-foreground leading-relaxed min-w-0 break-words`,children:e.text.length>120?`${e.text.slice(0,117)}…`:e.text})]}),(0,g.jsx)(`button`,{type:`button`,onClick:()=>w(t),className:`ml-1 p-1.5 rounded-md shrink-0 hover:bg-destructive/10 hover:text-destructive transition-colors`,title:v(`activity:queue.removeTitle`),"data-testid":`queue-remove-${t}`,children:(0,g.jsx)(o,{className:`h-3.5 w-3.5`})})]},`${e.addedAt}-${t}`)})})}),y.length>0&&(0,g.jsx)(`div`,{className:`border-t border-border/70 bg-muted/20 px-4 py-2.5 shrink-0`,children:(0,g.jsx)(`p`,{className:`text-[10px] text-muted-foreground text-center`,children:v(`activity:queue.footer`)})})]})})}export{v as QueuePanel};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./chat-store-BJ55HZKb.js";import{Cr as n,Hi as r,Kn as i,Vt as a,Yi as o,di as s,ea as c,li as l,qt as u,tt as d}from"./vendor-JNPeA-SL.js";import"./i18n-BcnwAuXt.js";import{n as f}from"./ui-store-lBwi9h6q.js";import{t as p}from"./session-store-CgCoJmdF.js";var m=e(c(),1),h=d();function g(){let e=p(e=>e.session),{t:c}=o(),d=p.getState().session?.id,g=p(e=>e.projectName),x=p(e=>e.cwd),S=p(e=>e.mode),C=p(e=>e.contextMode),w=p(e=>e.lastVisitedAt),T=t(e=>e.messages),E=t(e=>e.queue.length),D=t(e=>e.boundSessionId),O=f(e=>e.currentView),k=f(e=>e.dockSection),[A,j]=(0,m.useState)([]),M=(0,m.useMemo)(()=>{if(typeof window>`u`)return 0;let e=0;for(let t of[`wrongstack-session`,`wrongstack-chat`,`wrongstack-ui`,`wrongstack-config`]){let n=window.localStorage.getItem(t);typeof n==`string`&&(e+=n.length)}return e},[T.length]),N=typeof window<`u`&&!!window.__wrongstackSessionRehydrated,P=typeof window<`u`&&!!window.__wrongstackChatRehydrated;function F(e,t){j(n=>[{ts:Date.now(),note:e,ok:t},...n].slice(0,20))}function I(){F(c(`activity:refresh.simulatedF5`),!0)}let L=D!==null&&d!==void 0?D!==d:!1;return(0,h.jsx)(`div`,{className:`h-full min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain bg-[hsl(var(--surface-2)/0.45)] p-4 sm:p-6`,children:(0,h.jsxs)(`div`,{className:`mx-auto max-w-5xl space-y-5 sm:space-y-6`,children:[(0,h.jsx)(`header`,{className:`rounded-xl border border-border/70 bg-card/75 p-4 shadow-sm`,children:(0,h.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,h.jsxs)(`div`,{className:`min-w-0`,children:[(0,h.jsxs)(`h1`,{className:`flex min-w-0 items-center gap-2 text-xl font-bold sm:text-2xl`,children:[(0,h.jsx)(u,{className:`h-6 w-6 shrink-0 text-primary sm:h-7 sm:w-7`}),c(`activity:refresh.heading`)]}),(0,h.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:c(`activity:refresh.subtitle`)})]}),(0,h.jsx)(`button`,{type:`button`,onClick:I,className:`inline-flex h-9 w-full items-center justify-center rounded-md bg-primary px-3 text-sm font-medium text-primary-foreground shadow-sm shadow-primary/15 hover:bg-primary/90 sm:w-auto`,children:c(`activity:refresh.recordProbe`)})]})}),(0,h.jsxs)(`section`,{className:`space-y-3`,children:[(0,h.jsxs)(`h2`,{className:`text-lg font-semibold flex items-center gap-2`,children:[(0,h.jsx)(l,{className:`w-5 h-5`}),c(`activity:refresh.latestSession`)]}),(0,h.jsx)(_,{label:c(`activity:refresh.restoredLocal`),ok:N,extra:d?c(`activity:refresh.sessionIdExtra`,{id:d}):c(`activity:refresh.noSessionYet`)}),(0,h.jsx)(_,{label:c(`activity:refresh.activePointer`),ok:!!e?.id,extra:e?y(e):`null`}),(0,h.jsx)(_,{label:c(`activity:refresh.lastVisited`),ok:w>0,extra:w>0?new Date(w).toISOString():c(`activity:refresh.never`)})]}),(0,h.jsxs)(`section`,{className:`space-y-3`,children:[(0,h.jsxs)(`h2`,{className:`text-lg font-semibold flex items-center gap-2`,children:[(0,h.jsx)(n,{className:`w-5 h-5`}),c(`activity:refresh.persistedEnv`)]}),(0,h.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-3`,children:[(0,h.jsx)(v,{label:`projectName`,value:g||`∅`}),(0,h.jsx)(v,{label:`cwd`,value:x||`∅`,mono:!0}),(0,h.jsx)(v,{label:`mode`,value:S,mono:!0}),(0,h.jsx)(v,{label:`contextMode`,value:C,mono:!0})]})]}),(0,h.jsxs)(`section`,{className:`space-y-3`,children:[(0,h.jsxs)(`h2`,{className:`text-lg font-semibold flex items-center gap-2`,children:[(0,h.jsx)(i,{className:`w-5 h-5`}),c(`activity:refresh.transcriptRehydrate`)]}),(0,h.jsx)(_,{label:c(`activity:refresh.localTranscript`),ok:P&&(T.length>0||D===null),extra:T.length===0?c(`activity:refresh.noMessages`):c(`activity:refresh.messagesExtra`,{count:T.length,queued:E})}),(0,h.jsx)(_,{label:c(`activity:refresh.noBleed`),ok:!L,extra:L?c(`activity:refresh.bleedExtra`,{bound:D??`∅`,active:d??`∅`}):c(`activity:refresh.transcriptBinds`),warn:L}),T.length>0&&(0,h.jsxs)(`div`,{className:`space-y-1 rounded-lg border border-border/70 bg-card/65 p-3 text-xs font-mono`,children:[(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`span`,{className:`text-muted-foreground`,children:`first:`}),` `,b(T[0])]}),(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`span`,{className:`text-muted-foreground`,children:`last:`}),` `,b(T[T.length-1]??T[0])]})]})]}),(0,h.jsxs)(`section`,{className:`space-y-3`,children:[(0,h.jsxs)(`h2`,{className:`text-lg font-semibold flex items-center gap-2`,children:[(0,h.jsx)(a,{className:`w-5 h-5`}),c(`activity:refresh.uiWorkspace`)]}),(0,h.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-3`,children:[(0,h.jsx)(v,{label:`currentView`,value:O,mono:!0}),(0,h.jsx)(v,{label:`dockSection`,value:k??c(`activity:refresh.noneValue`),mono:!0})]}),(0,h.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:c(`activity:refresh.payloadSize`,{count:M})})]}),(0,h.jsxs)(`section`,{className:`space-y-2`,children:[(0,h.jsx)(`h2`,{className:`text-lg font-semibold`,children:c(`activity:refresh.probeLog`)}),A.length===0?(0,h.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:c(`activity:refresh.noProbes`)}):(0,h.jsx)(`ul`,{className:`space-y-1 text-xs font-mono`,children:A.map((e,t)=>(0,h.jsxs)(`li`,{className:`flex items-center gap-2`,children:[e.ok?(0,h.jsx)(r,{className:`w-4 h-4 text-success shrink-0`}):(0,h.jsx)(s,{className:`w-4 h-4 text-warning shrink-0`}),(0,h.jsx)(`span`,{className:`text-muted-foreground`,children:new Date(e.ts).toLocaleTimeString()}),(0,h.jsx)(`span`,{children:e.note})]},`${e.ts}-${t}`))})]})]})})}function _({label:e,extra:t,ok:n,warn:i}){return(0,h.jsxs)(`div`,{className:`rounded-lg border px-3 py-2 ${i?`border-warning/40 bg-warning/10 text-warning`:n?`border-success/40 bg-success/10 text-success`:`border-border bg-muted/40 text-muted-foreground`}`,children:[(0,h.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-xs font-medium`,children:[n&&!i?(0,h.jsx)(r,{className:`h-4 w-4 shrink-0`}):(0,h.jsx)(s,{className:`h-4 w-4 shrink-0`}),(0,h.jsx)(`span`,{className:`min-w-0 break-words`,children:e})]}),(0,h.jsx)(`div`,{className:`text-xs font-mono mt-1 break-all`,children:t})]})}function v({label:e,value:t,mono:n}){return(0,h.jsxs)(`div`,{className:`min-w-0 rounded-lg border border-border/70 bg-card/75 p-3 shadow-sm`,children:[(0,h.jsx)(`p`,{className:`text-xs uppercase tracking-wide text-muted-foreground`,children:e}),(0,h.jsx)(`p`,{className:`mt-1 text-sm break-all `+(n?`font-mono`:`font-medium`),children:t})]})}function y(e){let t=e.title?.trim();return t?`${e.id} — "${t}" (${e.provider}/${e.model})`:`${e.id} (${e.provider}/${e.model})`}function b(e){let t=(e.content??``).trim().replace(/\s+/g,` `);return`[${e.role}] ${t.length>100?`${t.slice(0,99)}…`:t}`}export{g as RefreshDebugView};
@@ -0,0 +1,2 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{$n as t,At as n,Hi as r,Ii as i,Jt as a,Qi as o,Tr as ee,Vr as s,Yi as c,at as l,br as u,cn as d,di as te,ea as f,ht as p,ii as m,in as h,jt as g,kr as _,li as v,ot as ne,tt as y,vt as re,xt as b,yi as x}from"./vendor-JNPeA-SL.js";import"./i18n-BcnwAuXt.js";import{t as S}from"./utils-BLVofF8S.js";import{A as C,D as w,E as T,K as E,M as D,N as O,O as k,P as A,j,k as M,l as N}from"./index-MIiPbE0D.js";import{a as P,c as F,i as I,l as L,n as R,o as z,r as B,s as V,t as H}from"./SddFlowGraph-ZGRYKvG4.js";var U=e(f(),1),W=y();function ie({feed:e,now:t}){let{t:n}=c();return(0,W.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-1.5 border-b border-border px-3 py-2 text-xs font-semibold text-foreground`,children:[(0,W.jsx)(v,{className:`h-3.5 w-3.5 text-warning`}),n(`activity:sdd.activityHeading`)]}),(0,W.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 space-y-1 overflow-auto overscroll-contain p-2`,children:e.length===0?(0,W.jsx)(`p`,{className:`px-1 pt-4 text-center text-[11px] text-muted-foreground`,children:n(`activity:sdd.feedEmpty`)}):e.map((e,n)=>{let r=B[e.kind]??B.started,i=r.icon;return(0,W.jsxs)(`div`,{className:S(`sdd-rise flex items-start gap-2 rounded-md px-2 py-1.5 text-[11px]`,n===0?`bg-muted`:`hover:bg-muted`),children:[(0,W.jsx)(i,{className:S(`mt-0.5 h-3.5 w-3.5 shrink-0`,r.color)}),(0,W.jsx)(`span`,{className:`flex-1 leading-snug text-foreground`,children:e.text}),(0,W.jsx)(`span`,{className:`shrink-0 tabular-nums text-[10px] text-muted-foreground`,children:z(e.ts,t)})]},`${e.ts}-${n}`)})})]})}function G({open:e,onOpenChange:t,snapshot:n,busy:r,onConfirm:i}){let{t:a}=c(),o=n?.mergedCommits?.length??0,ee=n?.baseBranch,[s,l]=(0,U.useState)(!1);(0,U.useEffect)(()=>{e&&l(!1)},[e]);let u=n?.status===`running`||n?.status===`paused`,d=(0,U.useMemo)(()=>{let e=new Set;for(let t of n?.tasks??[])t.worktreeBranch&&e.add(t.worktreeBranch);return e.size},[n?.tasks]),f=(0,U.useMemo)(()=>{let e=new Set;for(let t of n?.tasks??[])t.displayStatus===`in_progress`&&t.agentName&&e.add(t.agentName);return e.size},[n?.tasks]);return(0,W.jsx)(k,{open:e,onOpenChange:e=>!r&&t(e),children:(0,W.jsxs)(M,{className:`sm:max-w-lg border-destructive/50`,children:[(0,W.jsxs)(D,{children:[(0,W.jsxs)(O,{className:`flex items-center gap-2`,children:[(0,W.jsx)(b,{className:`h-5 w-5 text-destructive`}),a(`activity:sdd.destroyTitle`)]}),(0,W.jsx)(C,{children:a(`activity:sdd.destroyDesc`)})]}),(0,W.jsxs)(`ul`,{className:`space-y-1.5 py-1 text-sm`,children:[u&&(0,W.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,W.jsx)(`span`,{className:`mt-0.5 text-destructive`,children:`■`}),(0,W.jsx)(`span`,{children:f>0?a(`activity:sdd.stopRunAgents`,{count:f}):a(`activity:sdd.stopRun`)})]}),(0,W.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,W.jsx)(`span`,{className:`mt-0.5 text-destructive`,children:`■`}),(0,W.jsx)(`span`,{children:d>0?a(`activity:sdd.removeWorktreesCount`,{count:d}):a(`activity:sdd.removeWorktreesAll`)})]}),(0,W.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,W.jsx)(`span`,{className:`mt-0.5 text-destructive`,children:`■`}),(0,W.jsx)(`span`,{children:a(`activity:sdd.deleteArtifacts`)})]})]}),o>0&&(0,W.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 rounded-md border border-warning/30 bg-warning/5 p-2.5 text-sm`,children:[(0,W.jsx)(`input`,{type:`checkbox`,checked:s,onChange:e=>l(e.target.checked),className:`mt-0.5 h-4 w-4 accent-warning`}),(0,W.jsxs)(`span`,{children:[(0,W.jsx)(`span`,{className:`font-medium`,children:a(`activity:sdd.revertMerged`,{count:o})}),` `,`on `,(0,W.jsx)(`code`,{className:`text-xs`,children:ee??a(`activity:sdd.baseBranchFallback`)}),(0,W.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:a(`activity:sdd.revertHint`)})]})]}),(0,W.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md bg-muted/50 p-2 text-xs text-muted-foreground`,children:[(0,W.jsx)(te,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-warning`}),a(o>0&&!s?`activity:sdd.noteLeaveMerged`:`activity:sdd.noteAbandon`)]}),(0,W.jsxs)(j,{className:`gap-2 sm:gap-2`,children:[(0,W.jsx)(T,{variant:`outline`,size:`sm`,disabled:r,onClick:()=>t(!1),children:a(`common:action.cancel`)}),(0,W.jsx)(T,{size:`sm`,disabled:r,onClick:()=>i(s),className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:r?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(x,{className:`mr-1 h-3.5 w-3.5 animate-spin`}),` `,a(`activity:sdd.destroying`)]}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(b,{className:`mr-1 h-3.5 w-3.5`}),` `,a(`activity:sdd.destroyAll`)]})})]})]})})}var K=[{key:`pending`,labelKey:`kanbanBacklog`,accent:`border-border/70`,head:`text-muted-foreground`},{key:`queued`,labelKey:`kanbanReady`,accent:`border-primary/35`,head:`text-primary`},{key:`in_progress`,labelKey:`kanbanRunning`,accent:`border-warning/45`,head:`text-warning`},{key:`review`,labelKey:`kanbanReview`,accent:`border-primary/35`,head:`text-primary`},{key:`failed`,labelKey:`kanbanFailed`,accent:`border-destructive/35`,head:`text-destructive`},{key:`completed`,labelKey:`kanbanDone`,accent:`border-success/35`,head:`text-success`}];function q({tasks:e,selectedId:t,onTaskClick:n}){let{t:r}=c(),i=(0,U.useMemo)(()=>{let t=new Map;for(let e of K)t.set(e.key,[]);for(let n of e){let e=n.displayStatus===`blocked`?`pending`:n.displayStatus===`cancelled`?`failed`:n.displayStatus;(t.get(e)??t.get(`pending`))?.push(n)}return t},[e]);return(0,W.jsx)(`div`,{className:`flex h-full min-h-0 min-w-0 gap-3 overflow-x-auto p-4`,children:K.map(e=>{let a=i.get(e.key)??[];return(0,W.jsxs)(`div`,{className:`flex min-h-0 w-64 shrink-0 flex-col`,children:[(0,W.jsxs)(`div`,{className:S(`mb-2 flex items-center gap-2 border-b-2 pb-1.5`,e.accent),children:[(0,W.jsx)(`span`,{className:S(`text-xs font-bold uppercase tracking-wide`,e.head),children:r(`activity:sdd.${e.labelKey}`)}),(0,W.jsx)(`span`,{className:`rounded-full bg-muted px-1.5 text-[10px] text-muted-foreground`,children:a.length})]}),(0,W.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-2 overflow-y-auto overscroll-contain pr-1`,children:[a.map(e=>(0,W.jsx)(J,{task:e,selected:e.id===t,onClick:()=>n(e.id)},e.id)),a.length===0&&(0,W.jsx)(`div`,{className:`rounded-md border border-dashed border-border py-6 text-center text-[10px] text-muted-foreground`,children:r(`activity:sdd.kanbanEmpty`)})]})]},e.key)})})}function J({task:e,selected:n,onClick:r}){let i=e.displayStatus===`in_progress`;return(0,W.jsxs)(`button`,{type:`button`,onClick:r,className:S(`sdd-node-enter w-full rounded-lg border bg-card/85 p-2 text-left shadow-sm transition hover:border-primary/35 hover:bg-accent/35`,n?`border-primary/55 ring-1 ring-primary/35`:`border-border/70`,i&&`sdd-node-running`,e.displayStatus===`completed`&&`sdd-node-complete`,e.displayStatus===`failed`&&`sdd-node-failed`),children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[i&&(0,W.jsx)(x,{className:`h-3 w-3 animate-spin text-warning`}),e.displayStatus===`completed`&&(0,W.jsx)(s,{className:`h-3 w-3 text-success`}),e.displayStatus===`failed`&&(0,W.jsx)(l,{className:`h-3 w-3 text-destructive`}),(0,W.jsx)(`span`,{className:`font-mono text-[10px] text-muted-foreground`,children:e.shortId}),(0,W.jsx)(`span`,{className:S(`ml-auto rounded px-1.5 text-[9px] font-bold uppercase`,F(e.priority).chip),children:e.priority})]}),(0,W.jsx)(`p`,{className:`mt-1 line-clamp-2 text-[11px] leading-snug text-foreground`,children:e.title}),(e.agentName||e.worktreeBranch||e.retries)&&(0,W.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-1.5`,children:[e.agentName&&(0,W.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,W.jsx)(`span`,{className:S(`flex h-4 w-4 items-center justify-center rounded-full text-[8px] font-bold text-white`,i?`bg-warning sdd-agent-live`:`bg-muted-foreground`),children:P(e.agentName)}),(0,W.jsx)(`span`,{className:`max-w-[80px] truncate text-[10px] text-muted-foreground`,children:e.agentName})]}),e.retries?(0,W.jsxs)(`span`,{className:`flex items-center gap-0.5 text-[9px] text-destructive`,children:[(0,W.jsx)(a,{className:`h-2.5 w-2.5`}),e.retries]}):null,e.worktreeBranch&&(0,W.jsx)(t,{className:`ml-auto h-2.5 w-2.5 text-muted-foreground`})]})]})}function ae({task:e,allTasks:r,feed:i,now:o,modelCandidates:ee,defaultModel:u,onClose:d,onRetry:te,onReassign:f,onSetModel:h,onSetVerification:v,onCancel:ne,onDelete:y,onSplit:re,onSelectTask:x}){let{t:C}=c(),w=L(e.displayStatus),T=w.icon,E=e.displayStatus===`in_progress`,D=e.displayStatus===`pending`||e.displayStatus===`blocked`||e.displayStatus===`queued`,[O,k]=(0,U.useState)(!1),[A,j]=(0,U.useState)(``),[M,I]=(0,U.useState)(null),[R,z]=(0,U.useState)(!1),[B,H]=(0,U.useState)(``),[ie,G]=(0,U.useState)(!1),[K,q]=(0,U.useState)(e.verificationCommand??``),J=()=>{A.trim()&&(f(e.id,A.trim()),k(!1),j(``))},ae=()=>{let t=B.split(`
2
+ `).map(e=>e.trim()).filter(Boolean).map(e=>{let[t,...n]=e.split(`::`),r=(t??``).trim();return{title:r,description:n.join(`::`).trim()||r}}).filter(e=>e.title);t.length&&(re(e.id,t),z(!1),H(``))},se=(0,U.useMemo)(()=>new Map(r.map(e=>[e.shortId,e])),[r]),X=(0,U.useMemo)(()=>r.filter(t=>t.deps.includes(e.shortId)),[r,e.shortId]),Z=(0,U.useMemo)(()=>i.filter(t=>t.taskShortId===e.shortId),[i,e.shortId]),ce=e.startedAt&&!e.completedAt?V(o-e.startedAt):e.startedAt&&e.completedAt?V(e.completedAt-e.startedAt):null;return(0,W.jsxs)(`div`,{className:`sdd-rise flex h-full min-h-0 min-w-0 flex-col`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border/70 bg-card/70 px-3 py-2`,children:[(0,W.jsx)(`button`,{type:`button`,onClick:d,className:`text-muted-foreground hover:text-foreground`,title:C(`activity:sddTask.backTitle`),children:(0,W.jsx)(m,{className:`h-4 w-4`})}),(0,W.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:e.shortId}),(0,W.jsxs)(`span`,{className:S(`ml-auto flex items-center gap-1 rounded-full border px-2 py-0.5 text-[11px]`,w.ring,w.text),children:[(0,W.jsx)(T,{className:S(`h-3 w-3`,E&&`animate-spin`)}),w.label]})]}),(0,W.jsxs)(`div`,{className:`min-h-0 min-w-0 flex-1 space-y-3 overflow-auto overscroll-contain p-3`,children:[(0,W.jsx)(`h3`,{className:`text-sm font-semibold leading-snug text-foreground`,children:e.title}),e.agentName&&(0,W.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-border/70 bg-muted/45 p-2`,children:[(0,W.jsx)(`span`,{className:S(`flex h-7 w-7 items-center justify-center rounded-full text-[10px] font-bold text-white`,E?`bg-warning sdd-agent-live`:`bg-muted-foreground`),children:P(e.agentName)}),(0,W.jsxs)(`div`,{className:`leading-tight`,children:[(0,W.jsx)(`div`,{className:`text-xs font-medium text-foreground`,children:e.agentName}),(0,W.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:C(E?`activity:sddTask.workingOn`:`activity:sddTask.assigned`)})]})]}),(0,W.jsxs)(`div`,{className:`grid grid-cols-2 gap-1.5 text-[11px]`,children:[(0,W.jsx)(Y,{label:C(`activity:sddTask.metaPriority`),children:(0,W.jsx)(`span`,{className:S(`font-medium uppercase`,F(e.priority).text),children:e.priority})}),(0,W.jsx)(Y,{label:C(`activity:sddTask.metaType`),children:e.type}),ce&&(0,W.jsx)(Y,{label:e.completedAt?C(`activity:sddTask.metaDuration`):C(`activity:sddTask.metaElapsed`),children:(0,W.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,W.jsx)(_,{className:`h-3 w-3 text-muted-foreground`}),ce]})}),e.retries?(0,W.jsx)(Y,{label:C(`activity:sddTask.metaRetries`),children:(0,W.jsxs)(`span`,{className:`flex items-center gap-1 text-destructive`,children:[(0,W.jsx)(a,{className:`h-3 w-3`}),e.retries]})}):null,e.worktreeBranch&&(0,W.jsx)(Y,{label:C(`activity:sddTask.metaWorktree`),full:!0,children:(0,W.jsxs)(`span`,{className:`flex items-center gap-1 font-mono text-foreground`,title:e.worktreeBranch,children:[(0,W.jsx)(t,{className:`h-3 w-3 text-muted-foreground`}),(0,W.jsx)(`span`,{className:`truncate`,children:e.worktreeBranch})]})})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:[C(`activity:sddTask.workerModel`),!e.model&&u&&(0,W.jsxs)(`span`,{className:`font-normal normal-case text-muted-foreground`,children:[`· `,C(`activity:sddTask.runDefault`,{model:u})]})]}),(0,W.jsx)(N,{value:e.model,provider:e.provider,candidates:ee,placeholder:u?C(`activity:sddTask.runDefaultPlaceholderModel`,{model:u}):C(`activity:sddTask.runDefaultPlaceholder`),onPick:(t,n)=>h(e.id,t,n),onReset:e.model?()=>h(e.id,void 0,void 0):void 0}),e.fallbackModels&&e.fallbackModels.length>0&&(0,W.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1`,children:e.fallbackModels.map(e=>(0,W.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-[9px] text-muted-foreground`,children:[`↳ `,e]},e))})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:[C(`activity:sddTask.verificationCmd`),(0,W.jsxs)(`span`,{className:`font-normal normal-case text-muted-foreground`,children:[`· `,C(`activity:sddTask.gatesCompletion`)]})]}),ie?(0,W.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,W.jsx)(`input`,{value:K,onChange:e=>q(e.target.value),onKeyDown:t=>{t.key===`Enter`?(v(e.id,K.trim()||void 0),G(!1)):t.key===`Escape`&&(q(e.verificationCommand??``),G(!1))},placeholder:C(`activity:sddTask.verifyPlaceholder`),className:`w-full rounded border border-border bg-background px-2 py-1 font-mono text-[11px] text-foreground`}),(0,W.jsxs)(`div`,{className:`flex gap-1`,children:[(0,W.jsx)(`button`,{type:`button`,onClick:()=>{v(e.id,K.trim()||void 0),G(!1)},className:`rounded bg-primary px-2 py-0.5 text-[10px] text-primary-foreground hover:opacity-90`,children:C(`common:action.save`)}),(0,W.jsx)(`button`,{type:`button`,onClick:()=>{q(e.verificationCommand??``),G(!1)},className:`rounded bg-muted px-2 py-0.5 text-[10px] text-muted-foreground hover:bg-muted/80`,children:C(`common:action.cancel`)})]})]}):e.verificationCommand?(0,W.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,W.jsx)(`code`,{className:`flex-1 truncate rounded bg-muted px-1.5 py-0.5 font-mono text-[10px] text-foreground`,children:e.verificationCommand}),(0,W.jsx)(`button`,{type:`button`,onClick:()=>G(!0),className:`rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground hover:bg-muted/80`,children:C(`common:action.edit`)}),(0,W.jsx)(`button`,{type:`button`,onClick:()=>v(e.id,void 0),className:`rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground hover:bg-muted/80`,children:C(`common:action.clear`)})]}):(0,W.jsx)(`button`,{type:`button`,onClick:()=>G(!0),className:`rounded border border-dashed border-border px-2 py-1 text-[10px] text-muted-foreground hover:bg-muted`,children:C(`activity:sddTask.addVerify`)})]}),e.description&&(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:C(`activity:sddTask.description`)}),(0,W.jsx)(`p`,{className:`whitespace-pre-wrap rounded-md bg-muted p-2 text-[11px] leading-relaxed text-foreground`,children:e.description})]}),Z.length>0&&(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:C(`activity:sddTask.timeline`)}),(0,W.jsx)(`div`,{className:`space-y-1 border-l border-border pl-2.5`,children:Z.map((e,t)=>(0,W.jsxs)(`div`,{className:`relative text-[11px] leading-snug text-foreground`,children:[(0,W.jsx)(`span`,{className:S(`absolute -left-[14px] top-1 h-1.5 w-1.5 rounded-full`,e.kind===`completed`?`bg-success`:e.kind===`failed`?`bg-destructive`:e.kind===`retrying`?`bg-warning`:`bg-primary`)}),e.text]},`${e.ts}-${t}`))})]}),e.deps.length>0&&(0,W.jsx)(oe,{title:C(`activity:sddTask.dependsOn`),shortIds:e.deps,byShort:se,onSelectTask:x}),X.length>0&&(0,W.jsx)(oe,{title:C(`activity:sddTask.blocks`),shortIds:X.map(e=>e.shortId),byShort:se,onSelectTask:x})]}),(0,W.jsxs)(`div`,{className:`border-t border-border p-2`,children:[O?(0,W.jsxs)(`div`,{className:`sdd-rise flex items-center gap-1.5`,children:[(0,W.jsx)(`input`,{value:A,onChange:e=>j(e.target.value),onKeyDown:e=>{e.key===`Enter`&&J(),e.key===`Escape`&&k(!1)},placeholder:C(`activity:sddTask.newWorkerPlaceholder`),className:`min-w-0 flex-1 rounded-md border border-border/70 bg-background px-2 py-1.5 text-xs outline-none focus:border-primary/60`}),(0,W.jsx)(`button`,{type:`button`,onClick:J,disabled:!A.trim(),className:`rounded-md bg-primary/10 px-2 py-1.5 text-xs font-medium text-primary hover:bg-primary/15 disabled:opacity-40`,children:(0,W.jsx)(s,{className:`h-3.5 w-3.5`})}),(0,W.jsx)(`button`,{type:`button`,onClick:()=>k(!1),className:`rounded-md bg-muted px-2 py-1.5 text-xs text-muted-foreground hover:bg-muted`,children:(0,W.jsx)(l,{className:`h-3.5 w-3.5`})})]}):M?(0,W.jsxs)(`div`,{className:`sdd-rise flex items-center gap-2`,children:[(0,W.jsx)(`span`,{className:`flex-1 text-xs text-foreground`,children:C(M===`stop`?`activity:sddTask.confirmStop`:`activity:sddTask.confirmDelete`)}),(0,W.jsxs)(`button`,{type:`button`,onClick:()=>{M===`stop`?ne(e.id):y(e.id),I(null)},className:`inline-flex items-center gap-1 rounded-md bg-destructive/10 px-2.5 py-1.5 text-xs font-medium text-destructive hover:bg-destructive/15`,children:[(0,W.jsx)(s,{className:`h-3.5 w-3.5`}),` `,C(M===`stop`?`common:action.stop`:`common:action.delete`)]}),(0,W.jsx)(`button`,{type:`button`,onClick:()=>I(null),className:`rounded-md bg-muted px-2 py-1.5 text-xs text-muted-foreground hover:bg-muted`,children:(0,W.jsx)(l,{className:`h-3.5 w-3.5`})})]}):(0,W.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,W.jsxs)(`button`,{type:`button`,onClick:()=>te(e.id),title:C(`activity:sddTask.retryTitle`),className:`inline-flex flex-1 items-center justify-center gap-1 rounded-md bg-warning/12 py-1.5 text-xs font-medium text-warning hover:bg-warning/18`,children:[(0,W.jsx)(a,{className:`h-3.5 w-3.5`}),` `,C(`common:action.retry`)]}),(0,W.jsxs)(`button`,{type:`button`,onClick:()=>k(!0),className:`inline-flex flex-1 items-center justify-center gap-1 rounded-md bg-primary/10 py-1.5 text-xs font-medium text-primary hover:bg-primary/15`,children:[(0,W.jsx)(p,{className:`h-3.5 w-3.5`}),` `,C(`activity:sddTask.reassign`)]}),E&&(0,W.jsxs)(`button`,{type:`button`,onClick:()=>I(`stop`),title:C(`activity:sddTask.stopTitle`),className:`inline-flex flex-1 items-center justify-center gap-1 rounded-md bg-destructive/10 py-1.5 text-xs font-medium text-destructive hover:bg-destructive/15`,children:[(0,W.jsx)(n,{className:`h-3.5 w-3.5`}),` `,C(`common:action.stop`)]}),!E&&(0,W.jsxs)(`button`,{type:`button`,onClick:()=>z(!0),title:C(`activity:sddTask.splitTitle`),className:`inline-flex flex-1 items-center justify-center gap-1 rounded-md bg-primary/10 py-1.5 text-xs font-medium text-primary hover:bg-primary/15`,children:[(0,W.jsx)(g,{className:`h-3.5 w-3.5`}),` `,C(`activity:sddTask.split`)]}),D&&(0,W.jsxs)(`button`,{type:`button`,onClick:()=>I(`delete`),title:C(`activity:sddTask.deleteTitle`),className:`inline-flex flex-1 items-center justify-center gap-1 rounded-md bg-destructive/10 py-1.5 text-xs font-medium text-destructive hover:bg-destructive/15`,children:[(0,W.jsx)(b,{className:`h-3.5 w-3.5`}),` `,C(`common:action.delete`)]})]}),R&&(0,W.jsxs)(`div`,{className:`mt-2 flex flex-col gap-2`,children:[(0,W.jsx)(`label`,{className:`text-[11px] text-muted-foreground`,htmlFor:`sdd-split-input`,children:C(`activity:sddTask.splitHint`)}),(0,W.jsx)(`textarea`,{id:`sdd-split-input`,rows:3,value:B,onChange:e=>H(e.target.value),placeholder:C(`activity:sddTask.splitPlaceholder`),className:`w-full resize-y rounded-md border border-border/70 bg-background px-2 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-ring`}),(0,W.jsxs)(`div`,{className:`flex gap-2`,children:[(0,W.jsxs)(`button`,{type:`button`,onClick:ae,className:`inline-flex flex-1 items-center justify-center gap-1 rounded-md bg-primary/10 py-1.5 text-xs font-medium text-primary hover:bg-primary/15`,children:[(0,W.jsx)(g,{className:`h-3.5 w-3.5`}),` `,C(`activity:sddTask.splitInto`)]}),(0,W.jsx)(`button`,{type:`button`,onClick:()=>{z(!1),H(``)},className:`rounded-md bg-muted px-2 py-1.5 text-xs text-muted-foreground hover:bg-muted`,children:(0,W.jsx)(l,{className:`h-3.5 w-3.5`})})]})]})]})]})}function Y({label:e,children:t,full:n}){return(0,W.jsxs)(`div`,{className:S(`rounded-md border border-border bg-muted/50 px-2 py-1`,n&&`col-span-2`),children:[(0,W.jsx)(`div`,{className:`text-[9px] uppercase tracking-wide text-muted-foreground`,children:e}),(0,W.jsx)(`div`,{className:`text-foreground`,children:t})]})}function oe({title:e,shortIds:t,byShort:n,onSelectTask:r}){return(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:e}),(0,W.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:t.map(e=>{let t=n.get(e);return(0,W.jsxs)(`button`,{type:`button`,disabled:!t,onClick:()=>t&&r(t.id),className:`flex items-center gap-1 rounded-full border border-border bg-muted px-2 py-0.5 text-[10px] text-foreground hover:bg-muted disabled:opacity-50`,title:t?.title,children:[(0,W.jsx)(`span`,{className:S(`h-1.5 w-1.5 rounded-full`,L(t?.displayStatus??`pending`).dot)}),(0,W.jsx)(`span`,{className:`font-mono`,children:e})]},e)})})]})}function se({pct:e}){let t=2*Math.PI*26,n=t-Math.max(0,Math.min(100,e))/100*t;return(0,W.jsxs)(`div`,{className:`relative h-16 w-16 shrink-0`,children:[(0,W.jsxs)(`svg`,{viewBox:`0 0 64 64`,className:`h-16 w-16 -rotate-90`,role:`img`,"aria-label":`Progress`,children:[(0,W.jsx)(`circle`,{cx:`32`,cy:`32`,r:26,fill:`none`,stroke:`hsl(var(--muted))`,strokeWidth:`6`}),(0,W.jsx)(`circle`,{cx:`32`,cy:`32`,r:26,fill:`none`,stroke:`url(#sddgrad)`,strokeWidth:`6`,strokeLinecap:`round`,strokeDasharray:t,strokeDashoffset:n,style:{transition:`stroke-dashoffset 0.6s cubic-bezier(0.16,1,0.3,1)`}}),(0,W.jsx)(`defs`,{children:(0,W.jsxs)(`linearGradient`,{id:`sddgrad`,x1:`0`,y1:`0`,x2:`1`,y2:`1`,children:[(0,W.jsx)(`stop`,{offset:`0%`,stopColor:`hsl(var(--primary))`}),(0,W.jsx)(`stop`,{offset:`100%`,stopColor:`hsl(var(--info))`})]})})]}),(0,W.jsxs)(`div`,{className:`absolute inset-0 flex items-center justify-center text-sm font-bold text-foreground`,children:[Math.round(e),`%`]})]})}function X({onClose:e}){let{t}=c(),{client:r}=A(),i=E(e=>e.snapshot),o=E(e=>e.lifecycleResult),s=E(e=>e.destroying),f=E(e=>e.setDestroying),p=E(e=>e.setLifecycleResult),[m,g]=(0,U.useState)(()=>Date.now()),[_,y]=(0,U.useState)(null),[x,C]=(0,U.useState)(`graph`),[D,O]=(0,U.useState)(!1);(0,U.useEffect)(()=>{r?.send?.({type:`sdd.board.get`})},[r]);let k=i&&(i.status===`running`||i.status===`paused`);(0,U.useEffect)(()=>{if(!k)return;let e=setInterval(()=>g(Date.now()),1e3);return g(Date.now()),()=>clearInterval(e)},[k]);let j=(0,U.useCallback)(e=>r?.send?.(e),[r]),M=(0,U.useRef)(null),N=(0,U.useCallback)(e=>{M.current=null,j({type:`sdd.board.destroy`,payload:{revertMerged:e}})},[j]),F=(0,U.useCallback)(e=>{O(!1),p(null),f(!0),k?(j({type:`sdd.board.stop`,payload:{}}),M.current={revertMerged:e,deadline:Date.now()+2e4}):N(e)},[k,j,N,f,p]);(0,U.useEffect)(()=>{let e=M.current;e&&(!k||Date.now()>=e.deadline)&&N(e.revertMerged)},[k,i,N]);let L=(0,U.useCallback)(()=>{p(null),j({type:`sdd.board.cleanup_worktrees`,payload:{}})},[j,p]),z=(0,U.useCallback)(()=>{p(null),j({type:`sdd.board.rollback`,payload:{}})},[j,p]),B=(0,U.useMemo)(()=>(i?.tasks??[]).map(e=>({id:e.id,shortId:e.shortId,title:e.title,displayStatus:e.displayStatus,priority:e.priority,deps:e.deps,agentName:e.agentName,worktreeBranch:e.worktreeBranch})),[i?.tasks]),K=(0,U.useMemo)(()=>{let e=new Map;for(let t of i?.tasks??[])t.displayStatus===`in_progress`&&t.agentName&&e.set(t.agentName,{name:t.agentName,task:t.title});return[...e.values()]},[i?.tasks]),J=(0,U.useCallback)(e=>y(e),[]),Y=(0,U.useCallback)(e=>j({type:`sdd.board.retry`,payload:{taskId:e}}),[j]),oe=(0,U.useCallback)(()=>j({type:`sdd.board.retry_all_failed`,payload:{}}),[j]),X=(0,U.useCallback)((e,t)=>{let n=t.trim();n&&j({type:`sdd.board.reassign`,payload:{taskId:e,agentName:n}})},[j]),Z=(0,U.useCallback)((e,t,n)=>j({type:`sdd.board.set_task_model`,payload:{taskId:e,model:t,provider:n}}),[j]),le=(0,U.useCallback)((e,t)=>j({type:`sdd.board.set_task_verification`,payload:{taskId:e,verificationCommand:t}}),[j]),ue=(0,U.useCallback)(e=>j({type:`sdd.board.cancel_task`,payload:{taskId:e}}),[j]),de=(0,U.useCallback)(e=>{j({type:`sdd.board.delete_task`,payload:{taskId:e}}),y(null)},[j]),fe=(0,U.useCallback)((e,t)=>{j({type:`sdd.board.split_task`,payload:{taskId:e,subtasks:t}}),y(null)},[j]),pe=w(_!==null),me=(0,U.useMemo)(()=>i?.tasks.find(e=>e.id===_)??null,[i?.tasks,_]),$=i?.progress,he=i?.diagnostics?.deadlockChains??[];return(0,W.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col bg-background`,children:[(0,W.jsxs)(`header`,{className:`sdd-sheen shrink-0 border-b border-border px-4 pb-3 pt-2.5`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(v,{className:`h-5 w-5 text-warning`}),(0,W.jsx)(`h1`,{className:`text-lg font-semibold text-foreground`,children:i?.title??t(`activity:sddBoard.titleFallback`)}),i&&(0,W.jsx)(`span`,{className:S(`rounded-full border px-2 py-0.5 text-[11px] font-medium capitalize`,I[i.status]??I.idle),children:i.status}),i?.defaultModel&&(0,W.jsxs)(`span`,{className:`flex items-center gap-1 rounded-full border border-border bg-muted px-2 py-0.5 text-[10px] text-muted-foreground`,title:t(`activity:sddBoard.defaultModelTitle`),children:[(0,W.jsx)(ee,{className:`h-3 w-3 text-primary`}),i.defaultModel]})]}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[i&&(0,W.jsx)(`div`,{className:`flex items-center rounded-md border border-border bg-muted p-0.5 text-[11px]`,children:[`graph`,`kanban`].map(e=>(0,W.jsx)(`button`,{type:`button`,onClick:()=>C(e),className:S(`rounded px-2 py-0.5 capitalize transition`,x===e?`bg-primary/12 text-primary`:`text-muted-foreground hover:text-foreground`),children:t(e===`graph`?`activity:sddBoard.graphLabel`:`activity:sddBoard.kanbanLabel`)},e))}),k&&($?.failed??0)>0&&(0,W.jsxs)(`button`,{type:`button`,onClick:oe,title:t(`activity:sddBoard.retryAllTitle`),className:`inline-flex items-center gap-1 rounded-md bg-warning/15 px-2.5 py-1 text-xs font-medium text-warning hover:bg-warning/25`,children:[(0,W.jsx)(a,{className:`h-3.5 w-3.5`}),` `,t(`activity:sddBoard.retryFailed`,{count:$?.failed??0})]}),k&&(0,W.jsxs)(W.Fragment,{children:[i?.status===`paused`?(0,W.jsxs)(`button`,{type:`button`,onClick:()=>j({type:`sdd.board.resume`,payload:{}}),className:`inline-flex items-center gap-1 rounded-md bg-success/15 px-2.5 py-1 text-xs font-medium text-success hover:bg-success/25`,children:[(0,W.jsx)(h,{className:`h-3.5 w-3.5`}),` `,t(`activity:sddBoard.resume`)]}):(0,W.jsxs)(`button`,{type:`button`,onClick:()=>j({type:`sdd.board.pause`,payload:{}}),className:`inline-flex items-center gap-1 rounded-md bg-warning/15 px-2.5 py-1 text-xs font-medium text-warning hover:bg-warning/25`,children:[(0,W.jsx)(d,{className:`h-3.5 w-3.5`}),` `,t(`activity:sddBoard.pause`)]}),(0,W.jsxs)(`button`,{type:`button`,onClick:()=>j({type:`sdd.board.stop`,payload:{}}),className:`inline-flex items-center gap-1 rounded-md bg-destructive/15 px-2.5 py-1 text-xs font-medium text-destructive hover:bg-destructive/25`,children:[(0,W.jsx)(n,{className:`h-3.5 w-3.5`}),` `,t(`activity:sddBoard.stop`)]})]}),i&&!k&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`button`,{type:`button`,onClick:L,title:t(`activity:sddBoard.cleanTitle`),className:`inline-flex items-center gap-1 rounded-md bg-muted px-2.5 py-1 text-xs font-medium text-muted-foreground hover:bg-muted/80`,children:[(0,W.jsx)(u,{className:`h-3.5 w-3.5`}),` `,t(`activity:sddBoard.cleanWorktrees`)]}),(i.mergedCommits?.length??0)>0&&(0,W.jsxs)(`button`,{type:`button`,onClick:z,title:t(`activity:sddBoard.rollbackTitle`,{count:i.mergedCommits?.length??0,base:i.baseBranch??t(`activity:sdd.baseBranchFallback`)}),className:`inline-flex items-center gap-1 rounded-md bg-warning/15 px-2.5 py-1 text-xs font-medium text-warning hover:bg-warning/25`,children:[(0,W.jsx)(re,{className:`h-3.5 w-3.5`}),` `,t(`activity:sddBoard.rollback`,{count:i.mergedCommits?.length??0})]})]}),i&&(s?(0,W.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md bg-destructive/15 px-2.5 py-1 text-xs font-medium text-destructive`,children:[(0,W.jsx)(a,{className:`h-3.5 w-3.5 animate-spin`}),` `,t(k?`activity:sddBoard.stopping`:`activity:sddBoard.destroying`)]}):(0,W.jsxs)(`button`,{type:`button`,onClick:()=>O(!0),title:t(`activity:sddBoard.destroyTitle`),className:`inline-flex items-center gap-1 rounded-md bg-destructive px-2.5 py-1 text-xs font-medium text-destructive-foreground hover:bg-destructive/90`,children:[(0,W.jsx)(b,{className:`h-3.5 w-3.5`}),` `,t(`activity:sddBoard.destroy`)]})),(0,W.jsx)(T,{variant:`ghost`,size:`icon`,onClick:e,children:(0,W.jsx)(l,{className:`h-4 w-4`})})]})]}),i&&$&&(0,W.jsxs)(`div`,{className:`mt-2.5 flex items-center gap-5`,children:[(0,W.jsx)(se,{pct:$.percentComplete}),(0,W.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-3 text-xs`,children:[(0,W.jsx)(Q,{label:t(`activity:sddBoard.statDone`),value:`${$.completed}/${$.total}`,color:`text-success`}),$.inProgress>0&&(0,W.jsx)(Q,{label:t(`activity:sddBoard.statRunning`),value:$.inProgress,color:`text-warning`}),$.failed>0&&(0,W.jsx)(Q,{label:t(`activity:sddBoard.statFailed`),value:$.failed,color:`text-destructive`}),(0,W.jsx)(Q,{label:t(`activity:sddBoard.statWave`),value:i.wave+1,color:`text-primary`}),k&&i.startedAt>0&&(0,W.jsx)(Q,{label:t(`activity:sddBoard.statElapsed`),value:V(m-i.startedAt),color:`text-foreground`})]}),(0,W.jsx)(`div`,{className:`flex min-h-[24px] items-center gap-1.5`,children:K.length===0?(0,W.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:t(`activity:sddBoard.noActiveWorkers`)}):K.map((e,t)=>(0,W.jsxs)(`span`,{title:`${e.name} → ${e.task}`,className:`flex items-center gap-1 rounded-full bg-muted py-0.5 pl-0.5 pr-2`,children:[(0,W.jsx)(`span`,{className:S(`sdd-agent-live flex h-5 w-5 items-center justify-center rounded-full text-[9px] font-bold text-white`,R[t%R.length]),children:P(e.name)}),(0,W.jsx)(`span`,{className:`max-w-[90px] truncate text-[11px] text-foreground`,children:e.name})]},e.name))})]})]})]}),o&&(0,W.jsx)(ce,{result:o,onDismiss:()=>p(null)}),he.length>0&&(0,W.jsxs)(`div`,{className:`flex items-start gap-2 border-b border-destructive/30 bg-destructive/5 px-4 py-2 text-xs text-destructive`,children:[(0,W.jsx)(te,{className:`mt-0.5 h-4 w-4 shrink-0`}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`font-semibold`,children:t(`activity:sddBoard.deadlock`)}),he.map(e=>(0,W.jsxs)(`div`,{className:`font-mono`,children:[e.blocked,` ← `,e.blockedBy.join(`, `)]},e.blocked))]})]}),(0,W.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1`,children:[(0,W.jsx)(`div`,{className:`relative min-h-0 min-w-0 flex-1 overflow-hidden`,children:i?x===`graph`?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(H,{tasks:B,columns:i.columns,onTaskClick:J}),(0,W.jsx)(`div`,{className:`pointer-events-none absolute bottom-2 left-1/2 -translate-x-1/2 rounded-full bg-black/40 px-2 py-0.5 text-[10px] text-muted-foreground backdrop-blur`,children:t(`activity:sddBoard.clickTaskHint`)})]}):(0,W.jsx)(q,{tasks:i.tasks,selectedId:_,onTaskClick:J}):(0,W.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-3 text-sm text-muted-foreground`,children:[(0,W.jsx)(ne,{className:`h-10 w-10 text-primary/40`}),(0,W.jsx)(`p`,{className:`text-foreground`,children:t(`activity:sddBoard.noRunTitle`)}),(0,W.jsx)(`p`,{className:`max-w-sm text-center text-xs text-muted-foreground`,children:t(`activity:sddBoard.noRunBody`)})]})}),i&&(0,W.jsx)(`aside`,{className:`w-80 shrink-0 border-l border-border bg-card`,children:me?(0,W.jsx)(ae,{task:me,allTasks:i.tasks,feed:i.feed??[],now:m,modelCandidates:pe,defaultModel:i.defaultModel,onClose:()=>y(null),onRetry:Y,onReassign:X,onSetModel:Z,onSetVerification:le,onCancel:ue,onDelete:de,onSplit:fe,onSelectTask:y},me.id):(0,W.jsx)(ie,{feed:i.feed??[],now:m})})]}),(0,W.jsx)(G,{open:D,onOpenChange:O,snapshot:i,busy:s,onConfirm:F})]})}function Z(e){let t=e.op===`cleanup_worktrees`?`lcClean`:e.op===`rollback`?`lcRollback`:`lcDestroy`,n=o.t(`activity:sddBoard.${t}`);if(!e.ok)return o.t(`activity:sddBoard.lcFailed`,{op:n,reason:e.reason??o.t(`activity:sddBoard.lcUnknownError`)});let r=[];typeof e.removed==`number`&&r.push(o.t(`activity:sddBoard.lcWorktrees`,{count:e.removed})),typeof e.reverted==`number`&&e.reverted>0&&r.push(o.t(`activity:sddBoard.lcCommits`,{count:e.reverted})),e.deleted?.length&&r.push(o.t(`activity:sddBoard.lcDeleted`,{items:e.deleted.join(`, `)}));let i=r.length?r.join(` · `):o.t(`activity:sddBoard.lcNothing`);return e.reason?o.t(`activity:sddBoard.lcNote`,{op:n,body:i,reason:e.reason}):o.t(`activity:sddBoard.lcOk`,{op:n,body:i})}function ce({result:e,onDismiss:t}){let n=!e.ok||!!e.reason;return(0,W.jsxs)(`div`,{className:S(`flex items-start gap-2 border-b px-4 py-2 text-xs`,n?`border-warning/30 bg-warning/5 text-warning`:`border-success/30 bg-success/5 text-success`),children:[n?(0,W.jsx)(i,{className:`mt-0.5 h-4 w-4 shrink-0`}):(0,W.jsx)(r,{className:`mt-0.5 h-4 w-4 shrink-0`}),(0,W.jsx)(`span`,{className:`flex-1`,children:Z(e)}),(0,W.jsx)(`button`,{type:`button`,onClick:t,className:`shrink-0 opacity-60 hover:opacity-100`,children:(0,W.jsx)(l,{className:`h-3.5 w-3.5`})})]})}function Q({label:e,value:t,color:n}){return(0,W.jsxs)(`span`,{className:`flex items-baseline gap-1`,children:[(0,W.jsx)(`span`,{className:S(`font-semibold tabular-nums`,n),children:t}),(0,W.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide text-muted-foreground`,children:e})]})}export{X as SddBoardView};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{$n as t,$r as n,Gr as r,Jt as i,Lt as a,Pr as o,Vr as s,Yi as c,Zn as l,_ as u,a as d,at as f,bi as p,c as m,di as h,ea as g,f as _,h as v,i as y,in as b,jt as x,r as S,s as C,tt as w,u as T,yi as E}from"./vendor-JNPeA-SL.js";import"./i18n-BcnwAuXt.js";import{t as D}from"./utils-BLVofF8S.js";var O=e(g(),1),k={pending:{label:`Pending`,icon:o,text:`text-muted-foreground`,ring:`border-border/70 bg-muted/45`,dot:`bg-muted-foreground`,hex:`hsl(var(--muted-foreground))`},queued:{label:`Ready`,icon:o,text:`text-primary`,ring:`border-primary/35 bg-primary/10`,dot:`bg-primary`,hex:`hsl(var(--primary))`},in_progress:{label:`Running`,icon:E,spin:!0,text:`text-warning`,ring:`border-warning/45 bg-warning/10`,dot:`bg-warning`,hex:`hsl(var(--warning))`},blocked:{label:`Blocked`,icon:o,text:`text-destructive`,ring:`border-destructive/30 bg-destructive/10`,dot:`bg-destructive`,hex:`hsl(var(--destructive))`},review:{label:`Review`,icon:o,text:`text-primary`,ring:`border-primary/35 bg-primary/10`,dot:`bg-primary`,hex:`hsl(var(--info))`},failed:{label:`Failed`,icon:f,text:`text-destructive`,ring:`border-destructive/45 bg-destructive/10`,dot:`bg-destructive`,hex:`hsl(var(--destructive))`},completed:{label:`Done`,icon:s,text:`text-success`,ring:`border-success/35 bg-success/10`,dot:`bg-success`,hex:`hsl(var(--success))`},cancelled:{label:`Cancelled`,icon:n,text:`text-muted-foreground`,ring:`border-border/70 bg-muted/45`,dot:`bg-muted-foreground`,hex:`hsl(var(--muted-foreground))`}};function A(e){return k[e]??k.pending}var j={critical:{text:`text-destructive`,chip:`bg-destructive/10 text-destructive`},high:{text:`text-warning`,chip:`bg-warning/12 text-warning`},medium:{text:`text-primary`,chip:`bg-primary/10 text-primary`},low:{text:`text-muted-foreground`,chip:`bg-muted text-muted-foreground`}};function M(e){return j[e]??j.medium}var N={running:`border-primary/35 bg-primary/10 text-primary`,paused:`border-warning/35 bg-warning/10 text-warning`,stopped:`border-border/70 bg-muted text-muted-foreground`,completed:`border-success/35 bg-success/10 text-success`,failed:`border-destructive/35 bg-destructive/10 text-destructive`,deadlocked:`border-destructive/35 bg-destructive/10 text-destructive`,idle:`border-border bg-muted text-muted-foreground`},P=[`bg-warning`,`bg-primary`,`bg-success`,`bg-destructive`,`bg-secondary`,`bg-muted-foreground`,`bg-accent`],F={started:{icon:b,color:`text-warning`},completed:{icon:s,color:`text-success`},failed:{icon:f,color:`text-destructive`},retrying:{icon:i,color:`text-warning`},wave:{icon:p,color:`text-primary`},deadlock:{icon:h,color:`text-destructive`},verification_failed:{icon:a,color:`text-destructive`},conflict:{icon:l,color:`text-warning`},split:{icon:x,color:`text-primary`},supervisor:{icon:r,color:`text-primary`}};function I(e){let t=e.trim().split(/\s+/);return((t[0]?.[0]??``)+(t[1]?.[0]??``)).toUpperCase()||`·`}function L(e){let t=Math.max(0,Math.floor(e/1e3));if(t<60)return`${t}s`;let n=Math.floor(t/60);return n<60?t%60?`${n}m ${t%60}s`:`${n}m`:`${Math.floor(n/60)}h ${n%60}m`}function R(e,t){let n=Math.max(0,Math.floor((t-e)/1e3));if(n<60)return`${n}s`;let r=Math.floor(n/60);return r<60?`${r}m`:`${Math.floor(r/60)}h`}var z=w(),B=300,V=128,H=240,U={pending:{ring:`border-border/70`,chip:`bg-muted text-muted-foreground`,dot:`bg-muted-foreground`},queued:{ring:`border-primary/35`,chip:`bg-primary/10 text-primary`,dot:`bg-primary`},in_progress:{ring:`border-warning/45`,chip:`bg-warning/12 text-warning`,dot:`bg-warning`},blocked:{ring:`border-destructive/30`,chip:`bg-destructive/10 text-destructive`,dot:`bg-destructive`},review:{ring:`border-primary/35`,chip:`bg-primary/10 text-primary`,dot:`bg-primary`},failed:{ring:`border-destructive/45`,chip:`bg-destructive/10 text-destructive`,dot:`bg-destructive`},completed:{ring:`border-success/35`,chip:`bg-success/12 text-success`,dot:`bg-success`},cancelled:{ring:`border-border/70`,chip:`bg-muted text-muted-foreground`,dot:`bg-muted-foreground`}};function W({data:e}){let n=e.task,{t:r}=c(),a=U[n.displayStatus],l=n.displayStatus===`in_progress`,d=n.displayStatus===`completed`?s:n.displayStatus===`failed`?f:l?E:o;return(0,z.jsxs)(`div`,{className:D(`sdd-node-enter group relative rounded-lg border bg-card/95 px-2.5 py-2 text-left shadow-lg backdrop-blur`,a.ring,l&&`sdd-node-running`,n.displayStatus===`completed`&&`sdd-node-complete`,n.displayStatus===`failed`&&`sdd-node-failed`,e.onTaskClick&&`hover:brightness-125`),style:{width:H,animationDelay:`${Math.min(e.index*45,600)}ms`},children:[e.onTaskClick&&(0,z.jsx)(`button`,{type:`button`,"aria-label":r(`activity:sdd.openTask`,{title:n.title,defaultValue:`Open task: ${n.title}`}),className:`absolute inset-0 z-10 cursor-pointer rounded-lg`,onClick:()=>e.onTaskClick?.(n.id)}),(0,z.jsx)(C,{type:`target`,position:u.Left,isConnectable:!1,className:`!h-1.5 !w-1.5 !border-0 !bg-border`}),(0,z.jsx)(C,{type:`source`,position:u.Right,isConnectable:!1,className:`!h-1.5 !w-1.5 !border-0 !bg-border`}),(0,z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,z.jsx)(d,{className:D(`h-3.5 w-3.5`,l&&`animate-spin`,a.chip.split(` `).find(e=>e.startsWith(`text`)))}),(0,z.jsx)(`span`,{className:`font-mono text-[10px] text-muted-foreground`,children:n.shortId}),(0,z.jsx)(`span`,{className:D(`font-mono text-[10px] font-bold uppercase`,M(n.priority).text),children:n.priority[0]}),(0,z.jsx)(`span`,{className:D(`ml-auto rounded px-1.5 py-px text-[9px] font-medium`,a.chip),children:r(`activity:sdd.status.${n.displayStatus}`)})]}),(0,z.jsx)(`p`,{className:`mt-1 line-clamp-2 text-[11px] leading-snug text-foreground`,children:n.title}),(n.agentName||n.worktreeBranch)&&(0,z.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-1.5`,children:[n.agentName&&(0,z.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,z.jsx)(`span`,{className:D(`flex h-4 w-4 items-center justify-center rounded-full text-[8px] font-bold text-white`,l?`bg-warning sdd-agent-live`:`bg-muted-foreground`),children:I(n.agentName)}),(0,z.jsx)(`span`,{className:`max-w-[88px] truncate text-[10px] text-muted-foreground`,children:n.agentName})]}),n.retries?(0,z.jsxs)(`span`,{className:`flex items-center gap-0.5 text-[9px] text-destructive`,children:[(0,z.jsx)(i,{className:`h-2.5 w-2.5`}),n.retries]}):null,n.worktreeBranch&&(0,z.jsxs)(`span`,{className:`ml-auto flex items-center gap-0.5 text-[9px] text-muted-foreground`,title:n.worktreeBranch,children:[(0,z.jsx)(t,{className:`h-2.5 w-2.5`}),(0,z.jsx)(`span`,{className:`max-w-[70px] truncate`,children:n.worktreeBranch.replace(/^.*\//,``)})]})]})]})}function G({data:e}){return(0,z.jsx)(`div`,{className:`whitespace-nowrap text-[11px] font-bold uppercase text-muted-foreground`,children:e.label})}var K={task:W,colLabel:G};function q(e,t,n){let r=new Map(e.map(e=>[e.shortId,e])),i=[],a=0;t.forEach((e,t)=>{i.push({id:`__col_${t}`,position:{x:t*B,y:-52},data:{label:e.label},draggable:!1,selectable:!1,type:`colLabel`,style:{pointerEvents:`none`}}),e.taskIds.forEach((e,o)=>{let s=r.get(e);s&&i.push({id:s.id,position:{x:t*B,y:o*V},data:{task:s,index:a++,onTaskClick:n},type:`task`,draggable:!0})})});let o=[];for(let t of e)for(let e of t.deps){let n=r.get(e);if(!n)continue;let i=n.displayStatus===`completed`&&(t.displayStatus===`in_progress`||t.displayStatus===`queued`);o.push({id:`${n.id}->${t.id}`,source:n.id,target:t.id,animated:i,className:i?`sdd-edge-flow`:void 0,style:{stroke:A(t.displayStatus).hex,strokeWidth:i?2.2:1.4,opacity:t.displayStatus===`pending`?.4:.85}})}return{nodes:i,edges:o}}function J({tasks:e,columns:t,onTaskClick:n}){let{fitView:r}=v(),{nodes:i,edges:a}=(0,O.useMemo)(()=>q(e,t,n),[e,t,n]),o=e.length;return(0,O.useEffect)(()=>{let e=setTimeout(()=>r({padding:.18,duration:400}),60);return()=>clearTimeout(e)},[o,r]),(0,z.jsxs)(_,{nodes:i,edges:a,nodeTypes:K,fitView:!0,fitViewOptions:{padding:.18},minZoom:.2,maxZoom:1.6,proOptions:{hideAttribution:!0},nodesConnectable:!1,elementsSelectable:!!n,children:[(0,z.jsx)(S,{variant:y.Dots,gap:22,size:1,color:`hsl(var(--border))`}),(0,z.jsx)(d,{showInteractive:!1,className:`!bottom-2 !left-2`}),(0,z.jsx)(m,{pannable:!0,zoomable:!0,nodeStrokeWidth:2,maskColor:`hsl(var(--background) / 0.65)`,nodeColor:e=>{let t=e.data?.task?.displayStatus;return t?A(t).hex:`hsl(var(--muted-foreground))`},className:`!bottom-2 !right-2 !h-24 !w-40 overflow-hidden rounded-md border border-border/70 bg-card`})]})}function Y({tasks:e,columns:t,onTaskClick:n}){return(0,z.jsx)(T,{children:(0,z.jsx)(J,{tasks:e,columns:t,onTaskClick:n})})}export{I as a,M as c,N as i,A as l,P as n,R as o,F as r,L as s,Y as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Br as t,Ht as n,Mt as r,Rr as i,Vr as a,Yi as o,Yr as s,Yt as ee,at as te,ea as c,mn as ne,pi as l,pt as u,tt as d,wt as f,yi as p}from"./vendor-JNPeA-SL.js";import"./i18n-BcnwAuXt.js";import{t as m}from"./utils-BLVofF8S.js";import{D as h,E as g,G as _,L as v,P as y,c as b,g as re,l as ie}from"./index-MIiPbE0D.js";import{c as ae,t as oe}from"./SddFlowGraph-ZGRYKvG4.js";var x=e(c(),1),S=d(),C={idle:`phaseStart`,questioning:`phaseInterview`,spec_review:`phaseSpecReview`,implementation:`phasePlanning`,task_review:`phaseTaskReview`,executing:`phaseRunning`,done:`phaseDone`},w=[`questioning`,`spec_review`,`implementation`,`task_review`,`executing`];function T({onClose:e}){let{t:s}=o(),{client:c}=y(),u=_(e=>e.snapshot),d=_(e=>e.agentText),T=_(e=>e.error),D=_(e=>e.startedRunId),O=_(e=>e.setStartedRunId),[k,ce]=(0,x.useState)(``),[A,j]=(0,x.useState)(``),[M,N]=(0,x.useState)(!1),[P,le]=(0,x.useState)(!0),[F,ue]=(0,x.useState)(!0),[I,L]=(0,x.useState)(!1),[R,z]=(0,x.useState)(void 0),[B,V]=(0,x.useState)(void 0),[H,de]=(0,x.useState)([]),[U,fe]=(0,x.useState)(4),[W,pe]=(0,x.useState)(!0),G=h(I),K=(0,x.useCallback)(e=>c?.send?.(e),[c]),q=(0,x.useRef)(null);(0,x.useEffect)(()=>{K({type:`sdd.spec.get`})},[K]),(0,x.useEffect)(()=>{q.current?.scrollIntoView({behavior:`smooth`,block:`end`})},[u?.answers.length??0,d]),(0,x.useEffect)(()=>{D&&(v(`sddboard`),O(null))},[D,O]);let J=u?.busy??!1,Y=u?.phase??`idle`,X=!!u;(0,x.useEffect)(()=>{X&&N(!1)},[X]);let me=u?.answers[u.answers.length-1]?.question??``,he=!!u&&(u.taskCount>0||!!u.graphId||Y===`task_review`||Y===`executing`),Z=()=>{let e=k.trim();!e||J||M||(N(!0),K({type:`sdd.spec.start`,payload:{goal:e}}))},Q=()=>{let e=A.trim();!e||J||(K({type:`sdd.spec.message`,payload:{text:e}}),j(``))},ge=()=>!J&&K({type:`sdd.spec.approve`,payload:{}}),_e=()=>{K({type:`sdd.run.start`,payload:{parallelSlots:U,worktrees:W,...R?{model:R,provider:B}:{},...H.length?{fallbackModels:H}:{}}}),L(!1)},$=(0,x.useMemo)(()=>(u?.board?.tasks??[]).map(e=>({id:e.id,shortId:e.shortId,title:e.title,displayStatus:e.displayStatus,priority:e.priority,deps:e.deps,agentName:e.agentName,worktreeBranch:e.worktreeBranch,retries:e.retries})),[u?.board]),ve=$.length>0;return(0,S.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col bg-background`,children:[(0,S.jsxs)(`header`,{className:`sdd-sheen flex shrink-0 items-center justify-between border-b border-border px-4 py-2`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(l,{className:`h-5 w-5 text-primary`}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h1`,{className:`text-lg font-semibold`,children:u?.title||s(`activity:sddWizard.titleFallback`)}),X&&(0,S.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[s(`activity:sddWizard.${C[Y]??`phaseStart`}`),Y===`questioning`&&` · ${s(`activity:sddWizard.questionsSuffix`,{cur:u?.questionCount??0,max:u?.maxQuestions??0})}`,u&&u.taskCount>0?` · ${s(`activity:sddWizard.tasksSuffix`,{count:u.taskCount})}`:``]})]}),J&&(0,S.jsx)(p,{className:`h-4 w-4 animate-spin text-muted-foreground`})]}),(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[he&&(0,S.jsxs)(`div`,{className:`relative flex items-center gap-1.5`,children:[(0,S.jsxs)(`button`,{type:`button`,onClick:()=>L(e=>!e),title:s(`activity:sddWizard.runCfgTitle`),className:m(`inline-flex items-center gap-1 rounded-md border px-2 py-1 text-xs font-medium`,R||H.length?`border-primary/40 bg-primary/10 text-primary`:`border-border bg-muted text-muted-foreground hover:text-foreground`),children:[(0,S.jsx)(r,{className:`h-3.5 w-3.5`}),R||s(`activity:sddWizard.modelsLabel`)]}),(0,S.jsxs)(`button`,{type:`button`,onClick:_e,className:`inline-flex items-center gap-1 rounded-md bg-success/15 px-2.5 py-1 text-xs font-medium text-success hover:bg-success/25`,children:[(0,S.jsx)(ee,{className:`h-3.5 w-3.5`}),` `,s(`activity:sddWizard.startRun`)]}),I&&(0,S.jsxs)(`div`,{className:`sdd-rise absolute right-0 top-9 z-50 w-72 rounded-lg border border-border bg-popover p-3 shadow-xl`,children:[(0,S.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:s(`activity:sddWizard.defaultWorkerModel`)}),(0,S.jsx)(ie,{value:R,provider:B,candidates:G,placeholder:s(`activity:sddWizard.leaderDefaultPlaceholder`),resetLabel:s(`activity:sddWizard.useSessionDefault`),onPick:(e,t)=>{z(e),V(t)},onReset:R?()=>{z(void 0),V(void 0)}:void 0}),(0,S.jsx)(`div`,{className:`mb-1 mt-3 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:s(`activity:sddWizard.fallbackChain`)}),(0,S.jsx)(b,{value:H,candidates:G,onChange:de}),(0,S.jsx)(`p`,{className:`mt-2 text-[10px] text-muted-foreground`,children:s(`activity:sddWizard.appliesToAll`)}),(0,S.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-2`,children:[(0,S.jsx)(`label`,{htmlFor:`sdd-slots`,className:`text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:s(`activity:sddWizard.parallelAgents`)}),(0,S.jsx)(`input`,{id:`sdd-slots`,type:`number`,min:1,max:16,value:U,onChange:e=>{let t=Number.parseInt(e.target.value,10);fe(Number.isFinite(t)?Math.min(16,Math.max(1,t)):1)},className:`w-16 rounded-md border border-border bg-background px-2 py-1 text-right text-xs outline-none focus:border-primary`})]}),(0,S.jsxs)(`label`,{className:`mt-2 flex cursor-pointer items-center justify-between gap-2`,children:[(0,S.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:s(`activity:sddWizard.isolateWorktrees`)}),(0,S.jsx)(`input`,{type:`checkbox`,checked:W,onChange:e=>pe(e.target.checked),className:`h-3.5 w-3.5 accent-primary`})]}),(0,S.jsx)(`p`,{className:`mt-1 text-[10px] text-muted-foreground`,children:s(W?`activity:sddWizard.worktreeOn`:`activity:sddWizard.worktreeOff`)})]})]}),(0,S.jsx)(g,{variant:`ghost`,size:`icon`,onClick:e,children:(0,S.jsx)(te,{className:`h-4 w-4`})})]})]}),X&&(0,S.jsx)(`div`,{className:`flex shrink-0 items-center gap-1 border-b bg-card/50 px-4 py-1.5 text-[11px]`,children:w.map((e,t)=>{let n=e===Y,r=w.indexOf(Y)>t;return(0,S.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,S.jsxs)(`span`,{className:m(`rounded-full px-2 py-0.5`,n?`bg-primary/15 text-primary`:r?`text-success`:`text-muted-foreground`),children:[r&&(0,S.jsx)(a,{className:`mr-0.5 inline h-3 w-3`}),s(`activity:sddWizard.${C[e]}`)]}),t<w.length-1&&(0,S.jsx)(`span`,{className:`text-muted-foreground/65`,children:`→`})]},e)})}),(0,S.jsxs)(`div`,{ref:re(`sdd-wizard`),className:`min-h-0 flex-1 overflow-auto overscroll-contain p-4`,children:[T&&(0,S.jsx)(`div`,{className:`mb-3 rounded-md border border-destructive/40 bg-destructive/5 p-2 text-xs text-destructive`,children:T}),X?(0,S.jsxs)(`div`,{className:`space-y-4`,children:[ve&&(0,S.jsxs)(`div`,{className:`sdd-rise overflow-hidden rounded-lg border border-primary/20 bg-[hsl(var(--surface-2)/0.85)]`,children:[(0,S.jsxs)(`button`,{type:`button`,onClick:()=>le(e=>!e),className:`flex w-full items-center gap-1.5 border-b border-border/60 px-3 py-1.5 text-[11px] font-medium text-primary hover:bg-muted/40`,children:[P?(0,S.jsx)(t,{className:`h-3.5 w-3.5`}):(0,S.jsx)(i,{className:`h-3.5 w-3.5`}),(0,S.jsx)(ne,{className:`h-3.5 w-3.5`}),s(`activity:sddWizard.taskGraphSummary`,{count:u?.taskCount??0}),(0,S.jsx)(`span`,{className:`ml-auto text-muted-foreground`,children:s(P?`activity:sddWizard.dragToExplore`:`activity:sddWizard.show`)})]}),P&&(0,S.jsx)(`div`,{className:`h-[32dvh] min-h-[200px]`,children:(0,S.jsx)(oe,{tasks:$,columns:u?.board?.columns??[]})})]}),(0,S.jsxs)(`div`,{className:`mx-auto max-w-2xl space-y-3`,children:[u?.goal&&(0,S.jsxs)(`div`,{className:`rounded-md border border-border bg-muted/30 px-3 py-2`,children:[(0,S.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:[(0,S.jsx)(f,{className:`h-3 w-3`}),` `,s(`activity:sddWizard.goalLabel`)]}),(0,S.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-relaxed text-foreground/90`,children:u.goal})]}),u?.answers.length||d&&Y===`questioning`||J?(0,S.jsxs)(`div`,{className:`space-y-2.5`,children:[u?.answers.map(e=>(0,S.jsxs)(`div`,{className:`space-y-2.5`,children:[(0,S.jsx)(E,{speaker:`assistant`,text:e.question}),(0,S.jsx)(E,{speaker:`user`,text:e.answer})]},e.question.slice(0,64))),d&&Y===`questioning`&&d!==me&&(0,S.jsx)(E,{speaker:`assistant`,text:d}),J&&(0,S.jsx)(E,{speaker:`assistant`,text:``,thinking:!0})]}):null,u?.spec&&(0,S.jsxs)(`div`,{className:`sdd-rise rounded-md border border-border bg-card p-3`,children:[(0,S.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-sm font-semibold`,children:[(0,S.jsx)(l,{className:`h-3.5 w-3.5 text-primary`}),u.spec.title]}),(0,S.jsx)(`p`,{className:`mb-2 text-xs text-muted-foreground`,children:u.spec.overview}),(0,S.jsx)(`ul`,{className:`space-y-0.5 text-xs`,children:u.spec.requirements.map(e=>(0,S.jsxs)(`li`,{className:`flex gap-1.5`,children:[(0,S.jsx)(`span`,{className:m(`shrink-0 font-mono uppercase`,ae(e.priority).text),children:e.priority[0]}),(0,S.jsx)(`span`,{children:e.description})]},`${e.priority}-${e.description.slice(0,32)}`))})]}),d&&(Y===`implementation`||Y===`task_review`)&&(0,S.jsxs)(`div`,{className:`sdd-rise rounded-md border border-border bg-card`,children:[(0,S.jsxs)(`button`,{type:`button`,onClick:()=>ue(e=>!e),className:`flex w-full items-center gap-1.5 border-b border-border/60 px-3 py-2 text-sm font-semibold hover:bg-muted/40`,children:[F?(0,S.jsx)(t,{className:`h-3.5 w-3.5`}):(0,S.jsx)(i,{className:`h-3.5 w-3.5`}),(0,S.jsx)(l,{className:`h-3.5 w-3.5 text-primary`}),` `,s(`activity:sddWizard.implementationPlan`)]}),F&&(0,S.jsx)(`div`,{className:`max-h-[40dvh] overflow-auto px-3 py-2`,children:(0,S.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-relaxed text-foreground/90`,children:se(d)})})]}),d&&Y!==`questioning`&&Y!==`implementation`&&Y!==`task_review`&&!u?.spec&&(0,S.jsx)(E,{speaker:`assistant`,text:d}),(Y===`spec_review`||Y===`implementation`||Y===`task_review`)&&(0,S.jsxs)(g,{variant:`secondary`,onClick:ge,disabled:J,children:[(0,S.jsx)(a,{className:`mr-1.5 h-4 w-4`}),s(Y===`spec_review`?`activity:sddWizard.approveSpec`:Y===`task_review`?`activity:sddWizard.approveTasks`:`activity:sddWizard.approvePlan`)]}),(0,S.jsx)(`div`,{ref:q})]})]}):(0,S.jsxs)(`div`,{className:`mx-auto mt-8 max-w-xl`,children:[(0,S.jsx)(`label`,{className:`mb-2 block text-sm font-medium`,htmlFor:`sdd-goal`,children:s(`activity:sddWizard.goalPrompt`)}),(0,S.jsx)(`textarea`,{id:`sdd-goal`,value:k,onChange:e=>ce(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&Z()},rows:4,placeholder:s(`activity:sddWizard.goalPlaceholder`),className:`w-full resize-none rounded-md border border-border bg-card px-3 py-2 text-sm outline-none focus:border-primary`}),(0,S.jsx)(g,{className:`mt-3`,onClick:Z,disabled:!k.trim()||M,children:M?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(p,{className:`mr-1.5 h-4 w-4 animate-spin`}),` `,s(`activity:sddWizard.startingInterview`)]}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(l,{className:`mr-1.5 h-4 w-4`}),` `,s(`activity:sddWizard.startInterview`)]})}),(0,S.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:s(`activity:sddWizard.introBody`)})]})]}),X&&Y!==`executing`&&Y!==`done`&&(0,S.jsxs)(`div`,{className:`flex shrink-0 items-end gap-2 border-t bg-card px-4 py-2`,children:[(0,S.jsx)(`textarea`,{value:A,onChange:e=>j(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),Q())},rows:1,placeholder:s(Y===`questioning`?`activity:sddWizard.answerPlaceholder`:`activity:sddWizard.changePlaceholder`),disabled:J,className:`max-h-32 flex-1 resize-none rounded-md border border-border bg-background px-3 py-2 text-sm outline-none focus:border-primary disabled:opacity-50`}),(0,S.jsx)(g,{size:`icon`,onClick:Q,disabled:J||!A.trim(),children:(0,S.jsx)(n,{className:`h-4 w-4`})})]})]})}function se(e){let t=e.replace(/```json[\s\S]*?```/gi,``).trim();return t.length>0?t:e.trim()}function E({speaker:e,text:t,live:n,thinking:r}){let i=e===`user`;return(0,S.jsxs)(`div`,{className:m(`sdd-rise flex items-start gap-2`,i&&`flex-row-reverse`),children:[(0,S.jsx)(`span`,{className:m(`mt-0.5 flex h-6 w-6 shrink-0 items-center justify-center rounded-full`,i?`bg-info/15 text-info`:`bg-primary/15 text-primary`,(n||r)&&`sdd-agent-live`),children:i?(0,S.jsx)(u,{className:`h-3.5 w-3.5`}):(0,S.jsx)(s,{className:`h-3.5 w-3.5`})}),(0,S.jsx)(`div`,{className:m(`max-w-[80%] whitespace-pre-wrap rounded-2xl px-3 py-2 text-sm leading-relaxed text-foreground`,i?`rounded-tr-sm bg-info/10`:`rounded-tl-sm bg-muted`),children:r?(0,S.jsxs)(`span`,{className:`flex items-center gap-1 py-0.5`,children:[(0,S.jsx)(`span`,{className:`h-1.5 w-1.5 animate-bounce rounded-full bg-muted-foreground [animation-delay:-200ms]`}),(0,S.jsx)(`span`,{className:`h-1.5 w-1.5 animate-bounce rounded-full bg-muted-foreground [animation-delay:-100ms]`}),(0,S.jsx)(`span`,{className:`h-1.5 w-1.5 animate-bounce rounded-full bg-muted-foreground`})]}):t})]})}export{T as SddWizard};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{$t as t,Hi as n,Kn as r,Qi as i,Tr as a,Ui as o,Vi as s,Yi as c,cr as l,ct as u,ea as d,it as f,kr as p,li as m,lt as h,tt as g,yi as _}from"./vendor-JNPeA-SL.js";import"./i18n-BcnwAuXt.js";import{t as v}from"./utils-BLVofF8S.js";import{t as y}from"./session-store-CgCoJmdF.js";import{P as b,Q as x,at as S,d as C,f as w,g as T,i as E,m as D,p as O}from"./index-MIiPbE0D.js";var k=e(d(),1),A=g();async function j(e){try{let t=await e.clone().json(),n=typeof t.error==`string`?t.error:t.message;if(typeof n==`string`&&n.trim())return n}catch{try{let t=await e.text();if(t.trim())return t.trim()}catch{}}return e.statusText||`HTTP ${e.status}`}function M(e){switch(e){case`running`:return{icon:(0,A.jsx)(m,{className:`h-3.5 w-3.5`}),cls:`text-success`};case`streaming`:return{icon:(0,A.jsx)(t,{className:`h-3.5 w-3.5`}),cls:`text-primary`};case`waiting_user`:return{icon:(0,A.jsx)(p,{className:`h-3.5 w-3.5`}),cls:`text-warning`};case`error`:return{icon:(0,A.jsx)(o,{className:`h-3.5 w-3.5`}),cls:`text-destructive`};case`idle`:return{icon:(0,A.jsx)(s,{className:`h-3.5 w-3.5`}),cls:`text-muted-foreground`};default:return{icon:(0,A.jsx)(n,{className:`h-3.5 w-3.5`}),cls:`text-muted-foreground`}}}function N(e){switch(e){case`active`:return{icon:(0,A.jsx)(u,{className:`h-3.5 w-3.5`}),cls:`text-success`,badge:`border-success/25 bg-success/8 text-success`};case`idle`:return{icon:(0,A.jsx)(h,{className:`h-3.5 w-3.5`}),cls:`text-primary`,badge:`border-primary/25 bg-primary/10 text-primary`};case`closing`:return{icon:(0,A.jsx)(p,{className:`h-3.5 w-3.5`}),cls:`text-warning`,badge:`border-warning/25 bg-warning/10 text-warning`};case`lost`:return{icon:(0,A.jsx)(h,{className:`h-3.5 w-3.5`}),cls:`text-destructive/60`,badge:`border-destructive/15 bg-destructive/5 text-destructive/70`};default:return{icon:(0,A.jsx)(h,{className:`h-3.5 w-3.5`}),cls:`text-muted-foreground`,badge:`border-border bg-muted text-muted-foreground`}}}function P(e){let t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<1)return`<1m`;if(n<60)return`${n}m`;let r=Math.floor(n/60);return r<24?`${r}h ${n%60}m`:`${Math.floor(r/24)}d`}function F(e){let t=Date.now()-new Date(e).getTime(),n=Math.floor(t/1e3);if(n<10)return i.t(`common:time.justNow`);if(n<60)return i.t(`common:time.secondsAgo`,{count:n});let r=Math.floor(n/60);return r<60?i.t(`common:time.minutesAgo`,{count:r}):i.t(`common:time.hoursAgo`,{count:Math.floor(r/60)})}function I(){let e=S(e=>e.wsConnected),t=y(e=>e.session?.id),{entries:n,loading:r,error:i}=x(f(e=>({entries:e.entries,loading:e.loading,error:e.error}))),{listSessions:a,resumeSession:o,deleteSession:s,renameSession:c}=b(),[l,u]=(0,k.useState)(``);return(0,k.useEffect)(()=>{e&&a(200)},[t,a,e]),(0,A.jsx)(E,{historyQuery:l,setHistoryQuery:u,historyEntries:n,historyLoading:r,historyError:i,wsConnected:e,listSessions:a,resumeSession:o,deleteSession:s,renameSession:c,variant:`workspace`})}function L(){let{t:e}=c();return(0,A.jsxs)(C,{defaultValue:`history`,className:`flex h-full min-h-0 flex-col bg-background`,"data-testid":`sessions-workspace`,children:[(0,A.jsxs)(`header`,{className:`flex shrink-0 flex-col gap-3 border-b border-border/75 bg-card px-4 py-3 lg:flex-row lg:items-center lg:justify-between`,children:[(0,A.jsxs)(`div`,{className:`min-w-0`,children:[(0,A.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-[0.16em] text-primary`,children:e(`activity:sessions.workspaceEyebrow`,{defaultValue:`Conversation control`})}),(0,A.jsx)(`h1`,{className:`mt-0.5 text-lg font-semibold tracking-tight`,children:e(`activity:sessions.workspaceTitle`,{defaultValue:`Sessions`})})]}),(0,A.jsxs)(O,{className:`h-9 min-h-9 justify-start border-border/75 bg-background p-0 shadow-none`,children:[(0,A.jsxs)(D,{value:`history`,className:`h-9 gap-1.5 border-r border-border/75 px-3 text-xs shadow-none data-[state=active]:bg-foreground data-[state=active]:text-background data-[state=active]:ring-0`,children:[(0,A.jsx)(r,{className:`h-3.5 w-3.5`}),e(`activity:sessions.tabs.history`,{defaultValue:`History`})]}),(0,A.jsxs)(D,{value:`live`,className:`h-9 gap-1.5 px-3 text-xs shadow-none data-[state=active]:bg-foreground data-[state=active]:text-background data-[state=active]:ring-0`,children:[(0,A.jsx)(t,{className:`h-3.5 w-3.5`}),e(`activity:sessions.tabs.live`,{defaultValue:`Live sessions`})]})]})]}),(0,A.jsx)(w,{value:`history`,className:`mt-0 min-h-0 flex-1 overflow-hidden ring-0`,children:(0,A.jsx)(I,{})}),(0,A.jsx)(w,{value:`live`,className:`mt-0 min-h-0 flex-1 overflow-hidden ring-0`,children:(0,A.jsx)(R,{})})]})}function R(){let{t:e}=c(),[t,n]=(0,k.useState)([]),[r,i]=(0,k.useState)(!0),[s,d]=(0,k.useState)(null),f=T(`sessions`,!r&&!s&&t.length>0),m=(0,k.useCallback)(async()=>{try{let e=await fetch(`/api/sessions`);if(!e.ok){if(e.status===404){d(null),n([]);return}throw Error(`HTTP ${e.status}: ${await j(e)}`)}if(!(e.headers.get(`content-type`)?.toLowerCase()??``).includes(`application/json`)){d(null),n([]);return}let t=await e.json();if(!Array.isArray(t)){d(null),n([]);return}n(e=>{let n=t;if(e.length===n.length){let t=!0;for(let r=0;r<n.length;r++){let i=n[r],a=e[r];if(i.sessionId!==a.sessionId||i.status!==a.status||i.agentCount!==a.agentCount||i.startedAt!==a.startedAt){t=!1;break}}if(t)return e}return n}),d(null)}catch(e){if(e instanceof SyntaxError){d(null),n([]);return}d(e instanceof Error?e.message:String(e))}finally{i(!1)}},[]);(0,k.useEffect)(()=>{m();let e=setInterval(m,5e3);return()=>clearInterval(e)},[m]);let g=t.filter(e=>e.status===`active`).length,y=t.reduce((e,t)=>e+t.agentCount,0);return r?(0,A.jsx)(`div`,{className:`flex h-full min-h-0 items-center justify-center bg-[hsl(var(--surface-2)/0.45)] p-4`,children:(0,A.jsxs)(`div`,{className:`ws-surface flex items-center gap-2 px-4 py-3 text-sm text-muted-foreground`,children:[(0,A.jsx)(_,{className:`h-4 w-4 animate-spin text-primary`}),e(`activity:liveSessions.loading`)]})}):s?(0,A.jsx)(`div`,{className:`flex h-full min-h-0 items-center justify-center bg-[hsl(var(--surface-2)/0.45)] p-4`,children:(0,A.jsxs)(`div`,{className:`ws-surface max-w-lg p-5 text-center`,children:[(0,A.jsx)(o,{className:`mx-auto h-8 w-8 text-warning`}),(0,A.jsx)(`p`,{className:`mt-3 text-sm font-medium`,children:e(`activity:liveSessions.apiUnavailable`)}),(0,A.jsx)(`p`,{className:`mt-1 break-words text-xs text-muted-foreground`,children:s})]})}):t.length===0?(0,A.jsx)(`div`,{className:`flex h-full min-h-0 items-center justify-center bg-[hsl(var(--surface-2)/0.45)] p-4`,children:(0,A.jsxs)(`div`,{className:`ws-surface max-w-md p-6 text-center text-muted-foreground`,children:[(0,A.jsx)(h,{className:`mx-auto h-9 w-9 opacity-50`}),(0,A.jsx)(`p`,{className:`mt-3 text-sm font-medium text-foreground`,children:e(`activity:liveSessions.empty`)}),(0,A.jsx)(`p`,{className:`mt-1 text-xs`,children:e(`activity:liveSessions.autoRefresh`)})]})}):(0,A.jsx)(`div`,{ref:f,className:`h-full min-h-0 overflow-y-auto overscroll-contain bg-[hsl(var(--surface-2)/0.45)] p-4 sm:p-6`,children:(0,A.jsxs)(`div`,{className:`mx-auto flex w-full max-w-6xl flex-col gap-4`,children:[(0,A.jsx)(`header`,{className:`border border-border/70 bg-card/75 p-4`,children:(0,A.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,A.jsxs)(`div`,{className:`min-w-0`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,A.jsx)(u,{className:`h-4 w-4 text-primary`}),(0,A.jsx)(`h2`,{className:`text-base font-semibold`,children:e(`activity:liveSessions.heading`,{count:t.length})})]}),(0,A.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:e(`activity:liveSessions.autoRefresh`)})]}),(0,A.jsxs)(`div`,{className:`grid grid-cols-3 gap-2 text-center sm:min-w-[22rem]`,children:[(0,A.jsxs)(`div`,{className:`border border-border/70 bg-background/60 px-3 py-2`,children:[(0,A.jsx)(`div`,{className:`text-lg font-semibold tabular-nums`,children:t.length}),(0,A.jsx)(`div`,{className:`text-[10px] uppercase text-muted-foreground`,children:`Sessions`})]}),(0,A.jsxs)(`div`,{className:`border border-border/70 bg-background/60 px-3 py-2`,children:[(0,A.jsx)(`div`,{className:`text-lg font-semibold tabular-nums text-success`,children:g}),(0,A.jsx)(`div`,{className:`text-[10px] uppercase text-muted-foreground`,children:`Active`})]}),(0,A.jsxs)(`div`,{className:`border border-border/70 bg-background/60 px-3 py-2`,children:[(0,A.jsx)(`div`,{className:`text-lg font-semibold tabular-nums`,children:y}),(0,A.jsx)(`div`,{className:`text-[10px] uppercase text-muted-foreground`,children:`Agents`})]})]})]})}),(0,A.jsx)(`div`,{className:`grid gap-3`,children:t.map(t=>{let n=N(t.status);return(0,A.jsxs)(`article`,{className:`border border-border/70 bg-card/75 p-3 sm:p-4`,children:[(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3 lg:flex-row lg:items-start lg:justify-between`,children:[(0,A.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,A.jsx)(`span`,{className:n.cls,children:n.icon}),(0,A.jsx)(`h3`,{className:`min-w-0 truncate text-sm font-semibold`,title:t.projectName,children:t.projectName}),(0,A.jsx)(`span`,{className:`bg-muted px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground`,children:t.projectSlug}),(0,A.jsx)(`span`,{className:`inline-flex items-center border px-1.5 py-0.5 text-[10px] font-semibold uppercase ${n.badge}`,children:t.status})]}),(0,A.jsxs)(`div`,{className:`mt-2 grid gap-1.5 text-xs text-muted-foreground md:grid-cols-[minmax(0,1fr)_auto]`,children:[(0,A.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,A.jsx)(a,{className:`h-3.5 w-3.5 shrink-0`}),(0,A.jsx)(`span`,{className:`min-w-0 truncate font-mono`,title:t.workingDir,children:t.workingDir})]}),(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[t.gitBranch?(0,A.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-full items-center gap-1 text-primary`,children:[(0,A.jsx)(l,{className:`h-3.5 w-3.5 shrink-0`}),(0,A.jsx)(`span`,{className:`truncate font-mono`,children:t.gitBranch})]}):null,(0,A.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,A.jsx)(p,{className:`h-3.5 w-3.5`}),P(t.startedAt)]}),(0,A.jsx)(`span`,{className:`font-mono`,children:e(`activity:liveSessions.pidLabel`,{pid:t.pid})})]})]})]}),(0,A.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 text-xs sm:grid-cols-3 lg:w-64`,children:[(0,A.jsxs)(`div`,{className:`border border-border/70 bg-background/50 px-2 py-1.5`,children:[(0,A.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:`Agents`}),(0,A.jsx)(`div`,{className:`font-semibold tabular-nums`,children:t.agentCount})]}),(0,A.jsxs)(`div`,{className:`border border-border/70 bg-background/50 px-2 py-1.5`,children:[(0,A.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:`Status`}),(0,A.jsx)(`div`,{className:`truncate font-mono font-semibold`,children:t.status})]}),(0,A.jsxs)(`div`,{className:`border border-border/70 bg-background/50 px-2 py-1.5`,children:[(0,A.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:`Runtime`}),(0,A.jsx)(`div`,{className:`font-mono font-semibold`,children:P(t.startedAt)})]})]})]}),(0,A.jsxs)(`div`,{className:`mt-3 overflow-hidden border border-border/70 bg-background/45`,children:[t.agents.length===0?(0,A.jsx)(`div`,{className:`px-3 py-3 text-xs text-muted-foreground`,children:e(`activity:liveSessions.noAgents`)}):(0,A.jsx)(`div`,{className:`divide-y divide-border/60`,children:t.agents.slice(0,5).map(t=>{let n=M(t.status);return(0,A.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[auto_minmax(0,1fr)] gap-x-2 gap-y-1 px-3 py-2 text-xs sm:grid-cols-[auto_minmax(0,1fr)_minmax(0,14rem)_auto]`,children:[(0,A.jsx)(`span`,{className:v(`mt-0.5 shrink-0`,n.cls),children:n.icon}),(0,A.jsxs)(`div`,{className:`min-w-0`,children:[(0,A.jsx)(`div`,{className:`truncate font-medium`,title:t.name,children:t.name}),(0,A.jsx)(`div`,{className:`font-mono text-[10px] text-muted-foreground`,children:e(`activity:liveSessions.agentMeta`,{iter:t.iterations,tools:t.toolCalls,ago:F(t.lastActivityAt)})})]}),(0,A.jsx)(`div`,{className:`min-w-0 font-mono text-[10px] text-muted-foreground sm:text-xs`,children:t.currentTool?(0,A.jsx)(`span`,{className:`block truncate`,title:t.currentTool,children:t.currentTool}):(0,A.jsx)(`span`,{className:`text-muted-foreground/75`,children:t.status})}),(0,A.jsx)(`span`,{className:`hidden font-mono text-[10px] text-muted-foreground sm:block`,children:F(t.lastActivityAt)})]},t.id)})}),t.agents.length>5?(0,A.jsx)(`div`,{className:`border-t border-border/60 px-3 py-2 text-xs text-muted-foreground`,children:e(`activity:liveSessions.andMore`,{count:t.agents.length-5})}):null]})]},t.sessionId)})})]})})}export{L as SessionsDashboard};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Br as t,Dr as n,Pt as r,Qi as i,Qt as a,Rr as o,Vn as s,Vr as c,Xn as l,Yi as u,Yr as d,ea as f,er as p,it as m,ni as h,ot as g,pi as _,rn as v,t as y,tt as b,yi as x,yr as S,zt as ee}from"./vendor-JNPeA-SL.js";import"./i18n-BcnwAuXt.js";import{t as C}from"./ws-client-3f38Kop2.js";import{t as w}from"./utils-BLVofF8S.js";import{A as T,E,F as D,M as O,N as k,O as A,P as j,R as M,at as N,h as P,k as te,o as F,v as I}from"./index-MIiPbE0D.js";var L=e(f(),1),R=e(y(),1),z=b();function B(e,t=8e3){return new Promise((n,r)=>{let i=setTimeout(()=>{a(),r(Error(`timeout`))},t),a=e.on(`key.operation_result`,e=>{clearTimeout(i),a(),n(e.payload)})})}var V=[{id:`openai`,name:`OpenAI`,description:`GPT, o-series, and Codex models`,icon:`🤖`,color:`from-success/12 to-success/5 border-success/30 hover:border-success/50`,keyPlaceholder:`sk-...`,docsUrl:`https://platform.openai.com/api-keys`,family:`openai`},{id:`anthropic`,name:`Anthropic`,description:`Claude model access`,icon:`🧠`,color:`from-warning/12 to-warning/5 border-warning/30 hover:border-warning/50`,keyPlaceholder:`sk-ant-...`,docsUrl:`https://console.anthropic.com/settings/keys`,family:`anthropic`},{id:`google`,name:`Google`,description:`Gemini Pro, Flash, and Nano`,icon:`✨`,color:`from-info/12 to-info/5 border-info/30 hover:border-info/50`,keyPlaceholder:`AIza...`,docsUrl:`https://aistudio.google.com/apikey`,family:`google`},{id:`mistral`,name:`Mistral AI`,description:`Mistral Large, Codestral, and Ministral — open-weight frontier models.`,icon:`🌬️`,color:`from-info/12 to-info/5 border-info/30 hover:border-info/50`,keyPlaceholder:`Vz8d...`,docsUrl:`https://console.mistral.ai/api-keys/`,family:`openai-compatible`},{id:`deepseek`,name:`DeepSeek`,description:`High-performance reasoning at low cost`,icon:`🐋`,color:`from-primary/12 to-primary/5 border-primary/30 hover:border-primary/50`,keyPlaceholder:`sk-...`,docsUrl:`https://platform.deepseek.com/api_keys`,family:`openai-compatible`},{id:`openrouter`,name:`OpenRouter`,description:`All models via one key`,icon:`🔀`,color:`from-primary/12 to-primary/5 border-primary/30 hover:border-primary/50`,keyPlaceholder:`sk-or-...`,docsUrl:`https://openrouter.ai/keys`,family:`openai-compatible`},{id:`groq`,name:`GroqCloud`,description:`Ultra-fast inference via LPU hardware — Llama, Mixtral, Gemma, and Qwen models.`,icon:`⚡`,color:`from-warning/12 to-warning/5 border-warning/30 hover:border-warning/50`,keyPlaceholder:`gsk_...`,docsUrl:`https://console.groq.com/keys`,family:`openai-compatible`},{id:`perplexity`,name:`Perplexity Sonar`,description:`Web-augmented chat models with built-in search and citations.`,icon:`🔍`,color:`from-info/12 to-info/5 border-info/30 hover:border-info/50`,keyPlaceholder:`pplx-...`,docsUrl:`https://docs.perplexity.ai/guides/getting-started`,family:`openai-compatible`},{id:`minimax`,name:`MiniMax Token Plan`,description:`Subscribe to one plan and unlock the latest models, including frontier coding capabilities, 1M ultra-long context, and native multimodality.`,icon:`🔮`,color:`from-destructive/10 to-destructive/5 border-destructive/25 hover:border-destructive/45`,keyPlaceholder:`eyJ...`,docsUrl:`https://platform.minimax.io/subscribe/token-plan`,family:`openai-compatible`},{id:`kimi-for-coding`,name:`Kimi Code`,description:`Personal interactive coding with the Kimi Code subscription key. Generate the API key at kimi.com/code/console.`,icon:`🌙`,color:`from-info/12 to-info/5 border-info/30 hover:border-info/50`,keyPlaceholder:`sk-...`,docsUrl:`https://www.kimi.com/code/docs/en/third-party-tools/other-coding-agents.html`,family:`openai-compatible`},{id:`moonshotai`,name:`Moonshot Platform (Metered)`,description:`Metered Moonshot Platform API — pay-as-you-go for automation, background work, and commercial use.`,icon:`🌑`,color:`from-info/12 to-info/5 border-info/30 hover:border-info/50`,keyPlaceholder:`sk-...`,docsUrl:`https://platform.kimi.ai/docs/api/overview`,family:`openai-compatible`},{id:`zai-coding-plan`,name:`Z.AI Coding Plan`,description:`Use your Z.AI Coding Plan subscription. Generate an API key from your Z.AI dashboard.`,icon:`🔷`,color:`from-primary/12 to-primary/5 border-primary/30 hover:border-primary/50`,keyPlaceholder:`...`,docsUrl:`https://docs.z.ai/guides/overview/quick-start`,family:`openai-compatible`},{id:`zai`,name:`Z.AI API (Metered)`,description:`Pay-as-you-go Z.AI GLM access for automation and commercial use.`,icon:`🔷`,color:`from-primary/12 to-primary/5 border-primary/30 hover:border-primary/50`,keyPlaceholder:`...`,docsUrl:`https://docs.z.ai/guides/overview/quick-start`,family:`openai-compatible`},{id:`opencode-go`,name:`OpenCode Go`,description:`Global hosted API for 75+ LLM providers — stable access from US, EU, and Singapore`,icon:`🌍`,color:`from-success/12 to-success/5 border-success/30 hover:border-success/50`,keyPlaceholder:`oc-...`,docsUrl:`https://opencode.ai/go?ref=6VZAER87H4`,family:`openai-compatible`}];async function H(e,t){try{let n=await fetch(e,{signal:t});if(!n.ok)throw Error(`HTTP ${n.status}`);let r=await n.json();if(!Array.isArray(r))throw Error(`Expected JSON array`);let i=r.filter(e=>typeof e.id==`string`&&typeof e.name==`string`&&typeof e.family==`string`);return i.length>0?i:V}catch{return V}}function U({popular:e,catalogProvider:r,savedProvider:i,onKeySaved:a}){let{t:s}=u(),[l,d]=(0,L.useState)(``),[f,m]=(0,L.useState)(!1),[h,g]=(0,L.useState)(!!i?.apiKeys.some(e=>e.isActive)),[_,v]=(0,L.useState)(!1),[y,b]=(0,L.useState)(!1),[j,M]=(0,L.useState)(!1),[P,F]=(0,L.useState)(null);(0,L.useEffect)(()=>{j&&e.referral&&R.toDataURL(e.referral.url,{width:200,margin:2,color:{dark:`#000000`,light:`#ffffff`}}).then(e=>F(e)).catch(()=>F(null))},[j,e.referral]);let V=async()=>{if(l.trim()){m(!0);try{let t=C(N.getState().wsUrl),n=B(t);r?t.addKey(e.id,`default`,l.trim()):t.send({type:`provider.add`,payload:{id:e.id,family:e.family,apiKey:l.trim()}});let i=await n;if(!i.success)throw Error(i.message);g(!0),d(``),D.success(s(`setup:screen.toasts.keySaved`,{name:e.name})),a(e.id)}catch(t){let n=t instanceof Error&&t.message&&t.message!==`timeout`?t.message:null;D.error(n??s(`setup:screen.toasts.keySaveFailed`,{name:e.name}))}finally{m(!1)}}},H=e=>{e.key===`Enter`&&l.trim()&&V()},U=async()=>{if(e.referral)try{await navigator.clipboard.writeText(e.referral.url),b(!0),D.success(s(`setup:screen.toasts.referralCopied`)),setTimeout(()=>b(!1),2e3)}catch{D.error(s(`setup:screen.toasts.referralCopyFailed`))}},ne=r&&r.modelCount>0;return(0,z.jsxs)(`div`,{className:w(`rounded-xl border p-4 transition-all`,h?`border-success/30 bg-success/5`:`bg-gradient-to-br ${e.color}`),children:[(0,z.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,z.jsx)(`span`,{className:`text-2xl shrink-0 mt-0.5`,children:e.icon}),(0,z.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(`h3`,{className:`text-sm font-semibold`,children:e.name}),h&&(0,z.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded-full bg-success/10 text-success border border-success/20`,children:[(0,z.jsx)(c,{className:`h-2.5 w-2.5`}),s(`setup:screen.card.keySaved`)]}),e.referral&&!h&&(0,z.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded-full bg-warning/10 text-warning border border-warning/20`,children:[(0,z.jsx)(p,{className:`h-2.5 w-2.5`}),s(`setup:screen.card.referral`)]})]}),(0,z.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:e.description}),e.referral&&!h&&(0,z.jsxs)(`p`,{className:`text-[11px] text-warning/80 mt-1`,children:[`🎁 `,e.referral.reward]}),h?ne?(0,z.jsxs)(`button`,{type:`button`,onClick:()=>v(!_),className:`mt-2 text-[11px] text-muted-foreground hover:text-foreground transition-colors flex items-center gap-1`,children:[s(`setup:screen.providers.modelsAvailable`,{count:r?.modelCount??0}),_?(0,z.jsx)(t,{className:`h-3 w-3`}):(0,z.jsx)(o,{className:`h-3 w-3`})]}):null:(0,z.jsxs)(`div`,{className:`mt-3 space-y-2`,children:[(0,z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,z.jsx)(I,{type:`password`,placeholder:e.keyPlaceholder,value:l,onChange:e=>d(e.target.value),onKeyDown:H,className:`font-mono text-sm`}),(0,z.jsx)(E,{onClick:V,disabled:!l.trim()||f,size:`sm`,className:`shrink-0`,children:f?(0,z.jsx)(x,{className:`h-4 w-4 animate-spin`}):s(`setup:screen.card.save`)})]}),e.docsUrl&&(0,z.jsxs)(`a`,{href:e.docsUrl,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground transition-colors`,children:[s(`setup:screen.card.getKey`),` `,(0,z.jsx)(S,{className:`h-3 w-3`})]}),e.referral&&(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(`button`,{type:`button`,onClick:U,className:`inline-flex items-center gap-1 text-[11px] text-warning/80 hover:text-warning transition-colors`,children:y?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(c,{className:`h-3 w-3`}),` `,s(`setup:screen.card.copied`)]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(n,{className:`h-3 w-3`}),` `,s(`setup:screen.card.copyReferral`)]})}),(0,z.jsxs)(`button`,{type:`button`,onClick:()=>M(!0),className:`inline-flex items-center gap-1 text-[11px] text-warning/80 hover:text-warning transition-colors`,children:[(0,z.jsx)(ee,{className:`h-3 w-3`}),` `,s(`setup:screen.card.share`)]})]})]})]})]}),(0,z.jsx)(A,{open:j,onOpenChange:M,children:(0,z.jsxs)(te,{className:`sm:max-w-md`,children:[(0,z.jsxs)(O,{children:[(0,z.jsxs)(k,{className:`flex items-center gap-2`,children:[(0,z.jsx)(p,{className:`h-4 w-4 text-warning`}),s(`setup:screen.share.title`,{name:e.name})]}),(0,z.jsx)(T,{children:s(`setup:screen.share.description`)})]}),(0,z.jsx)(`div`,{className:`flex flex-col items-center gap-4 py-4`,children:e.referral&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`div`,{className:`text-sm text-center`,children:(0,z.jsxs)(`p`,{className:`font-medium text-warning`,children:[`🎁 `,e.referral.reward]})}),P?(0,z.jsx)(`div`,{className:`rounded-lg border border-border p-2 bg-white`,children:(0,z.jsx)(`img`,{src:P,alt:s(`setup:screen.card.qrAlt`,{name:e.name}),className:`w-[200px] h-[200px]`})}):(0,z.jsx)(`div`,{className:`w-[200px] h-[200px] rounded-lg border border-border flex items-center justify-center bg-muted`,children:(0,z.jsx)(x,{className:`h-6 w-6 animate-spin text-muted-foreground`})}),(0,z.jsxs)(`div`,{className:`w-full space-y-2`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-center gap-2`,children:[(0,z.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(`Check out ${e.name}! 🎁 ${e.referral.reward}`),n=encodeURIComponent(e.referral.url);window.open(`https://twitter.com/intent/tweet?text=${t}&url=${n}`,`_blank`,`noopener,noreferrer`)},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-border bg-card text-xs text-foreground hover:bg-muted transition-colors`,title:s(`setup:screen.share.twitter`),children:[(0,z.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,z.jsx)(`path`,{d:`M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z`})}),`X`]}),(0,z.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(e.referral.url),n=encodeURIComponent(`Check out ${e.name}! ${e.referral.reward}`);window.open(`https://www.linkedin.com/sharing/share-offsite/?url=${t}&summary=${n}`,`_blank`,`noopener,noreferrer`)},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-border bg-card text-xs text-foreground hover:bg-muted transition-colors`,title:s(`setup:screen.share.linkedin`),children:[(0,z.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,z.jsx)(`path`,{d:`M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z`})}),`LinkedIn`]}),(0,z.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(`Check out ${e.name}! 🎁 ${e.referral.reward} ${e.referral.url}`);window.open(`https://t.me/share/url?url=${t}`,`_blank`,`noopener,noreferrer`)},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-border bg-card text-xs text-foreground hover:bg-muted transition-colors`,title:s(`setup:screen.share.telegram`),children:[(0,z.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,z.jsx)(`path`,{d:`M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z`})}),`Telegram`]}),(0,z.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(`Check out ${e.name}! 🎁 ${e.referral.reward}`),n=encodeURIComponent(e.referral.url);window.open(`https://wa.me/?text=${t}%20${n}`,`_blank`,`noopener,noreferrer`)},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-border bg-card text-xs text-foreground hover:bg-muted transition-colors`,title:s(`setup:screen.share.whatsapp`),children:[(0,z.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,z.jsx)(`path`,{d:`M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.134 1.585 5.934L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413z`})}),`WhatsApp`]}),(0,z.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(e.referral.url),n=encodeURIComponent(`${e.name} - ${e.referral.reward}`);window.open(`https://www.reddit.com/submit?url=${t}&title=${n}`,`_blank`,`noopener,noreferrer`)},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-border bg-card text-xs text-foreground hover:bg-muted transition-colors`,title:s(`setup:screen.share.reddit`),children:[(0,z.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,z.jsx)(`path`,{d:`M12 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0zm5.01 4.744c.688 0 1.25.561 1.25 1.249a1.25 1.25 0 0 1-2.498.056l-2.597-.547-.8 3.747c1.824.07 3.48.632 4.674 1.488.308-.309.73-.491 1.207-.491.968 0 1.754.786 1.754 1.754 0 .716-.435 1.333-1.01 1.614a3.111 3.111 0 0 1 .042.52c0 2.694-3.13 4.87-7.004 4.87-3.874 0-7.004-2.176-7.004-4.87 0-.183.015-.366.043-.534A1.748 1.748 0 0 1 4.028 12c0-.968.786-1.754 1.754-1.754.463 0 .898.196 1.207.49 1.207-.883 2.878-1.43 4.744-1.487l.885-4.182a.342.342 0 0 1 .14-.197.35.35 0 0 1 .238-.042l2.906.617a1.214 1.214 0 0 0 1.108-.701 1.25 1.25 0 0 1 2.144.33zm-8.811 8.748c-.968 0-1.754.786-1.754 1.754 0 .968.786 1.754 1.754 1.754.968 0 1.754-.786 1.754-1.754 0-.968-.786-1.754-1.754-1.754zm7.944 0c-.968 0-1.754.786-1.754 1.754 0 .968.786 1.754 1.754 1.754.968 0 1.754-.786 1.754-1.754 0-.968-.786-1.754-1.754-1.754z`})}),`Reddit`]}),(0,z.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(`Check out ${e.name}! 🎁 ${e.referral.reward}`),n=encodeURIComponent(e.referral.url);window.open(`https://www.facebook.com/sharer/sharer.php?u=${n}&quote=${t}`,`_blank`,`noopener,noreferrer`)},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-border bg-card text-xs text-foreground hover:bg-muted transition-colors`,title:s(`setup:screen.share.facebook`),children:[(0,z.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,z.jsx)(`path`,{d:`M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z`})}),`Facebook`]}),(0,z.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(`Check out ${e.name}! 🎁 ${e.referral.reward}`),n=encodeURIComponent(e.referral.url);window.open(`mailto:?subject=${t}&body=${n}`,`_blank`,`noopener,noreferrer`)},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-muted text-muted-foreground text-xs hover:bg-muted/80 transition-colors`,title:s(`setup:screen.share.email`),children:[(0,z.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,viewBox:`0 0 24 24`,children:(0,z.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M21.75 6.75v10.5a2.25 2.25 0 01-2.25 2.25H4.5a2.25 2.25 0 01-2.25-2.25V6.75m19.5 0A2.25 2.25 0 0019.5 4.5h-15a2.25 2.25 0 00-2.25 2.25m19.5 0v.243a2.25 2.25 0 01-1.07 1.916l-7.5 4.615a2.25 2.25 0 01-2.36 0L3.32 8.91a2.25 2.25 0 01-1.07-1.916V6.75`})}),`Email`]})]}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(I,{value:e.referral.url,readOnly:!0,className:`font-mono text-xs flex-1`}),(0,z.jsx)(E,{size:`sm`,variant:`outline`,onClick:U,className:`shrink-0`,children:y?(0,z.jsx)(c,{className:`h-4 w-4`}):(0,z.jsx)(n,{className:`h-4 w-4`})})]}),(0,z.jsx)(`p`,{className:`text-[11px] text-muted-foreground text-center`,children:s(`setup:screen.share.hint`)})]})]})})]})})]})}function ne({onKeySaved:e}){let{t}=u(),[n,r]=(0,L.useState)(!1),[i,a]=(0,L.useState)(``),[s,c]=(0,L.useState)(`openai-compatible`),[l,d]=(0,L.useState)(``),[f,p]=(0,L.useState)(``),[m,h]=(0,L.useState)(!1);return(0,z.jsxs)(`div`,{className:`rounded-xl border border-dashed border-border/60 overflow-hidden`,children:[(0,z.jsxs)(`button`,{type:`button`,onClick:()=>r(!n),className:`w-full flex items-center gap-3 p-4 text-left hover:bg-muted/30 transition-colors`,children:[(0,z.jsx)(`div`,{className:`w-10 h-10 rounded-lg bg-muted/50 flex items-center justify-center`,children:(0,z.jsx)(v,{className:`h-5 w-5 text-muted-foreground`})}),(0,z.jsxs)(`div`,{className:`flex-1`,children:[(0,z.jsx)(`h3`,{className:`text-sm font-medium`,children:t(`setup:screen.custom.title`)}),(0,z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t(`setup:screen.custom.description`)})]}),(0,z.jsx)(o,{className:w(`h-4 w-4 text-muted-foreground transition-transform`,n&&`rotate-90`)})]}),n&&(0,z.jsxs)(`div`,{className:`px-4 pb-4 space-y-3 border-t border-border/40`,children:[(0,z.jsxs)(`div`,{className:`space-y-1.5 pt-3`,children:[(0,z.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground block`,children:t(`setup:screen.custom.localServers`)}),(0,z.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:F.map(e=>(0,z.jsx)(E,{type:`button`,size:`sm`,variant:i===e.id?`default`:`outline`,onClick:()=>{a(e.id),c(`openai-compatible`),d(e.defaultBaseUrl),e.noAuth&&p(``)},title:e.hint,children:e.label},e.id))})]}),(0,z.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground mb-1 block`,children:t(`setup:screen.custom.providerId`)}),(0,z.jsx)(I,{placeholder:`e.g. my-llm`,value:i,onChange:e=>a(e.target.value),className:`text-sm`})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground mb-1 block`,children:t(`setup:screen.custom.family`)}),(0,z.jsxs)(`select`,{value:s,onChange:e=>c(e.target.value),className:`flex h-9 w-full rounded-md border border-input bg-transparent px-3 text-sm`,children:[(0,z.jsx)(`option`,{value:`openai-compatible`,children:t(`setup:screen.custom.familyOpenAiCompatible`)}),(0,z.jsx)(`option`,{value:`openai`,children:`OpenAI`}),(0,z.jsx)(`option`,{value:`anthropic`,children:`Anthropic`}),(0,z.jsx)(`option`,{value:`google`,children:`Google`})]})]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground mb-1 block`,children:t(`setup:screen.custom.baseUrl`)}),(0,z.jsx)(I,{placeholder:`e.g. http://localhost:11434/v1`,value:l,onChange:e=>d(e.target.value),className:`text-sm font-mono`})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground mb-1 block`,children:t(`setup:screen.custom.apiKey`)}),(0,z.jsx)(I,{type:`password`,placeholder:t(`setup:screen.custom.apiKeyPlaceholder`),value:f,onChange:e=>p(e.target.value),className:`text-sm font-mono`})]}),(0,z.jsxs)(E,{onClick:async()=>{if(i.trim()){h(!0);try{let n=C(N.getState().wsUrl),o=B(n);n.send({type:`provider.add`,payload:{id:i.trim(),family:s,baseUrl:l.trim()||void 0,apiKey:f.trim()||void 0}});let c=await o;if(!c.success)throw Error(c.message);D.success(t(`setup:screen.toasts.providerAdded`,{id:i.trim()})),e(i.trim()),a(``),d(``),p(``),r(!1)}catch(e){let n=e instanceof Error&&e.message&&e.message!==`timeout`?e.message:null;D.error(n??t(`setup:screen.toasts.providerAddFailed`))}finally{h(!1)}}},disabled:!i.trim()||m,size:`sm`,children:[m?(0,z.jsx)(x,{className:`h-4 w-4 animate-spin mr-2`}):null,t(`setup:screen.custom.add`)]})]})]})}function re(){let{t:e}=u(),{model:t,setProvider:n,setModel:f,wsConnected:p,wsUrl:v}=N(m(e=>({model:e.model,setProvider:e.setProvider,setModel:e.setModel,wsConnected:e.wsConnected,wsUrl:e.wsUrl})));j();let[y,b]=(0,L.useState)(`keys`),[S,ee]=(0,L.useState)([]),[T,O]=(0,L.useState)({}),[k,A]=(0,L.useState)([]),[te,F]=(0,L.useState)(!1),[I,R]=(0,L.useState)(null),[B,re]=(0,L.useState)(0),[ie,ae]=(0,L.useState)(new Set),[oe,se]=(0,L.useState)(V),[W,G]=(0,L.useState)(!1),[ce,le]=(0,L.useState)(0),[ue,de]=(0,L.useState)(0),[K,fe]=(0,L.useState)(null),q=(0,L.useRef)(!0);(0,L.useEffect)(()=>{let e=new AbortController,t=`${window.location.origin}/providers.json`;return G(!0),H(t,e.signal).then(t=>{if(t!==V){if(se(t),G(!1),!q.current){let e=t.length-ue;e>0?D.success(i.t(`setup:screen.toasts.providersLoadedNew`,{count:t.length,diff:e})):e<0?D.success(i.t(`setup:screen.toasts.providersLoadedRemoved`,{count:t.length,diff:Math.abs(e)})):D.success(i.t(`setup:screen.toasts.providersLoadedNoChanges`,{count:t.length})),de(t.length)}fe(new Date);return}return H(`https://raw.githubusercontent.com/WrongStack/WrongStack/main/packages/webui/public/providers.json`,e.signal)}).then(e=>{if(e){if(se(e),!q.current){let t=e.length-ue;t>0?D.success(i.t(`setup:screen.toasts.providersLoadedNew`,{count:e.length,diff:t})):t<0?D.success(i.t(`setup:screen.toasts.providersLoadedRemoved`,{count:e.length,diff:Math.abs(t)})):D.success(i.t(`setup:screen.toasts.providersLoadedNoChanges`,{count:e.length})),de(e.length)}fe(new Date)}}).catch(()=>{q.current||D.error(i.t(`setup:screen.toasts.providersRefreshFailed`))}).finally(()=>{G(!1),q.current=!1}),()=>e.abort()},[ce]);let[J,Y]=(0,L.useState)(null),[X,Z]=(0,L.useState)(null),[pe,me]=(0,L.useState)(!1);(0,L.useEffect)(()=>{if(!p)return;let e=C(v),n=setTimeout(()=>{n=null,F(!1),R(i.t(`setup:screen.errors.backendNotResponding`))},8e3),r=()=>{n&&=(clearTimeout(n),null)},a=e.on(`provider.catalog`,e=>{e.type===`provider.catalog`&&(r(),R(null),ee(e.payload.providers.sort((e,t)=>e.id.localeCompare(t.id))),F(!1))}),o=e.on(`provider.models`,e=>{if(e.type===`provider.models`){let n=e.payload;O(e=>({...e,[n.provider]:n.models})),me(!1),n.models.length===1?Z(n.models[0].id):t&&n.models.some(e=>e.id===t)&&Z(t)}}),s=e.on(`providers.saved`,e=>{if(e.type===`providers.saved`){let t=e.payload.providers.sort((e,t)=>e.id.localeCompare(t.id));A(t),ae(new Set(t.filter(e=>e.apiKeys.some(e=>e.isActive)).map(e=>e.id)))}});return R(null),F(!0),e.listProviders(),()=>{r(),a?.(),o?.(),s?.()}},[p,v,t,B]);let he=(0,L.useCallback)(()=>{R(null),re(e=>e+1)},[]),ge=(0,L.useCallback)(()=>{le(e=>e+1)},[]),_e=(0,L.useCallback)(t=>{let n=new Date().getTime()-t.getTime(),r=Math.floor(n/1e3);if(r<10)return e(`setup:screen.time.justNow`);if(r<60)return e(`setup:screen.time.secondsAgo`,{count:r});let i=Math.floor(r/60);if(i<60)return e(`setup:screen.time.minutesAgo`,{count:i});let a=Math.floor(i/60);return a<24?e(`setup:screen.time.hoursAgo`,{count:a}):e(`setup:screen.time.daysAgo`,{count:Math.floor(a/24)})},[e]),Q=(0,L.useCallback)(e=>{ae(t=>new Set([...t,e]))},[]),$=ie.size>0,ve=(0,L.useCallback)(()=>{if(!$){if(k.length>0){let e=k[0];Y(e.id),b(`done`)}return}let e=k.find(e=>e.apiKeys.some(e=>e.isActive));e&&(Y(e.id),b(`done`))},[$,k]);(0,L.useEffect)(()=>{if(!J||!p||y!==`done`)return;let e=C(v);T[J]||(me(!0),e.listProviderModels(J))},[J,p,v,T,y]);let ye=J?T[J]??[]:[],be=(0,L.useCallback)(()=>{if(!J||!X)return;n(J),f(X);let e=C(v);e.switchModel(J,X);let t=null,r=()=>{t&&clearTimeout(t)},a=e.on(`key.operation_result`,t=>{let n=t.payload;r(),a(),n.success?(e.newSession(),M(`chat`)):D.error(n.message)});t=setTimeout(()=>{r(),a(),D.error(i.t(`setup:screen.errors.modelSwitchTimeout`))},5e3)},[J,X,n,f,v]),xe=new Set(oe.map(e=>e.id)),Se=S.filter(e=>!xe.has(e.id)).sort((e,t)=>e.id.localeCompare(t.id));return(0,z.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col`,children:[(0,z.jsxs)(`header`,{className:`flex shrink-0 flex-col gap-3 border-b bg-card px-4 py-4 sm:flex-row sm:items-center sm:justify-between sm:px-6`,children:[(0,z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,z.jsx)(`div`,{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-xl bg-gradient-to-br from-primary via-primary to-primary/60`,children:(0,z.jsx)(g,{className:`h-5 w-5 text-primary-foreground`})}),(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`h1`,{className:`truncate text-lg font-semibold`,children:e(`setup:screen.header.title`)}),(0,z.jsx)(`p`,{className:`text-xs text-muted-foreground sm:truncate`,children:e(`setup:screen.header.subtitle`)})]})]}),$&&(0,z.jsxs)(E,{onClick:ve,size:`sm`,className:`w-full sm:w-auto`,children:[e(`setup:screen.header.continue`),(0,z.jsx)(h,{className:`h-4 w-4 ml-1.5`})]})]}),(0,z.jsx)(P,{className:`min-h-0 flex-1`,children:y===`keys`?(0,z.jsxs)(`div`,{className:`mx-auto max-w-3xl space-y-8 p-4 sm:p-6`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-sm`,children:[(0,z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-primary font-medium`,children:[(0,z.jsx)(s,{className:`h-4 w-4`}),(0,z.jsx)(`span`,{children:e(`setup:screen.steps.addKeys`)})]}),(0,z.jsx)(o,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-muted-foreground`,children:[(0,z.jsx)(d,{className:`h-4 w-4`}),(0,z.jsx)(`span`,{children:e(`setup:screen.steps.pickModel`)})]}),(0,z.jsx)(o,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-muted-foreground`,children:[(0,z.jsx)(_,{className:`h-4 w-4`}),(0,z.jsx)(`span`,{children:e(`setup:screen.steps.start`)})]})]}),(0,z.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl border border-primary/20 bg-primary/5 p-4`,children:[(0,z.jsx)(r,{className:`h-5 w-5 text-primary shrink-0 mt-0.5`}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`p`,{className:`text-sm font-medium`,children:e(`setup:screen.security.title`)}),(0,z.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:e(`setup:screen.security.body`)})]})]}),I?(0,z.jsxs)(`div`,{className:`flex flex-col items-center text-center gap-4 py-12 rounded-xl border border-destructive/30 bg-destructive/5 px-6`,children:[(0,z.jsx)(`div`,{className:`w-12 h-12 rounded-xl bg-destructive/10 border border-destructive/30 flex items-center justify-center`,children:(0,z.jsx)(l,{className:`h-6 w-6 text-destructive`})}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`p`,{className:`text-sm font-medium text-destructive`,children:e(`setup:screen.errors.backendUnreachable`)}),(0,z.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1 max-w-sm`,children:I})]}),(0,z.jsxs)(E,{onClick:he,size:`sm`,variant:`outline`,children:[(0,z.jsx)(x,{className:`h-4 w-4 mr-2`}),e(`setup:screen.errors.retry`)]})]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{className:`space-y-3`,children:[(0,z.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between`,children:[(0,z.jsx)(`h2`,{className:`text-sm font-medium text-muted-foreground uppercase tracking-wider`,children:e(`setup:screen.providers.popular`)}),(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[W&&(0,z.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[11px] text-muted-foreground`,children:[(0,z.jsx)(x,{className:`h-3 w-3 animate-spin`}),e(`setup:screen.providers.updating`)]}),K&&!W&&(0,z.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,title:K.toLocaleString(),children:_e(K)}),(0,z.jsxs)(`button`,{type:`button`,onClick:ge,disabled:W,className:`inline-flex items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground transition-colors disabled:opacity-50 disabled:cursor-not-allowed`,title:e(`setup:screen.providers.refreshTitle`),children:[(0,z.jsx)(a,{className:w(`h-3 w-3`,W&&`animate-spin`)}),e(`setup:screen.providers.refresh`)]})]})]}),(0,z.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:oe.map(e=>(0,z.jsx)(U,{popular:e,catalogProvider:S.find(t=>t.id===e.id),savedProvider:k.find(t=>t.id===e.id),onKeySaved:Q},e.id))})]}),Se.length>0&&(0,z.jsxs)(`div`,{className:`space-y-3`,children:[(0,z.jsx)(`h2`,{className:`text-sm font-medium text-muted-foreground uppercase tracking-wider`,children:e(`setup:screen.providers.more`)}),(0,z.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:Se.map(t=>(0,z.jsx)(U,{popular:{id:t.id,name:t.name,description:e(`setup:screen.providers.catalogDescription`,{family:t.family,count:t.modelCount}),icon:`🔗`,color:`from-muted/60 to-muted/20 border-border hover:border-primary/40`,keyPlaceholder:`API key`,family:t.family},catalogProvider:t,savedProvider:k.find(e=>e.id===t.id),onKeySaved:Q},t.id))})]}),(0,z.jsxs)(`div`,{className:`space-y-3`,children:[(0,z.jsx)(`h2`,{className:`text-sm font-medium text-muted-foreground uppercase tracking-wider`,children:e(`setup:screen.providers.selfHosted`)}),(0,z.jsx)(ne,{onKeySaved:Q})]})]}),te&&(0,z.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,z.jsx)(x,{className:`h-6 w-6 animate-spin text-muted-foreground`})}),$&&(0,z.jsx)(`div`,{className:`sticky bottom-0 -mx-4 border-t bg-background/80 px-4 py-4 backdrop-blur-sm sm:-mx-6 sm:px-6`,children:(0,z.jsxs)(E,{onClick:ve,className:`w-full`,size:`lg`,children:[(0,z.jsx)(d,{className:`h-4 w-4 mr-2`}),e(`setup:screen.start.pickAndStart`),(0,z.jsx)(h,{className:`h-4 w-4 ml-2`})]})})]}):(0,z.jsxs)(`div`,{className:`mx-auto max-w-2xl space-y-8 p-4 sm:p-6`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-sm`,children:[(0,z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-success`,children:[(0,z.jsx)(c,{className:`h-4 w-4`}),(0,z.jsx)(`span`,{children:e(`setup:screen.steps.keys`)})]}),(0,z.jsx)(o,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-primary font-medium`,children:[(0,z.jsx)(d,{className:`h-4 w-4`}),(0,z.jsx)(`span`,{children:e(`setup:screen.steps.pickModel`)})]}),(0,z.jsx)(o,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-muted-foreground`,children:[(0,z.jsx)(_,{className:`h-4 w-4`}),(0,z.jsx)(`span`,{children:e(`setup:screen.steps.start`)})]})]}),(0,z.jsx)(`button`,{type:`button`,onClick:()=>b(`keys`),className:`text-xs text-muted-foreground hover:text-foreground transition-colors`,children:e(`setup:screen.start.addMoreKeys`)}),(0,z.jsxs)(`div`,{className:`space-y-3`,children:[(0,z.jsxs)(`h2`,{className:`text-base font-semibold flex items-center gap-2`,children:[(0,z.jsx)(d,{className:`h-4 w-4 text-primary`}),e(`setup:screen.start.chooseProvider`)]}),(0,z.jsx)(`div`,{className:`grid grid-cols-2 sm:grid-cols-3 gap-2`,children:k.map(t=>(0,z.jsxs)(`button`,{type:`button`,onClick:()=>{Y(t.id),Z(null)},className:w(`rounded-lg border p-3 text-left transition-all text-sm`,J===t.id?`border-primary bg-primary/10 ring-1 ring-primary/30`:`border-border hover:border-primary/40 hover:bg-primary/5`),children:[(0,z.jsx)(`span`,{className:`font-medium`,children:t.id}),(0,z.jsx)(`span`,{className:`block text-[11px] text-muted-foreground mt-0.5`,children:e(`setup:screen.start.activeKeys`,{count:t.apiKeys.filter(e=>e.isActive).length})})]},t.id))})]}),J&&(0,z.jsxs)(`div`,{className:`space-y-3`,children:[(0,z.jsxs)(`h2`,{className:`text-base font-semibold flex items-center gap-2`,children:[(0,z.jsx)(_,{className:`h-4 w-4 text-primary`}),e(`setup:screen.start.chooseModel`)]}),(0,z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`setup:screen.start.modelsFor`,{provider:J})}),pe?(0,z.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,z.jsx)(x,{className:`h-6 w-6 animate-spin text-muted-foreground`})}):ye.length>0?(0,z.jsx)(`div`,{className:`grid grid-cols-1 gap-2`,children:ye.map(e=>{let t=e.contextWindow?`${(e.contextWindow/1e6).toFixed(0)}M ctx`:null;return(0,z.jsx)(`button`,{type:`button`,onClick:()=>Z(e.id),className:w(`w-full text-left rounded-xl border p-3 transition-all`,`hover:border-primary/40 hover:bg-primary/5`,X===e.id?`border-primary bg-primary/10 ring-1 ring-primary/30`:`border-border bg-card`),children:(0,z.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,z.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,z.jsx)(`span`,{className:`font-medium text-sm`,children:e.name}),(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 mt-1`,children:[t&&(0,z.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-muted text-muted-foreground`,children:t}),e.capabilities.slice(0,3).map(e=>(0,z.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-primary/10 text-primary border border-primary/20`,children:e},e))]})]}),X===e.id&&(0,z.jsx)(`div`,{className:`flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-primary`,children:(0,z.jsx)(c,{className:`h-3 w-3 text-primary-foreground`})})]})},e.id)})}):(0,z.jsx)(`p`,{className:`text-sm text-muted-foreground py-8 text-center`,children:e(`setup:screen.errors.noModels`)})]}),J&&X&&(0,z.jsxs)(`div`,{className:`sticky bottom-0 -mx-4 border-t bg-background/80 px-4 py-4 backdrop-blur-sm sm:-mx-6 sm:px-6`,children:[(0,z.jsx)(`div`,{className:`mb-3 flex min-w-0 items-center justify-between gap-2 text-sm text-muted-foreground`,children:(0,z.jsxs)(`span`,{className:`min-w-0 truncate`,children:[J,` / `,X]})}),(0,z.jsxs)(E,{onClick:be,className:`w-full`,size:`lg`,children:[(0,z.jsx)(d,{className:`h-4 w-4 mr-2`}),e(`setup:screen.start.startSession`),(0,z.jsx)(h,{className:`h-4 w-4 ml-2`})]})]})]})})]})}export{re as SetupScreen};