@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 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{$n as t,Ar as n,At as r,Br as i,Cr as a,Dr as o,Gt as s,Hi as c,Ht as l,It as u,Jt as d,Kn as f,Kr as p,Kt as m,Lt as h,Ni as g,Qt as _,Ri as v,St as y,Ui as b,Ut as x,Vr as S,Yr as C,Yt as w,at as T,cn as ee,di as E,ea as te,hn as ne,ii as re,in as ie,li as D,mt as ae,pi as oe,rn as se,tt as ce,xr as le,xt as ue}from"./vendor-JNPeA-SL.js";import{t as de}from"./ws-client-3f38Kop2.js";import{t as O}from"./utils-BLVofF8S.js";import{t as fe}from"./session-store-CgCoJmdF.js";import{D as pe,Z as me,at as he,g as ge,l as _e,nt as ve}from"./index-MIiPbE0D.js";var k=e(te(),1);function A(e){let t=he(e=>e.wsUrl),n=he(e=>e.provider),r=he(e=>e.model),[i,a]=(0,k.useState)([]),[o,s]=(0,k.useState)([]),[c,l]=(0,k.useState)({}),[u,d]=(0,k.useState)(``),[f,p]=(0,k.useState)(``);return(0,k.useEffect)(()=>{let e=de(t).on(`kanban.meta`,e=>{let t=e.payload?.data;t&&(a(t.tools??[]),s(t.skills??[]),l(t.fallbackProfiles??{}),t.sessionProvider&&d(t.sessionProvider),t.sessionModel&&p(t.sessionModel))});return()=>e()},[t]),(0,k.useEffect)(()=>{e&&de(t).send({type:`kanban.meta`})},[e,t]),{tools:i,skills:o,fallbackProfiles:c,sessionProvider:u||n,sessionModel:f||r}}function ye(e,t=!0){(0,k.useEffect)(()=>{let n=e.current;if(!n||!t)return;let r=e=>{if(!e.shiftKey||n.scrollWidth<=n.clientWidth+1)return;let t=Math.abs(e.deltaY)>Math.abs(e.deltaX)?e.deltaY:e.deltaX;t!==0&&(e.preventDefault(),n.scrollLeft+=t)},i=e=>{if(!e.ctrlKey&&!e.metaKey||n.scrollWidth<=n.clientWidth+1)return;let t=n.clientWidth*.8;e.key===`ArrowLeft`?(e.preventDefault(),n.scrollLeft-=t):e.key===`ArrowRight`&&(e.preventDefault(),n.scrollLeft+=t)};return n.addEventListener(`wheel`,r,{passive:!1}),n.addEventListener(`keydown`,i),()=>{n.removeEventListener(`wheel`,r),n.removeEventListener(`keydown`,i)}},[e,t])}var be=4320*60*1e3,j=new Set([`completed`,`archived`]);function xe(e,t){let n=Ae(t.now);if(n===null)throw TypeError(`Kanban audit requires a valid current time`);let r=Oe(t.liveAgentIdentities),i=P(e,t.defaultReviewStaleAfterMs??be),a=we(e),o=[];for(let s of e.tasks)j.has(s.status)||(Se(o,s,t.requireDueDate===!0),M(o,s,n,r),N(o,s,n,i),a.length>1&&Ce(o,s,a));return o.sort(je),{issues:o,counts:{error:o.filter(e=>e.severity===`error`).length,warning:o.filter(e=>e.severity===`warning`).length},affectedTaskCount:new Set(o.map(e=>e.taskId)).size}}function Se(e,t,n){L(t.description)||B(e,t,`missing-description`,`warning`,`Add a description`),Ee(t).length===0&&B(e,t,`missing-assignee`,`warning`,`Assign an owner`),n&&!L(t.dueDate)&&B(e,t,`missing-due-date`,`warning`,`Set a due date`),!R(t.labels)&&!R(t.tags)&&B(e,t,`missing-labels`,`warning`,`Add labels or tags`),!R(t.childTaskIds)&&!R(t.subtasks)&&B(e,t,`missing-subtasks`,`warning`,`Define subtasks`),R(t.successCriteria)||B(e,t,`missing-success-criteria`,`warning`,`Add success criteria`)}function M(e,t,n,r){let i=t.assignment;if(!(t.status===`in_progress`||i?.status===`running`))return;let a=Ee(t);if(!i||a.length===0||!L(i.leaseId)||!L(i.leaseExpiresAt)){B(e,t,`abandoned-running-task`,`error`,`Running without a complete assignment lease`);return}let o=Ae(i.leaseExpiresAt);if(o===null||o<=n){B(e,t,`stale-running-task`,`error`,`Assignment lease is expired`);return}a.some(e=>r.has(I(e)))||B(e,t,`abandoned-running-task`,`error`,`Assigned agent is not live`)}function N(e,t,n,r){if(t.status!==`review`)return;let i=Te(t,`review`)??Ae(t.updatedAt);i===null||n-i<=r||B(e,t,`stale-review`,`warning`,`Waiting in review for ${Math.max(1,Math.floor((n-i)/(3600*1e3)))}h`)}function Ce(e,t,n){let r=F(t);if(r.length<2)return;let i=new Map(n.map((e,t)=>[I(e),t]));for(let n=1;n<r.length;n+=1){let a=r[n-1],o=r[n];if(!a||!o)continue;let s=i.get(I(a.state)),c=i.get(I(o.state));if(!(s===void 0||c===void 0||Math.abs(c-s)<=1)){B(e,t,`skipped-lifecycle-state`,`error`,`Lifecycle skipped ${a.state} → ${o.state}`);return}}}function we(e){let t=[e.lifecycle,e.lifecyclePolicy,e.managedLifecycle];for(let e of t){let t=De(e);if(t.length>1)return t;if(!e||typeof e!=`object`||Array.isArray(e))continue;let n=e;if(n.mode===`managed`&&n.columns){let e=[`backlog`,`todo`,`running`,`review`,`done`].map(e=>n.columns?.[e]).filter(e=>L(e));if(e.length===5)return e}for(let e of[n.states,n.statuses,n.order,n.managedStatuses]){let t=De(e);if(t.length>1)return t}}return[]}function P(e,t){let n=[e,e.lifecycle,e.lifecyclePolicy,e.managedLifecycle];for(let e of n){if(!e||typeof e!=`object`||Array.isArray(e))continue;let t=e;if(z(t.staleReviewAfterMs))return t.staleReviewAfterMs;if(z(t.reviewStaleAfterMs))return t.reviewStaleAfterMs;if(z(t.reviewStaleHours))return t.reviewStaleHours*60*60*1e3}return t}function F(e){let t=e.lifecycle?.history??e.lifecycleHistory??e.statusHistory??e.history;if(!Array.isArray(t))return[];let n=[];for(let e of t){if(typeof e==`string`&&L(e)){n.push({state:e.trim(),at:null});continue}if(!e||typeof e!=`object`)continue;let t=e,r=ke(t.status,t.state,t.toStatus,t.to,t.columnId);r&&n.push({state:r,at:Ae(t.at??t.ts??t.timestamp??t.changedAt??t.createdAt)})}return n}function Te(e,t){let n=null;for(let r of F(e))I(r.state)!==I(t)||r.at===null||(n=n===null?r.at:Math.max(n,r.at));return n}function Ee(e){let t=e.assignment;return[e.assignee,e.assignedAgent,t?.agentId,t?.subagentId,t?.name].filter(L)}function De(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(L(n)){t.push(n.trim());continue}if(!n||typeof n!=`object`)continue;let e=n,r=ke(e.id,e.status,e.state,e.name);r&&t.push(r)}return t}function Oe(e){let t=new Set;if(!e)return t;for(let n of e)L(n)&&t.add(I(n));return t}function I(e){return e.trim().toLocaleLowerCase()}function ke(...e){for(let t of e)if(L(t))return t.trim();return null}function L(e){return typeof e==`string`&&e.trim().length>0}function R(e){return Array.isArray(e)&&e.length>0}function z(e){return typeof e==`number`&&Number.isFinite(e)&&e>0}function Ae(e){if(e instanceof Date){let t=e.getTime();return Number.isFinite(t)?t:null}if(typeof e==`number`)return Number.isFinite(e)?e:null;if(typeof e!=`string`||!e.trim())return null;let t=Date.parse(e);return Number.isFinite(t)?t:null}function B(e,t,n,r,i){e.push({id:`${t.id}:${n}`,taskId:t.id,taskTitle:t.title,code:n,severity:r,message:i})}function je(e,t){let n=Me(e.severity)-Me(t.severity);if(n!==0)return n;let r=e.taskTitle.localeCompare(t.taskTitle);return r===0?e.message.localeCompare(t.message):r}function Me(e){return e===`error`?0:1}var Ne=[`id`,`name`,`type`];function V(e){if(typeof e==`string`)return e.trim()||void 0;if(typeof e==`number`||typeof e==`boolean`)return String(e);if(!e||typeof e!=`object`||Array.isArray(e))return;let t=e;for(let e of Ne){let n=t[e];if(typeof n==`string`&&n.trim())return n.trim()}}var H=ce();function U({options:e,selected:t,onChange:n,placeholder:r,emptyLabel:a}){let[o,s]=(0,k.useState)(!1),[c,l]=(0,k.useState)(``),u=(0,k.useRef)(null);(0,k.useEffect)(()=>{if(!o)return;let e=e=>{u.current&&!u.current.contains(e.target)&&s(!1)};return window.addEventListener(`mousedown`,e),()=>window.removeEventListener(`mousedown`,e)},[o]);let d=(0,k.useMemo)(()=>{let t=new Map(e.map(e=>[e.value,e.label]));return e=>t.get(e)??e},[e]),f=(0,k.useMemo)(()=>{let t=c.trim().toLowerCase();return(t?e.filter(e=>`${e.value} ${e.label} ${e.tag??``}`.toLowerCase().includes(t)):e).slice(0,80)},[e,c]),p=e=>{n(t.includes(e)?t.filter(t=>t!==e):[...t,e])};return(0,H.jsxs)(`div`,{ref:u,className:`relative`,children:[t.length>0&&(0,H.jsx)(`div`,{className:`mb-1 flex flex-wrap gap-1`,children:t.map(e=>(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded bg-muted px-1.5 py-0.5 text-[11px]`,children:[(0,H.jsx)(`span`,{className:`max-w-[150px] truncate`,children:d(e)}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>p(e),className:`text-muted-foreground hover:text-destructive`,"aria-label":`Remove ${d(e)}`,children:(0,H.jsx)(T,{size:11})})]},e))}),(0,H.jsxs)(`button`,{type:`button`,onClick:()=>s(e=>!e),className:`flex w-full items-center gap-1.5 rounded-md border border-border bg-muted px-2 py-1.5 text-left text-xs transition-colors hover:border-primary/45 hover:bg-muted/80`,children:[(0,H.jsx)(se,{className:`h-3.5 w-3.5 shrink-0 text-primary`}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-muted-foreground`,children:r??`Add…`}),(0,H.jsx)(i,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`})]}),o&&(0,H.jsxs)(`div`,{className:`absolute z-50 mt-1 max-h-72 w-full min-w-[240px] overflow-hidden rounded-md border border-border/80 bg-popover shadow-xl`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5 border-b border-border/70 bg-muted/20 px-2 py-1.5`,children:[(0,H.jsx)(`input`,{value:c,onChange:e=>l(e.target.value),placeholder:`Filter…`,className:`min-w-0 flex-1 bg-transparent text-xs outline-none placeholder:text-muted-foreground`}),c&&(0,H.jsx)(`button`,{type:`button`,onClick:()=>l(``),className:`text-muted-foreground hover:text-foreground`,children:(0,H.jsx)(T,{className:`h-3 w-3`})})]}),(0,H.jsxs)(`div`,{className:`max-h-60 overflow-y-auto py-1`,children:[f.map(e=>{let n=t.includes(e.value);return(0,H.jsxs)(`button`,{type:`button`,onClick:()=>p(e.value),className:O(`flex w-full items-start gap-1.5 px-2 py-1.5 text-left text-xs transition-colors hover:bg-muted`,n?`bg-primary/8 text-primary`:`text-foreground`),children:[n?(0,H.jsx)(S,{className:`mt-0.5 h-3 w-3 shrink-0 text-primary`}):(0,H.jsx)(`span`,{className:`w-3 shrink-0`}),(0,H.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`span`,{className:`block truncate`,children:e.label}),e.description&&(0,H.jsx)(`span`,{className:`mt-0.5 block truncate text-[10px] text-muted-foreground`,children:e.description})]}),e.tag&&(0,H.jsx)(`span`,{className:`mt-0.5 shrink-0 font-mono text-[9px] text-muted-foreground`,children:e.tag})]},e.value)}),f.length===0&&(0,H.jsx)(`div`,{className:`px-2 py-3 text-center text-[11px] text-muted-foreground`,children:e.length===0?a??`Nothing available`:`No match`})]})]})]})}function Pe({audit:e,onSelectTask:t}){let[n,r]=(0,k.useState)(!0),a=(0,k.useId)();if((0,k.useEffect)(()=>{e.issues.length>0&&r(!0)},[e.issues.length]),e.issues.length===0)return null;let o=Fe(e.issues);return(0,H.jsxs)(`section`,{"aria-labelledby":`${a}-title`,className:`shrink-0 border-b border-warning/25 bg-card/95 shadow-[inset_0_1px_0_hsl(var(--warning)/0.08)]`,children:[(0,H.jsxs)(`div`,{className:`flex min-h-10 flex-wrap items-center gap-2 px-3 py-2 sm:px-4`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2`,role:`status`,"aria-live":`polite`,children:[(0,H.jsx)(`span`,{className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-md border border-warning/25 bg-warning/10 text-warning`,children:(0,H.jsx)(oe,{size:14,"aria-hidden":`true`})}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsxs)(`h2`,{id:`${a}-title`,className:`text-xs font-semibold text-foreground`,children:[`Kanban Cleaner found `,e.issues.length,` `,e.issues.length===1?`issue`:`issues`]}),(0,H.jsxs)(`p`,{className:`truncate text-[10px] text-muted-foreground`,children:[e.affectedTaskCount,` `,e.affectedTaskCount===1?`card needs`:`cards need`,` attention`]})]})]}),e.counts.error>0&&(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full border border-destructive/25 bg-destructive/10 px-2 py-0.5 text-[10px] font-medium text-destructive`,children:[(0,H.jsx)(b,{size:11,"aria-hidden":`true`}),` `,e.counts.error,` critical`]}),e.counts.warning>0&&(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full border border-warning/25 bg-warning/10 px-2 py-0.5 text-[10px] font-medium text-warning`,children:[(0,H.jsx)(E,{size:11,"aria-hidden":`true`}),` `,e.counts.warning,` warning`]}),(0,H.jsx)(`button`,{type:`button`,"aria-expanded":n,"aria-controls":a,"aria-label":n?`Collapse Kanban Cleaner issues`:`Expand Kanban Cleaner issues`,onClick:()=>r(e=>!e),className:`flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary`,children:(0,H.jsx)(i,{size:14,"aria-hidden":`true`,className:O(`transition-transform`,n&&`rotate-180`)})})]}),n&&(0,H.jsx)(`ul`,{id:a,className:`grid max-h-36 gap-1 overflow-y-auto px-3 pb-2 sm:grid-cols-2 sm:px-4 xl:grid-cols-3`,children:o.map(({taskId:e,taskTitle:n,issues:r})=>(0,H.jsx)(`li`,{children:(0,H.jsxs)(`button`,{type:`button`,onClick:()=>t(e),"aria-label":`Open ${n}: ${r.map(e=>e.message).join(`, `)}`,className:`group flex w-full items-start gap-2 rounded-md border border-border/70 bg-background/70 px-2.5 py-2 text-left transition-colors hover:border-primary/40 hover:bg-primary/5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary`,children:[(0,H.jsx)(`span`,{className:O(`mt-1 h-1.5 w-1.5 shrink-0 rounded-full`,r.some(e=>e.severity===`error`)?`bg-destructive shadow-[0_0_8px_hsl(var(--destructive)/0.55)]`:`bg-warning shadow-[0_0_8px_hsl(var(--warning)/0.45)]`),"aria-hidden":`true`}),(0,H.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`span`,{className:`block truncate text-[11px] font-semibold text-foreground group-hover:text-primary`,children:n}),(0,H.jsx)(`span`,{className:`mt-0.5 block line-clamp-2 text-[10px] leading-4 text-muted-foreground`,children:r.map(e=>e.message).join(` · `)})]})]})},e))})]})}function Fe(e){let t=new Map;for(let n of e){let e=t.get(n.taskId);e?e.issues.push(n):t.set(n.taskId,{taskId:n.taskId,taskTitle:n.taskTitle,issues:[n]})}return[...t.values()]}function Ie(e,t,n,r=new Date().toISOString()){return{format:`wrongstack-kanban-task-activity`,version:1,exportedAt:r,scope:n,task:e,events:t}}function W(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function G(e){return typeof e==`string`&&e.trim()?e.trim():void 0}function K(e){return e.type.startsWith(`task.activity.`)?G(W(e.after).outcome)===`failed`?`failures`:e.type===`task.activity.attempt`?`execution`:`notes`:e.type.includes(`failed`)||e.type.includes(`cancelled`)?`failures`:e.type===`task.assigned`||e.type===`task.claimed`||e.type===`task.released`||e.type.startsWith(`task.assignment.`)||e.type===`task.stale_recovered`?`execution`:e.type.includes(`note`)||e.type.includes(`check`)||e.type.includes(`metric`)?`notes`:`changes`}function Le(e){let t=W(e.before),n=W(e.after);return[...new Set([...Object.keys(t),...Object.keys(n)])].filter(e=>JSON.stringify(t[e])!==JSON.stringify(n[e])).map(e=>({field:e,before:t[e],after:n[e]}))}function Re(e){if(e.type.startsWith(`task.activity.`))return`Recorded ${e.type.slice(14)}`.replace(/\b\w/g,e=>e.toUpperCase());switch(e.type){case`task.created`:return`Task created`;case`task.copied`:return`Task copied`;case`task.updated`:return`Task contract updated`;case`task.moved`:return`Task moved`;case`task.assigned`:return`Agent assigned`;case`task.claimed`:return`Task claimed`;case`task.released`:return`Assignment released`;case`task.assignment.updated`:return`Assignment updated`;case`task.assignment.running`:return`Agent started work`;case`task.assignment.completed`:return`Agent completed work`;case`task.assignment.failed`:return`Agent run failed`;case`task.assignment.cancelled`:return`Agent run cancelled`;case`task.assignment.heartbeat`:return`Agent heartbeat`;case`task.note.added`:return`Operator note added`;case`task.check.added`:return`Acceptance check added`;case`task.check.updated`:return`Acceptance check updated`;case`task.metric.added`:return`Goal metric added`;case`task.metric.updated`:return`Goal metric updated`;case`task.lifecycle.transition`:return`Lifecycle advanced`;case`task.assignment.snapshot`:return`Current assignment observed`;case`task.stale_recovered`:return`Stale assignment recovered`;case`task.reconciled`:return`Task state reconciled`;default:return e.type.replace(/^task\./,``).replaceAll(`.`,` `).replace(/\b\w/g,e=>e.toUpperCase())}}function ze(e){let t=W(e.before),n=W(e.after);if(e.type.startsWith(`task.activity.`))return[G(n.outcome),G(n.details)].filter(Boolean).join(` · `)||void 0;if(e.type===`task.moved`){let e=G(t.columnId),r=G(n.columnId);if(e||r)return`${e??`unknown`} → ${r??`unknown`}`}if(e.type===`task.updated`){let t=Le(e);if(t.length)return`${t.length} field${t.length===1?``:`s`} changed: ${t.map(e=>e.field).join(`, `)}`}if(e.type===`task.lifecycle.transition`){let e=G(t.stage),r=G(n.stage);if(r)return e?`${e} → ${r}`:`Entered ${r}`}if(e.type===`task.assigned`||e.type===`task.assignment.snapshot`){let e=G(n.name)??G(n.agentId)??G(n.role),t=G(n.provider),r=G(n.model);return[e,t||r?`${t?`${t}/`:``}${r??`default`}`:void 0].filter(Boolean).join(` · `)||void 0}if(e.type.startsWith(`task.check.`))return[G(n.description),G(n.status)].filter(Boolean).join(` · `)||void 0;if(e.type.startsWith(`task.metric.`))return[G(n.name),G(n.status)].filter(Boolean).join(` · `)||void 0}function Be(e){let t=e.type;return G(W(e.after).outcome)===`failed`||t.includes(`failed`)||t.includes(`cancelled`)?`bg-destructive ring-destructive/20`:t.includes(`completed`)||t.includes(`reconciled`)?`bg-success ring-success/20`:t.includes(`running`)||t.includes(`claimed`)||t.includes(`assigned`)?`bg-info ring-info/20`:t.includes(`note`)?`bg-warning ring-warning/20`:`bg-primary ring-primary/20`}function Ve(e){let t=Date.parse(e);return Number.isFinite(t)?new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`}).format(t):e}function He(e){if(e===void 0)return`unset`;if(e===null)return`none`;if(typeof e==`string`)return e||`empty`;if(typeof e==`number`||typeof e==`boolean`)return String(e);try{return JSON.stringify(e)}catch{return String(e)}}function Ue(e,t,n){let r=t.filter(t=>t.taskId===e.id).map(e=>({...e}));(e=>r.some(t=>t.type===e))(`task.created`)||r.push({id:`created:${e.id}`,boardId:``,taskId:e.id,type:`task.created`,ts:e.createdAt,...n?{sessionId:n}:{},after:{title:e.title,status:`created`,columnId:e.columnId}});for(let[t,i]of(e.lifecycle?.history??[]).entries())r.some(e=>e.type===`task.lifecycle.transition`&&e.ts===i.at&&e.actor===i.actor)||r.push({id:`lifecycle:${e.id}:${t}`,boardId:``,taskId:e.id,type:`task.lifecycle.transition`,ts:i.at,actor:i.actor,...n?{sessionId:n}:{},before:i.from?{stage:i.from}:void 0,after:{stage:i.to,action:i.action,attachment:i.attachment},note:i.comment});for(let t of e.notes??[])r.some(e=>e.type===`task.note.added`&&e.note===t.content&&Math.abs(Date.parse(e.ts)-Date.parse(t.createdAt))<2e3)||r.push({id:`note:${t.id}`,boardId:``,taskId:e.id,type:`task.note.added`,ts:t.createdAt,actor:t.author,...n?{sessionId:n}:{},note:t.content});let i=r.some(e=>e.type===`task.assigned`||e.type===`task.claimed`||e.type.startsWith(`task.assignment.`));return e.assignment&&!i&&r.push({id:`assignment:${e.id}`,boardId:``,taskId:e.id,type:`task.assignment.snapshot`,ts:e.assignment.completedAt??e.assignment.dispatchedAt??e.assignment.claimedAt??e.updatedAt,actor:e.assignment.agentId??e.assignment.name??e.assignment.role,...n?{sessionId:n}:{},subagentId:e.assignment.subagentId,runTaskId:e.assignment.runTaskId,after:{...e.assignment},note:e.assignment.error??e.assignment.lastResult}),r.sort((e,t)=>t.ts.localeCompare(e.ts))}function We({event:e}){let t=W(e.after),n=G(t.provider),r=G(t.model),i=G(t.modelRouting),a=G(t.fallbackProfile),o=Array.isArray(t.fallbackModels)?t.fallbackModels.filter(e=>typeof e==`string`):[],s=typeof t.attempt==`number`?t.attempt:void 0,c=typeof t.maxAttempts==`number`?t.maxAttempts:void 0,l=G(t.status);return!n&&!r&&!i&&!a&&!o.length&&s===void 0&&!l?null:(0,H.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap gap-1 font-mono text-[9px] text-muted-foreground`,children:[l&&(0,H.jsxs)(`span`,{className:`rounded border border-border/60 px-1.5 py-0.5`,children:[`status:`,l]}),i&&(0,H.jsxs)(`span`,{className:`rounded border border-border/60 px-1.5 py-0.5`,children:[`route:`,i]}),(n||r)&&(0,H.jsxs)(`span`,{className:`rounded border border-border/60 px-1.5 py-0.5`,children:[`model:`,n?`${n}/`:``,r??`default`]}),a&&(0,H.jsxs)(`span`,{className:`rounded border border-border/60 px-1.5 py-0.5`,children:[`profile:`,a]}),o.map((e,t)=>(0,H.jsxs)(`span`,{className:`rounded border border-border/60 px-1.5 py-0.5`,children:[`fallback-`,t+1,`:`,e]},`${e}:${t}`)),s!==void 0&&(0,H.jsxs)(`span`,{className:`rounded border border-border/60 px-1.5 py-0.5`,children:[`attempt:`,s,c?`/${c}`:``]})]})}function Ge({task:e,events:t,sessionId:n,loading:r=!1,error:i,onRefresh:a}){let[s,c]=(0,k.useState)(`all`),[l,u]=(0,k.useState)(``),[d,f]=(0,k.useState)(!1),[p,m]=(0,k.useState)(100),h=(0,k.useMemo)(()=>Ue(e,t,n),[e,t,n]),g=(0,k.useMemo)(()=>({all:h.length,execution:h.filter(e=>K(e)===`execution`).length,changes:h.filter(e=>K(e)===`changes`).length,notes:h.filter(e=>K(e)===`notes`).length,failures:h.filter(e=>K(e)===`failures`).length}),[h]),v=(0,k.useMemo)(()=>{let e=l.trim().toLowerCase();return h.filter(t=>s!==`all`&&K(t)!==s?!1:e?[Re(t),t.type,t.actor,t.sessionId,t.subagentId,t.runTaskId,t.note,JSON.stringify(t.before),JSON.stringify(t.after)].filter(Boolean).join(` `).toLowerCase().includes(e):!0)},[h,s,l]),y=v.slice(0,p),b=[...new Set(h.map(e=>e.actor).filter(Boolean))].length,C=[...new Set(h.map(e=>e.sessionId??n).filter(Boolean))].length;return(0,H.jsxs)(`section`,{"aria-label":`Task activity`,className:`mt-5`,children:[(0,H.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,H.jsx)(D,{className:`size-3.5 text-primary`}),(0,H.jsx)(`h3`,{className:`text-xs font-semibold uppercase text-muted-foreground`,children:`Activity ledger`}),(0,H.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-[10px] tabular-nums text-muted-foreground`,children:[v.length,`/`,h.length]}),(0,H.jsxs)(`div`,{className:`ml-auto flex items-center gap-0.5`,children:[(0,H.jsx)(`button`,{type:`button`,onClick:async()=>{try{await navigator.clipboard.writeText(JSON.stringify(Ie(e,v,`filtered`),null,2)),f(!0)}catch{f(!1)}},className:`flex size-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground`,"aria-label":`Copy visible task activity JSON`,title:`Copy filtered activity JSON`,children:d?(0,H.jsx)(S,{className:`size-3 text-success`}):(0,H.jsx)(o,{className:`size-3`})}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>{let t=JSON.stringify(Ie(e,h,`full`),null,2),n=URL.createObjectURL(new Blob([t],{type:`application/json`})),r=document.createElement(`a`);r.href=n,r.download=`${e.title.replace(/[^a-z0-9]+/gi,`-`).replace(/^-|-$/g,``).toLowerCase()||e.id}-activity.json`,r.click(),URL.revokeObjectURL(n)},className:`flex size-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground`,"aria-label":`Download full task activity JSON`,title:`Download full activity JSON`,children:(0,H.jsx)(le,{className:`size-3`})}),a&&(0,H.jsx)(`button`,{type:`button`,onClick:a,className:`flex size-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground`,"aria-label":`Refresh task activity`,children:(0,H.jsx)(_,{className:O(`size-3`,r&&`animate-spin`)})})]})]}),(0,H.jsx)(`div`,{className:`mb-2 grid grid-cols-4 gap-px overflow-hidden rounded-md border border-border/60 bg-border/60 text-center`,children:[[`Events`,h.length],[`Actors`,b],[`Sessions`,C],[`Failures`,g.failures]].map(([e,t])=>(0,H.jsxs)(`div`,{className:`bg-background/90 px-1 py-1.5`,children:[(0,H.jsx)(`div`,{className:`text-xs font-semibold tabular-nums`,children:t}),(0,H.jsx)(`div`,{className:`text-[8px] uppercase text-muted-foreground`,children:e})]},String(e)))}),(0,H.jsx)(`div`,{className:`mb-2 flex flex-wrap gap-1`,children:[`all`,`execution`,`changes`,`notes`,`failures`].map(e=>(0,H.jsxs)(`button`,{type:`button`,onClick:()=>c(e),className:O(`rounded border px-1.5 py-1 text-[9px] capitalize`,s===e?`border-primary/50 bg-primary/10 text-primary`:`border-border text-muted-foreground hover:text-foreground`),children:[e,` `,g[e]]},e))}),(0,H.jsxs)(`div`,{className:`relative mb-3`,children:[(0,H.jsx)(x,{className:`pointer-events-none absolute left-2 top-1/2 size-3 -translate-y-1/2 text-muted-foreground`}),(0,H.jsx)(`input`,{value:l,onChange:e=>u(e.target.value),"aria-label":`Search task activity`,placeholder:`Search agent, session, model, result, field…`,className:`h-8 w-full rounded-md border bg-background pl-7 pr-7 text-[11px] outline-none focus:border-primary`}),l&&(0,H.jsx)(`button`,{type:`button`,onClick:()=>u(``),"aria-label":`Clear task activity search`,className:`absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,children:(0,H.jsx)(T,{className:`size-3`})})]}),i&&(0,H.jsx)(`div`,{className:`mb-2 rounded-md border border-destructive/30 bg-destructive/5 px-2.5 py-2 text-[11px] text-destructive`,children:i}),v.length===0?(0,H.jsx)(`div`,{className:`rounded-md border border-dashed px-3 py-6 text-center text-[11px] text-muted-foreground`,children:`No activity matches this filter.`}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`ol`,{className:`relative ml-1.5 space-y-0 border-l border-border/70`,children:y.map(e=>{let t=ze(e),r=e.sessionId??n,i=Le(e),a=K(e)===`failures`,o=e.type.includes(`completed`)||G(W(e.after).outcome)===`succeeded`;return(0,H.jsxs)(`li`,{className:`relative pb-4 pl-4 last:pb-0`,children:[(0,H.jsx)(`span`,{className:O(`absolute -left-[5px] top-1.5 size-2 rounded-full ring-4`,Be(e))}),(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`p`,{className:`text-xs font-medium leading-5`,children:Re(e)}),(0,H.jsx)(`code`,{className:`block truncate text-[8px] text-muted-foreground/70`,title:e.type,children:e.type})]}),(0,H.jsx)(`time`,{dateTime:e.ts,title:new Date(e.ts).toLocaleString(),className:`shrink-0 text-[9px] text-muted-foreground`,children:Ve(e.ts)})]}),t&&(0,H.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap text-[11px] leading-4 text-muted-foreground`,children:t}),e.note&&(0,H.jsxs)(`div`,{className:O(`mt-1.5 max-h-32 overflow-y-auto whitespace-pre-wrap rounded border px-2 py-1.5 text-[10px] leading-4`,a?`border-destructive/30 bg-destructive/5 text-destructive`:o?`border-success/30 bg-success/5 text-success`:`border-border/70 bg-muted/35 text-foreground`),children:[(0,H.jsxs)(`strong`,{children:[a?`Error`:o?`Result`:`Reason / result`,`:`]}),` `,e.note]}),i.length>0&&e.type!==`task.assigned`&&e.type!==`task.assignment.snapshot`&&(0,H.jsx)(`div`,{className:`mt-1.5 space-y-1 rounded border border-border/60 bg-background/50 p-1.5`,children:i.map(e=>(0,H.jsxs)(`div`,{className:`grid grid-cols-[5rem_minmax(0,1fr)] gap-1.5 text-[9px] leading-4`,children:[(0,H.jsx)(`code`,{className:`truncate text-primary`,title:e.field,children:e.field}),(0,H.jsxs)(`span`,{className:`min-w-0 break-all text-muted-foreground`,children:[(0,H.jsx)(`span`,{className:`line-through opacity-70`,children:He(e.before)}),` `,(0,H.jsx)(`span`,{"aria-hidden":!0,children:`→`}),` `,(0,H.jsx)(`span`,{className:`text-foreground`,children:He(e.after)})]})]},e.field))}),(0,H.jsx)(We,{event:e}),(e.actor||r||e.subagentId||e.runTaskId||e.correlationId)&&(0,H.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap gap-1 font-mono text-[9px] text-muted-foreground`,children:[e.actor&&(0,H.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5`,children:[`agent:`,e.actor]}),r&&(0,H.jsxs)(`span`,{className:`max-w-52 truncate rounded bg-muted px-1.5 py-0.5`,title:r,children:[`session:`,r]}),e.subagentId&&(0,H.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5`,children:[`subagent:`,e.subagentId]}),e.runTaskId&&(0,H.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5`,children:[`run:`,e.runTaskId]}),e.correlationId&&(0,H.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5`,children:[`trace:`,e.correlationId]})]}),(0,H.jsxs)(`details`,{className:`mt-1.5 text-[9px] text-muted-foreground`,children:[(0,H.jsx)(`summary`,{className:`cursor-pointer hover:text-foreground`,children:`Full event payload`}),(0,H.jsx)(`pre`,{className:`mt-1 max-h-64 overflow-auto rounded border bg-muted/30 p-2 text-[9px] leading-4 text-foreground`,children:JSON.stringify(e,null,2)})]})]},e.id)})}),y.length<v.length&&(0,H.jsxs)(`button`,{type:`button`,onClick:()=>m(e=>e+100),className:`mt-3 h-8 w-full rounded-md border text-[10px] text-muted-foreground hover:bg-muted hover:text-foreground`,children:[`Show 100 more (`,v.length-y.length,` remaining)`]})]})]})}function Ke(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function q(e){return typeof e==`string`&&e.trim()?e.trim():void 0}function qe(e){return e.type===`task.assigned`||e.type===`task.claimed`||e.type===`task.released`||e.type===`task.assignment.snapshot`||e.type===`task.stale_recovered`||e.type.startsWith(`task.assignment.`)}function Je(e,t){return q(t.status)||(e.type===`task.claimed`?`claimed`:e.type===`task.released`?`released`:e.type===`task.stale_recovered`?`recovered`:e.type.split(`.`).at(-1)??`unknown`)}function J(e){return[`completed`,`failed`,`cancelled`,`released`,`recovered`].includes(e)}function Ye(e,t){if(!t)return;let n=Date.parse(e),r=Date.parse(t);return Number.isFinite(n)&&Number.isFinite(r)?Math.max(0,r-n):void 0}function Xe(e,t,n){let r=Ue(e,t,n).filter(qe).sort((e,t)=>e.ts.localeCompare(t.ts)),i=new Map,a=0,o=0,s=!1;for(let e of r){let t=Ke(e.after),r=Number(t.attempt),c=e.type===`task.assigned`||e.type===`task.claimed`;Number.isFinite(r)&&r>0?a=Math.trunc(r):c&&(a===0||s)?a=o+1:a===0&&(a=1),o=Math.max(o,a);let l=Je(e,t),u=i.get(a)??{attempt:a,status:l,startedAt:e.ts,fallbackModels:[],sessionIds:new Set,eventCount:0};u.status=l,u.eventCount+=1,(e.sessionId??n)&&u.sessionIds.add(e.sessionId??n),u.owner=q(t.name)??q(t.agentId)??q(t.role)??e.actor??u.owner,u.provider=q(t.provider)??u.provider,u.model=q(t.model)??u.model,u.routingMode=q(t.modelRouting)??u.routingMode,u.fallbackProfile=q(t.fallbackProfile)??u.fallbackProfile,Array.isArray(t.fallbackModels)&&(u.fallbackModels=t.fallbackModels.filter(e=>typeof e==`string`)),u.subagentId=e.subagentId??q(t.subagentId)??u.subagentId,u.runTaskId=e.runTaskId??q(t.runTaskId)??u.runTaskId,l===`running`&&!u.runningAt&&(u.runningAt=e.ts),l===`completed`&&(u.result=q(t.lastResult)??e.note??u.result),(l===`failed`||l===`cancelled`)&&(u.error=q(t.error)??e.note??u.error),J(l)&&(u.endedAt=e.ts),i.set(a,u),s=J(l)}return[...i.values()].map(e=>({...e,sessionIds:[...e.sessionIds],durationMs:Ye(e.startedAt,e.endedAt)})).sort((e,t)=>t.attempt-e.attempt)}function Ze(e){if(e===void 0)return`running`;if(e<1e3)return`${e}ms`;let t=Math.round(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}function Qe(e){return e===`completed`?`bg-success/10 text-success`:e===`failed`||e===`cancelled`?`bg-destructive/10 text-destructive`:e===`running`?`bg-info/10 text-info`:`bg-muted text-muted-foreground`}function $e({task:e,events:t,sessionId:n}){let r=Xe(e,t,n);return r.length?(0,H.jsxs)(`details`,{open:!0,className:`mt-3 rounded-md border border-border/70 bg-muted/15`,children:[(0,H.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 px-3 py-2.5 [&::-webkit-details-marker]:hidden`,children:[(0,H.jsx)(f,{className:`size-4 text-primary`}),(0,H.jsx)(`span`,{className:`text-xs font-semibold`,children:`Execution attempts`}),(0,H.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-[9px] text-muted-foreground`,children:[r.length,` total`]}),(0,H.jsxs)(`span`,{className:`rounded px-1.5 py-0.5 text-[9px] ${Qe(r[0].status)}`,children:[`latest:`,r[0].status]}),(0,H.jsx)(i,{className:`ml-auto size-3.5 text-muted-foreground`})]}),(0,H.jsx)(`div`,{className:`space-y-2 border-t border-border/60 p-2.5`,children:r.map(e=>(0,H.jsxs)(`section`,{className:`rounded-md border bg-background/70 p-2.5`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 text-[10px]`,children:[(0,H.jsxs)(`strong`,{className:`text-xs`,children:[`Attempt #`,e.attempt]}),(0,H.jsx)(`span`,{className:`rounded px-1.5 py-0.5 ${Qe(e.status)}`,children:e.status}),(0,H.jsxs)(`span`,{className:`ml-auto inline-flex items-center gap-1 text-muted-foreground`,children:[(0,H.jsx)(y,{className:`size-3`}),` `,Ze(e.durationMs),` · `,e.eventCount,` `,`events`]})]}),(0,H.jsxs)(`div`,{className:`mt-2 grid gap-1 text-[10px] text-muted-foreground sm:grid-cols-2`,children:[(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,H.jsx)(C,{className:`size-3`}),` `,e.owner??`Unknown agent`]}),(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1 font-mono`,children:[(0,H.jsx)(m,{className:`size-3`}),e.provider||e.model?`${e.provider?`${e.provider}/`:``}${e.model??`default`}`:e.routingMode??`default route`]}),(0,H.jsxs)(`span`,{className:`font-mono`,children:[`session:`,e.sessionIds.join(`, `)||`unknown`]}),(0,H.jsxs)(`span`,{className:`font-mono`,children:[`subagent:`,e.subagentId??`—`,` · run:`,e.runTaskId??`—`]})]}),(e.fallbackProfile||e.fallbackModels.length>0)&&(0,H.jsxs)(`p`,{className:`mt-1.5 break-all font-mono text-[9px] text-muted-foreground`,children:[`fallback:`,[e.fallbackProfile?`profile:${e.fallbackProfile}`:``,...e.fallbackModels].filter(Boolean).join(` → `)]}),e.error&&(0,H.jsxs)(`p`,{className:`mt-2 whitespace-pre-wrap rounded border border-destructive/30 bg-destructive/5 px-2 py-1.5 text-[10px] text-destructive`,children:[(0,H.jsx)(`strong`,{children:`Error:`}),` `,e.error]}),e.result&&(0,H.jsxs)(`p`,{className:`mt-2 max-h-32 overflow-y-auto whitespace-pre-wrap rounded border border-success/30 bg-success/5 px-2 py-1.5 text-[10px] text-success`,children:[(0,H.jsx)(`strong`,{children:`Result:`}),` `,e.result]})]},e.attempt))})]}):null}function et(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function Y(e){return V(e)}function tt(e,t){return(t??[]).map(t=>{let n=e.tasks.find(e=>e.id===t);return{id:t,title:n?.title??t,status:n?.status??`missing`}})}function nt(e,t,n,r,i,a,o){let s=Ue(t,n,r),c=tt(e,t.dependsOn),l=c.filter(e=>![`completed`,`archived`].includes(e.status)),u=t.assignment,d=(o??e.presence??[]).filter(e=>e.taskId===t.id),f=et(s.find(e=>e.type===`task.assigned`||e.type===`task.claimed`||e.type.startsWith(`task.assignment.`))?.after),p=Y(u?.modelRouting)??Y(f.modelRouting)??`session`,m=Y(u?.provider)??Y(f.provider)??(p===`session`?Y(i):void 0),h=Y(u?.model)??Y(f.model)??(p===`session`?Y(a):void 0),g=(Array.isArray(u?.fallbackModels)?u.fallbackModels:Array.isArray(f.fallbackModels)?f.fallbackModels:[]).map(Y).filter(e=>e!==void 0),_=Y(u?.fallbackProfile)??Y(f.fallbackProfile),v=Y(u?.name)??Y(u?.agentId)??Y(u?.role)??Y(t.assignee)??Y(t.assignedAgent)??`Unassigned`,y=t.lifecycle?.history.at(-1),b=s.find(e=>e.note&&e.type!==`task.note.added`)?.note,x=`Placed in ${e.columns.find(e=>e.id===t.columnId)?.title??t.columnId}.`;u?.error?x=`Agent run failed: ${u.error}`:l.length?x=`Blocked by ${l.map(e=>e.title).join(`, `)}.`:y?.comment?x=y.comment:b?x=b:t.status===`review`?x=`Implementation is waiting for review evidence or approval.`:t.status===`in_progress`?x=`${v} is currently working on this task.`:t.status===`completed`&&(x=`The task and its current assignment are complete.`);let S=s.map(e=>Number(et(e.after).attempt)).filter(e=>Number.isFinite(e)),C=s.filter(e=>e.type===`task.claimed`||e.type===`task.assigned`).length,w=s.find(e=>K(e)===`failures`),T=s.find(e=>e.type.includes(`completed`));return{column:e.columns.find(e=>e.id===t.columnId)?.title??t.columnId,reason:x,owner:v,routingMode:p,provider:m,model:h,primaryModel:m||h?`${m?`${m}/`:``}${h??`default`}`:`Session default`,fallbackRoute:[_?`profile:${_}`:``,...g].filter(Boolean).join(` → `)||`None configured`,blockers:l,dependencies:c,actors:[...new Set([...s.map(e=>e.actor).filter(e=>!!e),...d.map(e=>e.agentId)])],sessions:[...new Set([...s.map(e=>e.sessionId??r),...d.map(e=>e.sessionId)].filter(e=>!!e))],presence:d.map(e=>`${e.agentName??e.agentId} · ${e.active?`active`:`last seen ${X(e.lastSeenAt)}`}`),activePresence:d.filter(e=>e.active).length,attempts:Math.max(u?.attempt??0,...S,C),failures:s.filter(e=>e.type.includes(`failed`)).length,completions:s.filter(e=>e.type.includes(`completed`)).length,lastFailure:u?.lastFailureKind??u?.error??w?.note,lastResult:u?.lastResult??T?.note,eventCount:s.length,lastActivity:s[0]}}function X(e){if(!e)return`—`;let t=Date.parse(e);return Number.isFinite(t)?new Date(t).toLocaleString():e}function rt(e,t){if(!e)return`—`;let n=Date.parse(e),r=t?Date.parse(t):Date.now();if(!Number.isFinite(n)||!Number.isFinite(r))return`—`;let i=Math.max(0,Math.round((r-n)/6e4));return i<1?`<1m`:i<60?`${i}m`:`${Math.floor(i/60)}h ${i%60}m`}function Z({label:e,value:t,mono:n=!1}){return(0,H.jsxs)(`div`,{className:`grid grid-cols-[7rem_minmax(0,1fr)] gap-2 py-1 text-[11px]`,children:[(0,H.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,H.jsx)(`dd`,{className:n?`break-all font-mono text-[10px]`:`min-w-0 break-words`,children:t})]})}function it({icon:e,title:t,children:n}){return(0,H.jsxs)(`section`,{className:`rounded-md border border-border/70 bg-background/55 p-2.5`,children:[(0,H.jsxs)(`h4`,{className:`mb-1.5 flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:[e,t]}),(0,H.jsx)(`dl`,{className:`divide-y divide-border/35`,children:n})]})}function at({items:e}){return e.length?(0,H.jsx)(`span`,{className:`space-y-1`,children:e.map(e=>(0,H.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,H.jsx)(`span`,{className:`truncate`,title:e.title,children:e.title}),(0,H.jsx)(`span`,{className:`shrink-0 rounded bg-muted px-1 py-0.5 text-[9px]`,children:e.status})]},e.id))}):(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`None`})}function ot({board:e,task:n,events:r,presence:a,sessionId:o,sessionProvider:s,sessionModel:c}){let l=nt(e,n,r,o,s,c,a),d=n.assignment,f=n.successCriteria?.length??0,h=n.successCriteria?.filter(e=>e.status===`passed`).length??0,g=[n.parentTaskId,...n.childTaskIds??[],n.chain?.previousTaskId,n.chain?.nextTaskId,n.mergedIntoTaskId,...n.mergedFromTaskIds??[]].filter(e=>!!e),_=tt(e,[...new Set(g)]);return(0,H.jsxs)(`details`,{open:!0,className:`mt-3 rounded-md border border-primary/25 bg-primary/[0.025]`,children:[(0,H.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 px-3 py-2.5 [&::-webkit-details-marker]:hidden`,children:[(0,H.jsx)(p,{className:`size-4 text-primary`}),(0,H.jsx)(`span`,{className:`text-xs font-semibold`,children:`Task intelligence`}),(0,H.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-[9px] uppercase text-muted-foreground`,children:n.status}),(0,H.jsxs)(`span`,{className:`ml-auto text-[10px] text-muted-foreground`,children:[l.eventCount,` events`]}),(0,H.jsx)(i,{className:`size-3.5 text-muted-foreground`})]}),(0,H.jsxs)(`div`,{className:`space-y-2.5 border-t border-border/60 p-2.5`,children:[(0,H.jsxs)(`section`,{className:`rounded-md border border-info/25 bg-info/5 p-2.5`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 text-[10px]`,children:[(0,H.jsx)(`span`,{className:`rounded bg-info/10 px-1.5 py-0.5 font-semibold text-info`,children:l.column}),(0,H.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5`,children:[`stage:`,n.lifecycle?.currentStage??`legacy`]}),(0,H.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5`,children:[`priority:`,n.priority]}),(0,H.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5`,children:[`type:`,n.type??`inferred`]})]}),(0,H.jsxs)(`p`,{className:`mt-2 text-[11px] leading-4`,children:[(0,H.jsx)(`strong`,{children:`Why here:`}),` `,l.reason]}),l.blockers.length>0&&(0,H.jsxs)(`p`,{className:`mt-1 text-[10px] text-warning`,children:[l.blockers.length,` unresolved blocker`,l.blockers.length===1?``:`s`]})]}),(0,H.jsxs)(`div`,{className:`grid gap-2 xl:grid-cols-2`,children:[(0,H.jsxs)(it,{icon:(0,H.jsx)(C,{className:`size-3`}),title:`Ownership & runtime`,children:[(0,H.jsx)(Z,{label:`Owner`,value:l.owner}),(0,H.jsx)(Z,{label:`Assignee`,value:Y(n.assignee)??Y(n.assignedAgent)??`—`}),(0,H.jsx)(Z,{label:`Agent ID`,value:Y(d?.agentId)??`—`,mono:!0}),(0,H.jsx)(Z,{label:`Agent name / role`,value:[Y(d?.name),Y(d?.role)].filter(Boolean).join(` · `)||`—`}),(0,H.jsx)(Z,{label:`Run status`,value:Y(d?.status)??`unassigned`}),(0,H.jsx)(Z,{label:`Subagent`,value:Y(d?.subagentId)??`—`,mono:!0}),(0,H.jsx)(Z,{label:`Run task`,value:Y(d?.runTaskId)??`—`,mono:!0}),(0,H.jsx)(Z,{label:`Session(s)`,value:l.sessions.join(`, `)||`Unknown`,mono:!0}),(0,H.jsx)(Z,{label:`Users / presence`,value:l.presence.length?l.presence.join(`, `):`No task-scoped presence recorded`})]}),(0,H.jsxs)(it,{icon:(0,H.jsx)(m,{className:`size-3`}),title:`Model route & fallback`,children:[(0,H.jsx)(Z,{label:`Routing mode`,value:l.routingMode}),(0,H.jsx)(Z,{label:`Primary`,value:l.primaryModel,mono:!0}),(0,H.jsx)(Z,{label:`Provider`,value:l.provider??`—`,mono:!0}),(0,H.jsx)(Z,{label:`Model`,value:l.model??`—`,mono:!0}),(0,H.jsx)(Z,{label:`Fallback route`,value:l.fallbackRoute,mono:!0}),(0,H.jsx)(Z,{label:`Skills`,value:d?.skills?.map(Y).filter(Boolean).join(`, `)||`Default`}),(0,H.jsx)(Z,{label:`Tools`,value:d?.tools?.map(Y).filter(Boolean).join(`, `)||`Default toolset`}),(0,H.jsx)(Z,{label:`Capabilities`,value:d?.allowedCapabilities?.map(Y).filter(Boolean).join(`, `)||`Safe defaults`,mono:!0})]}),(0,H.jsxs)(it,{icon:(0,H.jsx)(u,{className:`size-3`}),title:`Execution policy & outcome`,children:[(0,H.jsx)(Z,{label:`Attempts`,value:`${l.attempts}${d?.maxAttempts?` / ${d.maxAttempts}`:``}`}),(0,H.jsx)(Z,{label:`Retry policy`,value:d?.retryPolicy??n.retryPolicy??`off`}),(0,H.jsx)(Z,{label:`Cost ceiling`,value:(d?.costCeilingUsd??n.costCeilingUsd)==null?`Unbounded`:`$${(d?.costCeilingUsd??n.costCeilingUsd).toFixed(2)}`}),(0,H.jsx)(Z,{label:`Failures / done`,value:`${l.failures} / ${l.completions}`}),(0,H.jsx)(Z,{label:`Checks`,value:`${h} / ${f} passed`}),(0,H.jsx)(Z,{label:`Last failure`,value:l.lastFailure??`—`}),(0,H.jsx)(Z,{label:`Result`,value:l.lastResult??`No result recorded`})]}),(0,H.jsxs)(it,{icon:(0,H.jsx)(D,{className:`size-3`}),title:`Timing & audit coverage`,children:[(0,H.jsx)(Z,{label:`Created`,value:X(n.createdAt)}),(0,H.jsx)(Z,{label:`Updated`,value:X(n.updatedAt)}),(0,H.jsx)(Z,{label:`Due`,value:X(n.dueDate)}),(0,H.jsx)(Z,{label:`Dispatched`,value:X(d?.dispatchedAt??d?.claimedAt)}),(0,H.jsx)(Z,{label:`Completed`,value:X(d?.completedAt??n.completedAt)}),(0,H.jsx)(Z,{label:`Duration`,value:rt(d?.dispatchedAt??d?.claimedAt,d?.completedAt)}),(0,H.jsx)(Z,{label:`Heartbeat`,value:X(d?.heartbeatAt)}),(0,H.jsx)(Z,{label:`Lease expires`,value:X(d?.leaseExpiresAt)}),(0,H.jsx)(Z,{label:`Actors`,value:l.actors.join(`, `)||`Unknown`,mono:!0})]})]}),(0,H.jsxs)(it,{icon:(0,H.jsx)(t,{className:`size-3`}),title:`Dependencies, chain & provenance`,children:[(0,H.jsx)(Z,{label:`Dependencies`,value:(0,H.jsx)(at,{items:l.dependencies})}),(0,H.jsx)(Z,{label:`Other relations`,value:(0,H.jsx)(at,{items:_})}),(0,H.jsx)(Z,{label:`Chain`,value:n.chain?`${n.chain.chainId} · position ${n.chain.order}`:`None`,mono:!0}),(0,H.jsx)(Z,{label:`Origin system`,value:n.origin?.system??`manual`}),(0,H.jsx)(Z,{label:`Origin IDs`,value:n.origin&&[n.origin.graphId,n.origin.phaseId,n.origin.taskId,n.origin.specId].filter(Boolean).join(` · `)||`—`,mono:!0}),(0,H.jsx)(Z,{label:`Task ID`,value:n.id,mono:!0}),(0,H.jsx)(Z,{label:`Board ID`,value:e.id,mono:!0})]})]})]})}function st(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function ct(e){return e===`completed`||e===`failed`||e===`cancelled`}function lt(e,t){return t?Math.round(e/t*100):0}function ut(e,t,n,r=new Date){let i=[],a=n.filter(e=>e.taskId===t.id),o=a.filter(e=>e.type!==`task.created`),s=o.filter(e=>e.type!==`task.assignment.heartbeat`&&e.type!==`task.assignment.snapshot`),c=s.filter(e=>!!e.note?.trim()),l=t.assignment,u=r.getTime(),d=100,f=(e,t=0)=>{i.some(t=>t.id===e.id)||(i.push(e),d=Math.max(0,d-t))};t.dueDate&&![`completed`,`archived`].includes(t.status)&&Date.parse(t.dueDate)<u&&f({id:`overdue`,severity:`critical`,category:`operational`,title:`Task is overdue`,detail:`Due date ${t.dueDate} has passed while status is ${t.status}.`,remediation:`Re-plan the due date or record the blocker and owner response.`});let p=(t.dependsOn??[]).filter(t=>!e.tasks.some(e=>e.id===t));p.length&&f({id:`missing-dependency`,severity:`critical`,category:`operational`,title:`Dependency references are broken`,detail:`${p.length} dependency task${p.length===1?``:`s`} cannot be found.`,remediation:`Repair or remove the missing dependency IDs before dispatch.`});let m=(t.dependsOn??[]).filter(t=>{let n=e.tasks.find(e=>e.id===t);return n&&![`completed`,`archived`].includes(n.status)});m.length&&f({id:`unresolved-dependency`,severity:`warning`,category:`operational`,title:`Dependencies are unresolved`,detail:`${m.length} dependency task${m.length===1?``:`s`} still block execution.`,remediation:`Complete dependencies or explicitly waive them with a decision event.`}),(l?.status===`failed`||l?.error)&&f({id:`assignment-failed`,severity:`critical`,category:`operational`,title:`Latest agent run failed`,detail:l.error??l.lastFailureKind??`Assignment status is failed.`,remediation:`Review the failed attempt evidence, adjust routing, then retry or block the task.`}),l?.status===`failed`&&l.maxAttempts!==void 0&&(l.attempt??0)>=l.maxAttempts&&f({id:`retry-exhausted`,severity:`critical`,category:`operational`,title:`Retry budget is exhausted`,detail:`${l.attempt??0}/${l.maxAttempts} attempts have been consumed.`,remediation:`Escalate for a new route or explicitly increase the attempt budget.`}),l&&[`queued`,`running`].includes(l.status)&&l.leaseExpiresAt&&Date.parse(l.leaseExpiresAt)<=u&&f({id:`lease-expired`,severity:`critical`,category:`operational`,title:`Assignment lease has expired`,detail:`Lease expired at ${l.leaseExpiresAt} while run status is ${l.status}.`,remediation:`Recover, release, or retry the stale assignment.`}),l?.status===`running`&&l.heartbeatAt&&u-Date.parse(l.heartbeatAt)>5*6e4&&f({id:`heartbeat-stale`,severity:`warning`,category:`operational`,title:`Agent heartbeat is stale`,detail:`No heartbeat has been recorded since ${l.heartbeatAt}.`,remediation:`Inspect the subagent/run and recover the assignment if it is no longer alive.`}),t.status===`in_progress`&&!l&&f({id:`unowned-in-progress`,severity:`warning`,category:`operational`,title:`In-progress task has no assignment`,detail:`The task claims active work but has no inspectable agent assignment.`,remediation:`Assign an agent or return the task to ready/blocked.`});let h=(t.successCriteria??[]).filter(e=>e.status===`failed`),g=(t.successCriteria??[]).filter(e=>e.status===`pending`);h.length&&f({id:`failed-checks`,severity:t.status===`completed`?`critical`:`warning`,category:`operational`,title:`Acceptance checks failed`,detail:`${h.length} completion check${h.length===1?``:`s`} failed.`,remediation:`Resolve or explicitly waive failed acceptance evidence.`}),t.status===`completed`&&g.length&&f({id:`completed-with-pending-checks`,severity:`critical`,category:`operational`,title:`Completed task still has pending checks`,detail:`${g.length} acceptance check${g.length===1?``:`s`} remain pending.`,remediation:`Move the task back to review or complete the missing checks.`}),a.length?a.some(e=>e.type===`task.created`)||f({id:`missing-creation-event`,severity:`warning`,category:`audit`,title:`Creation provenance is missing`,detail:`The loaded event range does not contain task.created.`,remediation:`Load deeper history or record the legacy origin explicitly.`},10):f({id:`no-durable-events`,severity:`critical`,category:`audit`,title:`No durable activity events loaded`,detail:`Current state cannot be traced to an append-only task event.`,remediation:`Refresh activity; migrate legacy state or record an observation event.`},25);let _=lt(o.filter(e=>!!e.actor).length,o.length),v=lt(o.filter(e=>!!e.sessionId).length,o.length),y=lt(c.length,s.length);o.length&&_<100&&f({id:`actor-coverage`,severity:`warning`,category:`audit`,title:`Some mutations have no actor`,detail:`Actor coverage is ${_}%.`,remediation:`Ensure every route/tool mutation supplies agent or operator identity.`},10),o.length&&v<100&&f({id:`session-coverage`,severity:`warning`,category:`audit`,title:`Some mutations have no session`,detail:`Session coverage is ${v}%.`,remediation:`Propagate session identity into all task event contexts.`},10),s.length&&y<50&&f({id:`reason-coverage`,severity:`info`,category:`audit`,title:`Decision rationale is sparse`,detail:`Only ${y}% of mutations include a reason or outcome.`,remediation:`Use the change-reason and decision/outcome fields for meaningful mutations.`},10);let b={...st([...a].sort((e,t)=>t.ts.localeCompare(e.ts)).find(e=>e.type===`task.assigned`||e.type.startsWith(`task.assignment.`))?.after),...l??{}},x=!!(b.provider||b.model||b.modelRouting);l&&!x&&f({id:`missing-route`,severity:`warning`,category:`audit`,title:`Execution route is not inspectable`,detail:`Assignment has no routing mode, provider, or model.`,remediation:`Reassign with explicit session/fixed/fallback routing metadata.`},10);let S=!!(l?.lastResult||l?.error||a.some(e=>ct(String(st(e.after).status??``))&&!!e.note?.trim()));return ct(l?.status)&&!S&&f({id:`missing-terminal-evidence`,severity:`critical`,category:`audit`,title:`Terminal run has no result or error evidence`,detail:`Assignment ended as ${l?.status} without an inspectable output.`,remediation:`Record the final result/error and supporting evidence.`},15),i.sort((e,t)=>{let n={critical:0,warning:1,info:2};return n[e.severity]-n[t.severity]}),{score:d,findings:i,critical:i.filter(e=>e.severity===`critical`).length,warnings:i.filter(e=>e.severity===`warning`).length,coverage:{durableEvents:a.length,actorPercent:_,sessionPercent:v,reasonPercent:y,hasExecutionRoute:x,hasTerminalEvidence:S}}}function dt(e){return e===`critical`?`border-destructive/30 bg-destructive/5 text-destructive`:e===`warning`?`border-warning/30 bg-warning/5 text-warning`:`border-info/30 bg-info/5 text-info`}function ft({board:e,task:t,events:n}){let r=ut(e,t,n);return(0,H.jsxs)(`details`,{open:!0,className:`mt-3 rounded-md border border-border/70 bg-muted/10`,children:[(0,H.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 px-3 py-2.5 [&::-webkit-details-marker]:hidden`,children:[(0,H.jsx)(h,{className:`size-4 text-primary`}),(0,H.jsx)(`span`,{className:`text-xs font-semibold`,children:`Risk & audit quality`}),(0,H.jsxs)(`span`,{className:`rounded px-1.5 py-0.5 text-[9px] ${r.score>=90?`bg-success/10 text-success`:r.score>=70?`bg-warning/10 text-warning`:`bg-destructive/10 text-destructive`}`,children:[`audit `,r.score,`/100`]}),r.critical>0&&(0,H.jsxs)(`span`,{className:`rounded bg-destructive/10 px-1.5 py-0.5 text-[9px] text-destructive`,children:[r.critical,` critical`]}),(0,H.jsx)(i,{className:`ml-auto size-3.5 text-muted-foreground`})]}),(0,H.jsxs)(`div`,{className:`space-y-2 border-t border-border/60 p-2.5`,children:[(0,H.jsx)(`div`,{className:`grid grid-cols-3 gap-1 text-center sm:grid-cols-6`,children:[[`Events`,r.coverage.durableEvents],[`Actor`,`${r.coverage.actorPercent}%`],[`Session`,`${r.coverage.sessionPercent}%`],[`Reasons`,`${r.coverage.reasonPercent}%`],[`Route`,r.coverage.hasExecutionRoute?`yes`:`no`],[`Outcome`,r.coverage.hasTerminalEvidence?`yes`:`no`]].map(([e,t])=>(0,H.jsxs)(`div`,{className:`rounded border bg-background/70 px-1 py-1.5`,children:[(0,H.jsx)(`div`,{className:`text-[11px] font-semibold`,children:t}),(0,H.jsx)(`div`,{className:`text-[8px] uppercase text-muted-foreground`,children:e})]},String(e)))}),r.findings.length===0?(0,H.jsxs)(`div`,{className:`flex items-center gap-2 rounded border border-success/30 bg-success/5 px-2.5 py-2 text-[11px] text-success`,children:[(0,H.jsx)(c,{className:`size-4`}),` No deterministic task risks detected.`]}):(0,H.jsx)(`div`,{className:`space-y-1.5`,children:r.findings.map(e=>(0,H.jsxs)(`section`,{className:`rounded border px-2.5 py-2 ${dt(e.severity)}`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] font-semibold`,children:[e.category===`audit`?(0,H.jsx)(a,{className:`size-3.5`}):(0,H.jsx)(E,{className:`size-3.5`}),e.title,(0,H.jsxs)(`span`,{className:`ml-auto text-[8px] uppercase opacity-75`,children:[e.category,` · `,e.severity]})]}),(0,H.jsx)(`p`,{className:`mt-1 text-[10px] leading-4 opacity-90`,children:e.detail}),(0,H.jsxs)(`p`,{className:`mt-1 text-[9px] leading-4 opacity-75`,children:[(0,H.jsx)(`strong`,{children:`Next:`}),` `,e.remediation]})]},e.id))})]})]})}var pt=5e3;function mt(e){let t=Math.max(0,Date.now()-Date.parse(e));return t<6e4?`just now`:t<36e5?`${Math.floor(t/6e4)}m ago`:`${Math.floor(t/36e5)}h ago`}function ht({presence:e=[]}){return e.length===0?null:(0,H.jsxs)(`section`,{"aria-label":`Board presence`,className:`flex shrink-0 flex-wrap items-center gap-2 border-b border-border bg-card/50 px-4 py-2`,children:[(0,H.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wider text-muted-foreground`,children:`Live board users`}),e.map(e=>(0,H.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1.5 rounded-full border border-border bg-background px-2.5 py-1 text-xs shadow-sm`,title:`Session ${e.sessionId} · last seen ${e.lastSeenAt}`,children:[(0,H.jsx)(`span`,{"aria-label":e.active?`active`:`inactive`,className:O(`h-2 w-2 shrink-0 rounded-full`,e.active?`bg-success`:`bg-muted-foreground/50`)}),(0,H.jsx)(v,{size:13,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`max-w-32 truncate font-medium`,children:e.agentName??e.agentId}),(0,H.jsx)(`span`,{className:`max-w-32 truncate text-muted-foreground`,children:e.sessionId}),(0,H.jsx)(n,{size:12,className:`text-muted-foreground`,"aria-hidden":`true`}),(0,H.jsx)(`time`,{dateTime:e.lastSeenAt,className:`tabular-nums text-muted-foreground`,children:mt(e.lastSeenAt)})]},e.id))]})}function gt({board:e,snapshot:t,sendKanban:n}){let[r,a]=(0,k.useState)(!1),[o,c]=(0,k.useState)(!0),[l,d]=(0,k.useState)(`deterministic`),[f,p]=(0,k.useState)(`session`),[m,h]=(0,k.useState)(``),[g,_]=(0,k.useState)(``),[v,y]=(0,k.useState)(``),[b,x]=(0,k.useState)([]),[S,C]=(0,k.useState)([]),[w,T]=(0,k.useState)(10),ee=pe(r&&l===`agentic`),E=A(r&&l===`agentic`);(0,k.useEffect)(()=>{let t=e.supervisor;c(t?.enabled??!0),d(t?.mode??`deterministic`),p(t?.routing?.mode??`session`),h(t?.routing?.provider??``),_(t?.routing?.model??``),y(t?.routing?.fallbackProfile??``),x(t?.routing?.fallbackModels??[]),C(t?.skills??[]),T(Math.max(2,Math.round((t?.intervalMs??1e4)/1e3)))},[e.id,e.supervisor]);let te=()=>{let t={mode:f,...f===`fixed`&&m?{provider:m}:{},...f===`fixed`&&g?{model:g}:{},...f===`fallback_profile`&&v?{fallbackProfile:v}:{},...b.length?{fallbackModels:b}:{}};n(`kanban.update`,{boardId:e.id,supervisor:{enabled:o,mode:l,intervalMs:Math.max(2,w)*1e3,recoveryMode:`auto`,...l===`agentic`?{routing:t,skills:S}:{}}}),window.setTimeout(()=>n(`kanban.supervisor.audit`,{boardId:e.id}),150)},ne=o?t?.status??`starting`:`disabled`;return(0,H.jsxs)(`div`,{className:`shrink-0 border-b bg-background/80`,children:[(0,H.jsxs)(`button`,{type:`button`,onClick:()=>a(e=>!e),className:`flex w-full items-center gap-2 px-4 py-1.5 text-left text-[11px] hover:bg-muted/40`,children:[(0,H.jsx)(u,{size:13,className:ne===`healthy`?`text-success`:`text-warning`}),(0,H.jsx)(`span`,{className:`font-semibold`,children:`Kanban Agent`}),(0,H.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 capitalize text-muted-foreground`,children:[l,` · `,ne]}),t?.summary&&(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-muted-foreground`,children:t.summary}),(0,H.jsx)(`span`,{className:`ml-auto text-muted-foreground`,children:t?.lastAuditAt?`checked ${kt(t.lastAuditAt)} ago`:`not checked`}),(0,H.jsx)(i,{size:13,className:O(`transition-transform`,r&&`rotate-180`)})]}),r&&(0,H.jsxs)(`div`,{className:`grid gap-3 border-t p-3 text-xs lg:grid-cols-[220px_220px_1fr_auto]`,children:[(0,H.jsxs)(`label`,{className:`flex items-center gap-2 rounded-md border bg-card px-2 py-2`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:o,onChange:e=>c(e.target.checked)}),(0,H.jsx)(`span`,{children:`Watch this board`})]}),(0,H.jsx)($,{label:`Supervisor engine`,value:l,options:[`deterministic`,`agentic`],onChange:e=>d(e)}),(0,H.jsxs)(`label`,{className:`block`,children:[(0,H.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:`Audit interval (seconds)`}),(0,H.jsx)(`input`,{type:`number`,min:2,value:w,onChange:e=>T(Number(e.target.value)||2),className:`h-8 w-full rounded-md border bg-background px-2 outline-none focus:border-primary`})]}),(0,H.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,H.jsxs)(`button`,{type:`button`,onClick:te,className:`inline-flex h-8 items-center gap-1 rounded-md bg-primary px-3 text-primary-foreground`,children:[(0,H.jsx)(s,{size:13}),` Save`]}),(0,H.jsxs)(`button`,{type:`button`,onClick:()=>n(`kanban.supervisor.audit`,{boardId:e.id}),className:`inline-flex h-8 items-center gap-1 rounded-md border px-3 hover:bg-muted`,children:[(0,H.jsx)(D,{size:13}),` Audit now`]})]}),l===`deterministic`?(0,H.jsx)(`div`,{className:`lg:col-span-4 rounded-md border border-success/20 bg-success/5 px-3 py-2 text-muted-foreground`,children:`Deterministic mode uses no provider, model, token, or billing. It repairs assignment/status/column drift and recovers expired leases.`}):(0,H.jsxs)(`div`,{className:`grid gap-3 lg:col-span-4 lg:grid-cols-2`,children:[(0,H.jsx)($,{label:`Kanban Agent model source`,value:f,options:[`session`,`fixed`,`fallback_profile`],onChange:e=>p(e)}),f===`fixed`&&(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:`Fixed provider / model`}),(0,H.jsx)(_e,{value:g||void 0,provider:m||void 0,candidates:ee,placeholder:`Select exact provider / model…`,onPick:(e,t)=>{_(e),h(t)}})]}),f===`fallback_profile`&&(0,H.jsx)($,{label:`Fallback profile (first model is primary)`,value:v,options:Object.keys(E.fallbackProfiles),placeholder:`Select configured profile…`,onChange:y}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:`Supervisor skills`}),(0,H.jsx)(U,{options:E.skills.map(e=>({value:e.name,label:e.name,description:e.description,tag:e.source})),selected:S,onChange:C,placeholder:`Force-load agentic skills…`})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:`Extra fallback models`}),(0,H.jsx)(U,{options:ee.map(e=>({value:`${e.provider}/${e.model}`,label:e.label,tag:e.provider})),selected:b,onChange:x,placeholder:`Optional ordered fallbacks…`})]})]})]})]})}function _t(e){let t=e?.tags??[],n=t.includes(`sdd`)?`sdd`:t.includes(`goal`)?`goal`:null;if(!n)return null;let r=t.find(e=>e.startsWith(`run:`))?.slice(4);return{engine:n,...r?{runId:r}:{}}}function vt({onClose:e}){let t=he(e=>e.wsUrl),n=fe(e=>e.session?.id??null),r=ve(e=>e.agents),{boards:i,activeBoardId:a,activeBoard:s,loading:c,error:l,queueHealth:u,supervisorSnapshot:d,setLoading:f,setActiveBoardId:p}=me(),[m,h]=(0,k.useState)(``),[v,y]=(0,k.useState)(``),b=(0,k.useRef)(null);ye(b);let[x,S]=(0,k.useState)(``),[C,w]=(0,k.useState)(null),[ee,E]=(0,k.useState)([]),[te,ne]=(0,k.useState)(),[ie,D]=(0,k.useState)(!1),[ae,oe]=(0,k.useState)(null),[ce,le]=(0,k.useState)(0),[pe,ge]=(0,k.useState)(null),_e=(0,k.useRef)(null),A=(0,k.useMemo)(()=>de(t),[t]),be=s?.tasks.find(e=>e.id===C)??null,j=(0,k.useMemo)(()=>{let e=new Set;for(let t of r.values())t.status===`running`&&(e.add(t.id),e.add(t.name));return e},[r]),Se=(0,k.useMemo)(()=>s?xe(s,{now:Date.now(),liveAgentIdentities:j,requireDueDate:s.lifecycle?.mode===`managed`}):null,[s,j]),M=(0,k.useMemo)(()=>s?s.tasks.filter(e=>e.status===`in_progress`||e.assignment?.status===`running`||e.assignment?.status===`queued`).reduce((e,t)=>e+(t.costCeilingUsd??0),0):0,[s]),N=(e,t={})=>{f(!0),A.send({type:e,payload:t})},Ce=(e,t={})=>{A.send({type:e,payload:t})},we=(0,k.useMemo)(()=>_t(s),[s]),P=()=>N(`kanban.list`),F=(e=a)=>{e&&N(`kanban.get`,{boardId:e})};(0,k.useEffect)(()=>{P()},[]),(0,k.useEffect)(()=>{let e=n?i.find(e=>e.tags?.includes(`session:${n}`)):void 0,t=!!(n&&e)&&_e.current!==n,r=t?e:a?void 0:i[0];r?.id&&(t&&(_e.current=n),p(r.id),N(`kanban.get`,{boardId:r.id}))},[i,a,n,p]),(0,k.useEffect)(()=>{s&&C&&!s.tasks.some(e=>e.id===C)&&w(null)},[s,C]),(0,k.useEffect)(()=>{a&&(N(`kanban.health`,{boardId:a}),N(`kanban.supervisor.status`,{boardId:a}))},[a]),(0,k.useEffect)(()=>{if(!a)return;let e=setInterval(()=>{A.send({type:`kanban.get`,payload:{boardId:a}}),A.send({type:`kanban.health`,payload:{boardId:a}})},5e3);return()=>clearInterval(e)},[a,A]),(0,k.useEffect)(()=>{let e=setInterval(()=>{A.send({type:`kanban.list`})},8e3);return()=>clearInterval(e)},[A]),(0,k.useEffect)(()=>{ne(void 0)},[a,C]),(0,k.useEffect)(()=>{if(!a||!C)return;let e=a,t=C;D(!0),oe(null);let n=A.on(`kanban.task.activity`,n=>{let r=n.payload;if(r.success===!1){oe(r.error??`Task activity could not be loaded.`),D(!1);return}r.data?.boardId!==e||r.data.taskId!==t||(E(r.data.events??[]),ne(r.data.presence??[]),D(!1))});return A.send({type:`kanban.task.activity`,payload:{boardId:e,taskId:t,limit:pt}}),n},[a,C,be?.updatedAt,ce,A]);let Te=()=>{let e=m.trim();e&&(h(``),N(`kanban.create`,{title:e,lifecycle:{mode:`managed`,columns:{backlog:`backlog`,todo:`todo`,running:`in-progress`,review:`review`,done:`done`}}}))},Ee=()=>{if(!s)return;let e=v.trim();e&&(y(``),N(`kanban.task.add`,{boardId:s.id,title:e,columnId:s.columns[0]?.id??`backlog`,activityNote:`Task created manually in WebUI.`}),window.setTimeout(()=>F(s.id),150))},De=()=>{if(!s)return;let e=x.trim();e&&(S(``),N(`kanban.column.add`,{boardId:s.id,title:e}),window.setTimeout(()=>F(s.id),150))},Oe=()=>{s&&(N(`kanban.delete`,{boardId:s.id}),window.setTimeout(P,150))},I=()=>{s&&(N(`kanban.duplicate`,{boardId:s.id,title:`${s.title} Copy`}),window.setTimeout(P,150))},ke=e=>{s&&(N(`kanban.task.remove`,{boardId:s.id,taskId:e.id}),window.setTimeout(()=>F(s.id),150))},L=(e,t)=>{if(!s)return;let n=s.tasks.find(t=>t.id===e),r=s.columns.find(e=>e.id===n?.columnId)?.title,i=s.columns.find(e=>e.id===t)?.title??t;N(`kanban.task.move`,{boardId:s.id,taskId:e,columnId:t,activityNote:`Moved in WebUI${r?` from ${r}`:``} to ${i}.`}),window.setTimeout(()=>F(s.id),150)};return(0,H.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col bg-background text-foreground md:flex-row`,children:[(0,H.jsxs)(`aside`,{className:`flex max-h-[45dvh] w-full shrink-0 flex-col border-b bg-card/40 md:max-h-none md:w-[280px] md:border-b-0 md:border-r`,children:[(0,H.jsxs)(`div`,{className:`flex h-12 items-center gap-2 border-b px-3`,children:[(0,H.jsx)(`button`,{type:`button`,title:`Back`,onClick:e,className:`flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,H.jsx)(re,{size:16})}),(0,H.jsx)(g,{size:17,className:`text-primary`}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`div`,{className:`truncate text-sm font-semibold`,children:`Kanban`}),(0,H.jsxs)(`div`,{className:`truncate text-[11px] text-muted-foreground`,children:[i.length,` boards`]})]}),(0,H.jsx)(`button`,{type:`button`,title:`Refresh`,onClick:P,className:`flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,H.jsx)(_,{size:15,className:c?`animate-spin`:void 0})})]}),(0,H.jsxs)(`div`,{className:`flex gap-1 border-b p-2`,children:[(0,H.jsx)(`input`,{value:m,onChange:e=>h(e.target.value),onKeyDown:e=>{e.key===`Enter`&&Te()},placeholder:`New board`,className:`min-w-0 flex-1 rounded-md border bg-background px-2 py-1.5 text-sm outline-none focus:border-primary`}),(0,H.jsx)(`button`,{type:`button`,title:`Create board`,onClick:Te,className:`flex h-8 w-8 items-center justify-center rounded-md bg-primary text-primary-foreground hover:bg-primary/90`,children:(0,H.jsx)(se,{size:16})})]}),(0,H.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain p-2`,children:i.map(e=>(0,H.jsxs)(`button`,{type:`button`,onClick:()=>{p(e.id),N(`kanban.get`,{boardId:e.id})},className:O(`mb-1 w-full rounded-md px-2 py-2 text-left transition-colors`,a===e.id?`bg-primary/10 text-foreground`:`text-muted-foreground hover:bg-muted hover:text-foreground`),children:[(0,H.jsx)(`div`,{className:`truncate text-sm font-medium`,children:e.title}),(0,H.jsxs)(`div`,{className:`mt-0.5 flex items-center justify-between text-[11px]`,children:[(0,H.jsxs)(`span`,{children:[e.taskCount,` tasks`]}),(0,H.jsxs)(`span`,{children:[e.completedTaskCount,` done`]})]})]},e.id))})]}),(0,H.jsxs)(`main`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,H.jsxs)(`header`,{className:`flex min-h-12 shrink-0 flex-wrap items-center gap-2 border-b px-3 py-2 sm:px-4`,children:[(0,H.jsxs)(`div`,{className:`w-full min-w-0 sm:w-auto sm:flex-1`,children:[(0,H.jsx)(`div`,{className:`truncate text-sm font-semibold`,children:s?.title??`No board selected`}),(0,H.jsx)(`div`,{className:`truncate text-[11px] text-muted-foreground`,children:s?`${s.columns.length} columns / ${s.tasks.length} tasks`:`Create or select a board`})]}),s&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`input`,{value:v,onChange:e=>y(e.target.value),onKeyDown:e=>{e.key===`Enter`&&Ee()},placeholder:`New task`,className:`h-8 w-[calc(100%-2.5rem)] min-w-0 flex-none rounded-md border bg-background px-2 text-sm outline-none focus:border-primary sm:w-56`}),(0,H.jsx)(`button`,{type:`button`,title:`Add task`,onClick:Ee,className:`flex h-8 w-8 items-center justify-center rounded-md bg-primary text-primary-foreground hover:bg-primary/90`,children:(0,H.jsx)(se,{size:16})}),(0,H.jsx)(`input`,{value:x,onChange:e=>S(e.target.value),onKeyDown:e=>{e.key===`Enter`&&De()},placeholder:`New column`,className:`h-8 w-[calc(100%-2.5rem)] min-w-0 flex-none rounded-md border bg-background px-2 text-sm outline-none focus:border-primary sm:w-44`}),(0,H.jsx)(`button`,{type:`button`,title:`Add column`,onClick:De,className:`hidden h-8 w-8 items-center justify-center rounded-md border text-muted-foreground hover:bg-muted hover:text-foreground sm:flex`,children:(0,H.jsx)(g,{size:16})}),(0,H.jsx)(`button`,{type:`button`,title:`Duplicate board`,onClick:I,className:`flex h-8 w-8 items-center justify-center rounded-md border text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,H.jsx)(o,{size:16})}),(0,H.jsx)(`button`,{type:`button`,title:`Delete board`,onClick:Oe,className:`hidden h-8 w-8 items-center justify-center rounded-md border text-muted-foreground hover:bg-destructive/10 hover:text-destructive sm:flex`,children:(0,H.jsx)(ue,{size:16})})]})]}),s&&(0,H.jsx)(ht,{presence:s.presence}),s&&we&&(0,H.jsx)(yt,{runLink:we,sendRaw:Ce}),s&&!we&&s.tasks.length>0&&(0,H.jsx)(bt,{boardId:s.id,sendKanban:N}),s&&(0,H.jsx)(gt,{board:s,snapshot:d,sendKanban:N}),Se&&(0,H.jsx)(Pe,{audit:Se,onSelectTask:w}),l&&(0,H.jsxs)(`div`,{className:`flex h-9 shrink-0 items-center gap-2 border-b border-destructive/30 bg-destructive/10 px-4 text-sm text-destructive`,children:[(0,H.jsx)(T,{size:15}),(0,H.jsx)(`span`,{className:`truncate`,children:l})]}),(0,H.jsx)(`div`,{ref:b,className:`kanban-scroll-area min-h-0 flex-1 overflow-x-auto overflow-y-hidden overscroll-contain`,children:s?(0,H.jsxs)(H.Fragment,{children:[u&&(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center gap-4 border-b px-4 py-2 text-xs text-muted-foreground`,children:[(0,H.jsx)(`span`,{className:`font-medium text-foreground`,children:`Queue health`}),u.counts.ready>0&&(0,H.jsxs)(`span`,{title:`Claimable tasks`,className:`inline-flex items-center gap-1 text-success`,children:[u.counts.ready,` ready`]}),u.counts.running>0&&(0,H.jsxs)(`span`,{title:`Running assignments`,className:`inline-flex items-center gap-1 text-warning`,children:[u.counts.running,` running`]}),u.counts.review>0&&(0,H.jsxs)(`span`,{title:`In review`,className:`inline-flex items-center gap-1 text-primary`,children:[u.counts.review,` review`]}),u.counts.blocked>0&&(0,H.jsxs)(`span`,{title:`Manually blocked`,className:`inline-flex items-center gap-1 text-destructive`,children:[u.counts.blocked,` blocked`]}),u.counts.failed>0&&(0,H.jsxs)(`span`,{title:`Failed tasks`,className:`inline-flex items-center gap-1 text-destructive`,children:[u.counts.failed,` failed`]}),u.dependencyBlocked.count>0&&(0,H.jsxs)(`span`,{title:`Ready/pending tasks blocked by dependencies`,className:`inline-flex items-center gap-1 rounded bg-warning/10 px-1.5 py-0.5 text-warning`,children:[u.dependencyBlocked.count,` blocked by deps`]}),u.staleAssignments.count>0&&(0,H.jsxs)(`span`,{title:`Expired lease assignments`,className:`inline-flex items-center gap-1 rounded bg-destructive/10 px-1.5 py-0.5 text-destructive`,children:[u.staleAssignments.count,` stale`]}),u.heartbeatDue.count===0&&u.staleAssignments.count===0&&u.dependencyBlocked.count===0&&(0,H.jsx)(`span`,{className:`text-success`,children:`healthy`}),M>0&&(0,H.jsxs)(`span`,{title:`Sum of costCeilingUsd for running/queued tasks`,className:`inline-flex items-center gap-1 text-info`,children:[`~$`,M.toFixed(2),` running cost`]})]}),(0,H.jsx)(`div`,{className:`flex h-full min-w-max gap-3 p-4`,children:[...s.columns].sort((e,t)=>e.order-t.order).map(e=>(0,H.jsx)(Ct,{board:s,column:e,selectedTaskId:C,dragTaskId:pe,setDragTaskId:ge,onSelectTask:w,onDeleteTask:ke,onMoveTask:L},e.id))})]}):(0,H.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:`No kanban board selected.`})})]}),(0,H.jsx)(Et,{boards:i,board:s,task:be,runLink:we,onClose:()=>w(null),sendKanban:N,sendRaw:Ce,refreshBoard:F,activityEvents:ee,activityPresence:te,activityLoading:ie,activityError:ae,activitySessionId:s?.tags?.find(e=>e.startsWith(`session:`))?.slice(8),refreshActivity:()=>le(e=>e+1)})]})}function yt({runLink:e,sendRaw:t}){let n=e.engine===`sdd`,i=n?`sdd.board`:`goal`,a=`inline-flex items-center gap-1 rounded-md border px-2 py-1 text-[11px] font-medium hover:bg-muted`;return(0,H.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-b bg-primary/5 px-4 py-1.5`,children:[(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded bg-primary/15 px-1.5 py-0.5 text-[10px] font-semibold uppercase text-primary`,children:[(0,H.jsx)(w,{size:11}),` `,e.engine]}),(0,H.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:`Live run — steer it from here`}),(0,H.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[(0,H.jsxs)(`button`,{type:`button`,className:a,onClick:()=>t(`${i}.pause`),children:[(0,H.jsx)(ee,{size:12}),` Pause`]}),(0,H.jsxs)(`button`,{type:`button`,className:a,onClick:()=>t(`${i}.resume`),children:[(0,H.jsx)(ie,{size:12}),` Resume`]}),n&&(0,H.jsxs)(`button`,{type:`button`,className:a,onClick:()=>t(`sdd.board.retry_all_failed`),children:[(0,H.jsx)(d,{size:12}),` Retry failed`]}),(0,H.jsxs)(`button`,{type:`button`,className:O(a,`text-destructive hover:bg-destructive/10`),onClick:()=>t(`${i}.stop`),children:[(0,H.jsx)(r,{size:12}),` Stop`]})]})]})}function bt({boardId:e,sendKanban:t}){let n=`inline-flex items-center gap-1 rounded-md border px-2 py-1 text-[11px] font-medium text-primary hover:bg-primary/10`;return(0,H.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-b bg-muted/30 px-4 py-1.5`,children:[(0,H.jsx)(w,{size:13,className:`text-primary`}),(0,H.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:`Run this board as a live agent job:`}),(0,H.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[(0,H.jsx)(`button`,{type:`button`,className:n,onClick:()=>t(`kanban.run.start`,{boardId:e,engine:`goal`}),children:`Start as Goal`}),(0,H.jsx)(`button`,{type:`button`,className:n,onClick:()=>t(`kanban.run.start`,{boardId:e,engine:`sdd`}),children:`Start as SDD`})]})]})}function xt({runLink:e,runTaskId:t,modelCandidates:n,sendRaw:i}){let a=e.engine===`sdd`,[o,s]=(0,k.useState)(!1),[c,l]=(0,k.useState)(``),u=`inline-flex flex-1 items-center justify-center gap-1 rounded-md border py-1.5 text-xs font-medium hover:bg-muted`,f=()=>{let e=c.trim();e&&(i(a?`sdd.board.reassign`:`goal.assignTask`,{taskId:t,agentName:e}),s(!1),l(``))};return(0,H.jsxs)(`div`,{className:`mt-4 rounded-md border bg-primary/5 p-2.5`,children:[(0,H.jsx)(`div`,{className:`mb-2 text-[10px] font-semibold uppercase tracking-wide text-primary`,children:`Run controls`}),a&&(0,H.jsxs)(`div`,{className:`mb-2`,children:[(0,H.jsx)(`div`,{className:`mb-1 text-[10px] uppercase text-muted-foreground`,children:`Worker model`}),(0,H.jsx)(_e,{candidates:n,placeholder:`Set model for this task…`,onPick:(e,n)=>i(`sdd.board.set_task_model`,{taskId:t,model:e,provider:n})})]}),o?(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,H.jsx)(`input`,{value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&f(),e.key===`Escape`&&s(!1)},placeholder:`New worker name`,className:`min-w-0 flex-1 rounded-md border bg-background px-2 py-1.5 text-xs outline-none focus:border-primary`}),(0,H.jsx)(`button`,{type:`button`,onClick:f,className:`rounded-md bg-primary/10 px-2 py-1.5 text-primary`,children:(0,H.jsx)(S,{size:14})}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>s(!1),className:`rounded-md bg-muted px-2 py-1.5`,children:(0,H.jsx)(T,{size:14})})]}):(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,H.jsxs)(`button`,{type:`button`,className:u,onClick:()=>i(a?`sdd.board.retry`:`goal.retryTask`,{taskId:t}),children:[(0,H.jsx)(d,{size:13}),` Retry`]}),(0,H.jsxs)(`button`,{type:`button`,className:u,onClick:()=>s(!0),children:[(0,H.jsx)(ae,{size:13}),` Reassign`]}),a?(0,H.jsxs)(`button`,{type:`button`,className:O(u,`text-destructive hover:bg-destructive/10`),onClick:()=>i(`sdd.board.cancel_task`,{taskId:t}),children:[(0,H.jsx)(r,{size:13}),` Cancel`]}):(0,H.jsxs)(`button`,{type:`button`,className:u,onClick:()=>i(`goal.runTask`,{taskId:t}),children:[(0,H.jsx)(ie,{size:13}),` Run now`]})]})]})}function St(e,t){let n=t.assignment,r=ut(e,t,[]).findings.filter(e=>e.category===`operational`),i=V(n?.provider),a=V(n?.model);return{owner:V(n?.name)??V(n?.agentId)??V(n?.role)??V(t.assignee)??V(t.assignedAgent)??`Unassigned`,route:i||a?`${i?`${i}/`:``}${a??`default`}`:n?.modelRouting===`session`?`session default`:`default route`,blockers:(t.dependsOn??[]).filter(t=>{let n=e.tasks.find(e=>e.id===t);return!n||![`completed`,`archived`].includes(n.status)}).length,attempts:n?.attempt?`${n.attempt}${n.maxAttempts?`/${n.maxAttempts}`:``}`:`0`,fallbackCount:+!!n?.fallbackProfile+(n?.fallbackModels?.length??0),activeUsers:(e.presence??[]).filter(e=>e.taskId===t.id&&e.active).length,failed:t.status===`failed`||n?.status===`failed`||!!n?.error,criticalRisks:r.filter(e=>e.severity===`critical`).length,warningRisks:r.filter(e=>e.severity===`warning`).length}}function Ct({board:e,column:t,selectedTaskId:n,dragTaskId:r,setDragTaskId:i,onSelectTask:a,onDeleteTask:o,onMoveTask:s}){let c=e.tasks.filter(e=>e.columnId===t.id).sort((e,t)=>e.order-t.order);return(0,H.jsxs)(`section`,{className:O(`flex h-full shrink-0 flex-col rounded-md border bg-muted/25 transition-[width] duration-200`,c.length===0?`w-[180px]`:`w-[310px]`),children:[(0,H.jsxs)(`div`,{className:`flex h-10 shrink-0 items-center gap-2 border-b px-3`,children:[(0,H.jsx)(`span`,{className:`h-2.5 w-2.5 rounded-full`,style:{background:t.color??`hsl(var(--primary))`}}),(0,H.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-sm font-semibold`,children:t.title}),(0,H.jsx)(`span`,{className:`rounded bg-background px-1.5 py-0.5 text-[11px] text-muted-foreground`,children:c.length})]}),(0,H.jsx)(`ul`,{className:`min-h-0 flex-1 space-y-2 overflow-y-auto p-2 [scrollbar-gutter:stable]`,onDragOver:e=>e.preventDefault(),onDrop:n=>{n.preventDefault(),e.lifecycle?.mode!==`managed`&&r&&s(r,t.id),i(null)},children:c.map(t=>{let r=St(e,t);return(0,H.jsxs)(`li`,{draggable:e.lifecycle?.mode!==`managed`,onDragStart:()=>{e.lifecycle?.mode!==`managed`&&i(t.id)},onDragEnd:()=>i(null),className:O(`relative rounded-md border bg-background p-3 shadow-sm transition-colors`,n===t.id?`border-primary`:`hover:border-primary/50`),children:[(0,H.jsx)(`button`,{type:`button`,"aria-label":`Select task: ${t.title}`,onClick:()=>a(t.id),className:`absolute inset-0 cursor-pointer rounded-md`}),(0,H.jsxs)(`div`,{className:`pointer-events-none relative flex items-start gap-2`,children:[(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`div`,{className:`line-clamp-2 text-sm font-medium leading-5`,children:t.title}),t.description&&(0,H.jsx)(`div`,{className:`mt-1 line-clamp-2 text-xs leading-4 text-muted-foreground`,children:t.description})]}),(0,H.jsx)(`button`,{type:`button`,title:`Delete task`,"aria-label":`Delete task: ${t.title}`,onClick:()=>o(t),className:`pointer-events-auto relative flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-destructive/10 hover:text-destructive`,children:(0,H.jsx)(ue,{size:14})})]}),(0,H.jsxs)(`div`,{className:`pointer-events-none relative mt-2 flex flex-wrap items-center gap-1.5 text-[11px]`,children:[(0,H.jsx)(`span`,{className:Mt(t.priority),children:t.priority}),(0,H.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-muted-foreground`,children:t.status}),r.owner!==`Unassigned`&&(0,H.jsx)(`span`,{className:`rounded bg-primary/10 px-1.5 py-0.5 text-primary`,children:r.owner}),t.assignment&&(0,H.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-muted-foreground`,children:r.route}),t.assignment?.attempt?(0,H.jsxs)(`span`,{className:`rounded bg-info/10 px-1.5 py-0.5 text-info`,children:[`attempt `,r.attempts]}):null,r.fallbackCount>0&&(0,H.jsxs)(`span`,{className:`rounded bg-info/10 px-1.5 py-0.5 text-info`,children:[r.fallbackCount,` fallback`]}),r.blockers>0?(0,H.jsxs)(`span`,{className:`rounded bg-warning/10 px-1.5 py-0.5 text-warning`,children:[r.blockers,` blocker`]}):null,r.activeUsers>0&&(0,H.jsxs)(`span`,{className:`rounded bg-success/10 px-1.5 py-0.5 text-success`,children:[r.activeUsers,` active`]}),r.failed&&(0,H.jsx)(`span`,{className:`rounded bg-destructive/10 px-1.5 py-0.5 text-destructive`,children:`run failed`}),r.criticalRisks>0&&(0,H.jsxs)(`span`,{className:`rounded bg-destructive/10 px-1.5 py-0.5 text-destructive`,children:[r.criticalRisks,` critical risk`]}),r.warningRisks>0&&(0,H.jsxs)(`span`,{className:`rounded bg-warning/10 px-1.5 py-0.5 text-warning`,children:[r.warningRisks,` warning`]}),t.chain&&(0,H.jsxs)(`span`,{className:`rounded bg-primary/10 px-1.5 py-0.5 text-primary`,children:[`chain `,t.chain.order+1]}),t.assignment?.skills?.length?(0,H.jsxs)(`span`,{className:`rounded bg-success/10 px-1.5 py-0.5 text-success`,children:[t.assignment.skills.length,` skills`]}):null]})]},t.id)})})]})}var wt=[`architect`,`developer`,`reviewer`,`tester`,`verifier`,`security`,`documenter`,`external`,`leader`,`shadow`,`subagent`],Tt=[{value:`fs.read`,label:`Read files`,description:`fs.read`},{value:`fs.write`,label:`Write files (in project)`,description:`fs.write`},{value:`fs.write.outside-project`,label:`Write outside project`,description:`fs.write.outside-project`},{value:`net.outbound`,label:`Outbound network`,description:`net.outbound`},{value:`shell.exec`,label:`Run project commands`,description:`shell.exec`},{value:`shell.restricted`,label:`Restricted shell`,description:`shell.restricted`},{value:`shell.arbitrary`,label:`Arbitrary shell`,description:`shell.arbitrary`},{value:`session.todo`,label:`Session todos`,description:`session.todo`},{value:`tool.meta`,label:`Tool metadata`,description:`tool.meta`},{value:`tool.mutate.any`,label:`Invoke any tool`,description:`tool.mutate.any`},{value:`memory.read`,label:`Read memory`,description:`memory.read`},{value:`memory.write`,label:`Write memory`,description:`memory.write`},{value:`package.install`,label:`Install packages`,description:`package.install`},{value:`subagent.spawn`,label:`Spawn subagents`,description:`subagent.spawn`},{value:`config.mutate`,label:`Mutate config / trust`,description:`config.mutate`}];function Et({boards:e,board:t,task:n,runLink:r,onClose:a,sendKanban:c,sendRaw:d,refreshBoard:f,activityEvents:p,activityPresence:m,activityLoading:h,activityError:g,activitySessionId:_,refreshActivity:v}){let[y,b]=(0,k.useState)(``),[x,C]=(0,k.useState)(``),[w,ee]=(0,k.useState)(``),[E,te]=(0,k.useState)(``),[re,ie]=(0,k.useState)(``),[D,oe]=(0,k.useState)(`session`),[ce,le]=(0,k.useState)(``),[ue,de]=(0,k.useState)([]),[fe,me]=(0,k.useState)([]),[he,ve]=(0,k.useState)([]),[ye,be]=(0,k.useState)([]),[j,xe]=(0,k.useState)(``),Se=pe(!!n),M=A(!!n),N=V(M.sessionProvider),Ce=V(M.sessionModel),we=ge(`kanban-task-inspector`,!!n),[P,F]=(0,k.useState)(!1),[Te,Ee]=(0,k.useState)(``),[De,Oe]=(0,k.useState)(``),[I,ke]=(0,k.useState)(``),[L,R]=(0,k.useState)(`pending`),[z,Ae]=(0,k.useState)(``),[B,je]=(0,k.useState)(``),[Me,Ne]=(0,k.useState)(``),[Pe,Fe]=(0,k.useState)(`medium`),[Ie,W]=(0,k.useState)(`chore`),[G,K]=(0,k.useState)(``),[Le,Re]=(0,k.useState)([]),[ze,Be]=(0,k.useState)([]),[Ve,He]=(0,k.useState)(!1),[Ue,We]=(0,k.useState)(``),[Ke,q]=(0,k.useState)(``),[qe,Je]=(0,k.useState)(`off`),[J,Ye]=(0,k.useState)(``),[Xe,Ze]=(0,k.useState)(``),[Qe,et]=(0,k.useState)(``),[Y,tt]=(0,k.useState)(``),[nt,X]=(0,k.useState)(``),[rt,Z]=(0,k.useState)(`observation`),[it,at]=(0,k.useState)(`unknown`),[st,ct]=(0,k.useState)(``);(0,k.useEffect)(()=>{let r=V(n?.assignment?.provider),i=V(n?.assignment?.model);b(V(n?.assignment?.agentId)??V(n?.assignedAgent)??``),C(V(n?.assignment?.name)??``),ee(V(n?.assignment?.role)??``),te(r??``),ie(i??``),oe(n?.assignment?.modelRouting??(r||i?`fixed`:`session`)),le(V(n?.assignment?.fallbackProfile)??``),de(n?.assignment?.fallbackModels??[]),me(n?.assignment?.skills??[]),ve(n?.assignment?.tools??[]),be(n?.assignment?.allowedCapabilities??[]),xe(e.find(e=>e.id!==t?.id)?.id??``),Ee(n?.title??``),Oe(n?.description??``),ke(n?.dueDate??``),R(n?.status??`pending`),Ae(``),je(``),Ne(``),Fe(n?.priority??`medium`),W(n?.type??`chore`),K(n?.labels?.join(`, `)??``),Re(n?.dependsOn??[]),Be(n?.chain&&t?t.tasks.filter(e=>e.chain?.chainId===n.chain?.chainId).sort((e,t)=>(e.chain?.order??0)-(t.chain?.order??0)).map(e=>e.id):n?[n.id]:[]),He(!1),We(n?.estimatedHours?.toString()??``),q(n?.actualHours?.toString()??``),Je(n?.retryPolicy??n?.assignment?.retryPolicy??`off`),Ye((n?.costCeilingUsd??n?.assignment?.costCeilingUsd)?.toString()??``),Ze(n?.assignment?.maxAttempts?.toString()??``),et(``),tt(``),X(``),Z(`observation`),at(`unknown`),ct(``)},[t?.id,e,n]);let lt=e=>({boardId:t?.id,taskId:n?.id,...y.trim()?{agentId:y.trim()}:{},...x.trim()?{name:x.trim()}:{},...w.trim()?{role:w.trim()}:{},modelRouting:D,...D===`fixed`&&E.trim()?{provider:E.trim()}:{},...D===`fixed`&&re.trim()?{model:re.trim()}:{},...D===`fallback_profile`&&ce.trim()?{fallbackProfile:ce.trim()}:{},fallbackModels:ue,skills:fe,tools:he,allowedCapabilities:ye,...Xe?{maxAttempts:Number(Xe)}:{},...J?{costCeilingUsd:Number(J)}:{},retryPolicy:qe,activityNote:st.trim()||`${e===`dispatch`?`Dispatched`:`Assigned`} from WebUI to ${x.trim()||y.trim()||w.trim()||`the configured agent route`}.`}),ut=()=>{!t||!n||!Te.trim()||(c(`kanban.task.update`,{boardId:t.id,taskId:n.id,title:Te.trim(),description:De,dueDate:I||null,...t.lifecycle?.mode===`managed`?{}:{status:L},priority:Pe,type:Ie,labels:G.split(`,`).map(e=>e.trim()).filter(Boolean),dependsOn:Le,...n.chain&&ze.length<=1?{chain:null}:{},estimatedHours:Ue?Number(Ue):0,actualHours:Ke?Number(Ke):0,retryPolicy:qe,costCeilingUsd:J?Number(J):null,activityNote:st.trim()||`Task contract edited in WebUI.`}),ze.length>1&&c(`kanban.task.chain`,{boardId:t.id,taskIds:ze,enforceDependencies:Ve}),window.setTimeout(()=>f(t.id),180),ct(``))},dt=[`backlog`,`todo`,`running`,`review`,`done`],pt=n?.lifecycle?.currentStage,mt=pt?dt.indexOf(pt):-1,ht=mt>=0&&mt<dt.length-1?dt[mt+1]:void 0,gt=()=>{!t||!n||!ht||!z.trim()||(c(`kanban.task.transition`,{boardId:t.id,taskId:n.id,to:ht,actor:y.trim()||x.trim()||n.assignee||n.assignedAgent||`webui-agent`,comment:z.trim(),...B.trim()?{action:B.trim()}:{},...Me.trim()?{attachment:{url:Me.trim(),type:`url`,title:`Evidence for ${n.title}`}}:{}}),window.setTimeout(()=>f(t.id),180))},_t=()=>{!t||!n||!Qe.trim()||(c(`kanban.task.check.add`,{boardId:t.id,taskId:n.id,description:Qe.trim(),checkType:`manual`}),et(``))},vt=()=>{!t||!n||!Y.trim()||(c(`kanban.task.activity.add`,{boardId:t.id,taskId:n.id,kind:rt,outcome:it,summary:Y.trim(),...nt.trim()?{details:nt.trim()}:{},actor:x.trim()||y.trim()||`webui-operator`}),tt(``),X(``),window.setTimeout(v,150))};return n?(0,H.jsxs)(`aside`,{"aria-label":`Task inspector`,className:`flex max-h-[42dvh] w-full shrink-0 flex-col border-t bg-card/40 md:max-h-none md:w-[420px] md:border-l md:border-t-0 xl:w-[480px]`,children:[(0,H.jsxs)(`div`,{className:`flex h-12 items-center gap-2 border-b px-3`,children:[(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`div`,{className:`truncate text-sm font-semibold`,children:`Task`}),(0,H.jsx)(`div`,{className:`truncate text-[11px] text-muted-foreground`,children:n.id.slice(0,8)})]}),(0,H.jsx)(`button`,{type:`button`,title:`Close`,onClick:a,className:`flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,H.jsx)(T,{size:16})})]}),n?(0,H.jsxs)(`div`,{ref:we,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain p-3`,children:[(0,H.jsxs)(`div`,{className:`space-y-3 rounded-md border bg-background p-2.5`,children:[(0,H.jsx)(Q,{label:`Title`,value:Te,onChange:Ee}),(0,H.jsxs)(`label`,{className:`block`,children:[(0,H.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:`Description / working context`}),(0,H.jsx)(`textarea`,{value:De,onChange:e=>Oe(e.target.value),rows:5,className:`w-full resize-y rounded-md border bg-background px-2 py-1.5 text-xs leading-5 outline-none focus:border-primary`})]}),(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[t?.lifecycle?.mode===`managed`?(0,H.jsxs)(`div`,{className:`rounded-md border bg-muted/30 px-2 py-1.5`,children:[(0,H.jsx)(`div`,{className:`text-[10px] font-medium uppercase tracking-wide text-muted-foreground`,children:`Managed stage`}),(0,H.jsx)(`div`,{className:`mt-1 text-xs font-semibold capitalize`,children:n.lifecycle?.currentStage??`Backlog`})]}):(0,H.jsx)($,{label:`Status`,value:L,options:[`pending`,`ready`,`in_progress`,`blocked`,`review`,`completed`,`failed`,`archived`],onChange:e=>R(e)}),(0,H.jsx)($,{label:`Priority`,value:Pe,options:[`critical`,`high`,`medium`,`low`],onChange:e=>Fe(e)}),(0,H.jsx)($,{label:`Type`,value:Ie,options:[`feature`,`bugfix`,`refactor`,`docs`,`test`,`chore`],onChange:e=>W(e)}),(0,H.jsx)(Q,{label:`Labels (comma separated)`,value:G,onChange:K})]}),(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,H.jsx)(Q,{label:`Due date (ISO or YYYY-MM-DD)`,value:I,onChange:ke}),(0,H.jsx)(Q,{label:`Estimated hours`,value:Ue,onChange:We}),(0,H.jsx)(Q,{label:`Actual hours`,value:Ke,onChange:q})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:`Dependencies`}),(0,H.jsx)(U,{options:(t?.tasks??[]).filter(e=>e.id!==n.id).map(e=>({value:e.id,label:e.title,description:e.status})),selected:Le,onChange:Re,placeholder:`Select blocking tasks…`})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:`Task chain (selection order)`}),(0,H.jsx)(U,{options:(t?.tasks??[]).map(e=>({value:e.id,label:e.title,description:e.status})),selected:ze,onChange:e=>Be(e.includes(n.id)?e:[n.id,...e]),placeholder:`Add tasks to a sequential chain…`}),(0,H.jsxs)(`label`,{className:`mt-1.5 flex items-center gap-2 text-[11px] text-muted-foreground`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:Ve,onChange:e=>He(e.target.checked)}),`Enforce chain order as dependencies`]})]}),(0,H.jsx)(Q,{label:`Change / assignment reason (persisted to activity)`,value:st,onChange:ct}),(0,H.jsxs)(`button`,{type:`button`,onClick:ut,className:`inline-flex h-9 w-full items-center justify-center gap-2 rounded-md bg-primary text-sm text-primary-foreground hover:bg-primary/90`,children:[(0,H.jsx)(s,{size:15}),` Save task contract`]}),t?.lifecycle?.mode===`managed`&&ht&&(0,H.jsxs)(`section`,{"aria-label":`Managed lifecycle transition`,className:`space-y-2 rounded-md border border-primary/30 bg-primary/5 p-2.5`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wide text-primary`,children:`Kanban Agent transition`}),(0,H.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[pt,` → `,ht,`; no stages can be skipped.`]})]}),(0,H.jsx)(u,{size:16,className:`text-primary`})]}),(0,H.jsx)(Q,{label:`Completed action / reviewer action`,value:B,onChange:je}),(0,H.jsx)(Q,{label:`Truthful progress comment (required)`,value:z,onChange:Ae}),(0,H.jsx)(Q,{label:`Evidence attachment URL`,value:Me,onChange:Ne}),(0,H.jsxs)(`button`,{type:`button`,disabled:!z.trim(),onClick:gt,className:`inline-flex h-9 w-full items-center justify-center gap-2 rounded-md bg-primary text-sm text-primary-foreground hover:bg-primary/90 disabled:cursor-not-allowed disabled:opacity-50`,children:[(0,H.jsx)(ne,{size:15}),` Advance to `,ht]})]})]}),t&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(ot,{board:t,task:n,events:p,presence:m,sessionId:_,sessionProvider:N,sessionModel:Ce}),(0,H.jsx)($e,{task:n,events:p,sessionId:_}),(0,H.jsx)(ft,{board:t,task:n,events:p})]}),(0,H.jsxs)(`div`,{className:`mt-3 grid grid-cols-2 gap-2 text-xs`,children:[(0,H.jsx)(jt,{label:`Source`,value:n.origin?.system??`manual`}),(0,H.jsx)(jt,{label:`Task ID`,value:n.id.slice(0,8)}),(0,H.jsx)(jt,{label:`Run`,value:n.assignment?.status??`unassigned`}),(0,H.jsx)(jt,{label:`Column`,value:Dt(t,n.columnId)})]}),n.assignment&&(0,H.jsx)(At,{assignment:n.assignment}),r&&n.origin?.taskId&&(0,H.jsx)(xt,{runLink:r,runTaskId:n.origin.taskId,modelCandidates:Se,sendRaw:d}),!r&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,H.jsx)($,{label:`Primary model source`,value:D,options:[`session`,`fixed`,`fallback_profile`],onChange:e=>oe(e)}),D===`session`&&(0,H.jsxs)(`div`,{className:`rounded-md border bg-info/5 px-2 py-1.5 text-[11px] text-muted-foreground`,children:[`Uses the live session model: `,N?`${N}/`:``,Ce||`not available`,`.`]}),D===`fixed`&&(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:`Fixed provider / model`}),(0,H.jsx)(_e,{value:re||void 0,provider:E||void 0,candidates:Se,placeholder:`Select exact provider / model…`,onPick:(e,t)=>{ie(e),te(t)}})]}),D===`fallback_profile`&&(0,H.jsx)($,{label:`Fallback profile (first model is primary)`,value:ce,options:Object.keys(M.fallbackProfiles),placeholder:`Select configured profile…`,onChange:le}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:`Fallback models`}),(0,H.jsx)(U,{options:Se.map(e=>({value:`${e.provider}/${e.model}`,label:e.label,description:e.description,tag:e.provider})),selected:ue,onChange:de,placeholder:`Add fallback model…`,emptyLabel:`No models — add a provider in Settings`})]}),(0,H.jsx)($,{label:`Role`,value:w,options:wt,placeholder:`Select a role…`,onChange:ee}),(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:[`Agentic skills`,` `,(0,H.jsx)(`span`,{className:`text-muted-foreground/70`,children:`· force-loaded into the worker`})]}),(0,H.jsx)(U,{options:M.skills.map(e=>({value:e.name,label:e.name,description:e.description,tag:e.source})),selected:fe,onChange:me,placeholder:`Assign required skills…`,emptyLabel:`No skills registered`})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:[`Tools`,` `,(0,H.jsx)(`span`,{className:`text-muted-foreground/70`,children:`· blank = full default toolset`})]}),(0,H.jsx)(U,{options:M.tools.map(e=>({value:e.name,label:e.name,description:e.description})),selected:he,onChange:ve,placeholder:`Restrict to specific tools…`,emptyLabel:`Tool list unavailable on this server`})]}),(0,H.jsxs)(`div`,{className:`rounded-md border bg-background/60`,children:[(0,H.jsxs)(`button`,{type:`button`,onClick:()=>F(e=>!e),className:`flex w-full items-center justify-between px-2 py-1.5 text-[11px] font-medium text-muted-foreground hover:text-foreground`,children:[`Advanced`,(0,H.jsx)(i,{size:13,className:O(`transition-transform`,P&&`rotate-180`)})]}),P&&(0,H.jsxs)(`div`,{className:`space-y-3 border-t p-2`,children:[(0,H.jsx)(Q,{label:`Agent name (optional)`,value:x,onChange:C}),(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,H.jsx)($,{label:`Retry policy`,value:qe,options:[`off`,`incremental`,`exponential`],onChange:e=>Je(e)}),(0,H.jsx)(Q,{label:`Max attempts`,value:Xe,onChange:Ze}),(0,H.jsx)(Q,{label:`Cost ceiling USD`,value:J,onChange:Ye})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:[`Capabilities`,` `,(0,H.jsx)(`span`,{className:`text-muted-foreground/70`,children:`· blank = safe defaults`})]}),(0,H.jsx)(U,{options:Tt,selected:ye,onChange:be,placeholder:`Grant a capability…`})]})]})]})]}),(0,H.jsxs)(`div`,{className:`mt-4 grid grid-cols-2 gap-2`,children:[(0,H.jsxs)(`button`,{type:`button`,onClick:()=>{!t||!n||(c(`kanban.task.assign`,lt(`assign`)),ct(``),window.setTimeout(()=>f(t.id),150))},className:`inline-flex h-9 items-center justify-center gap-2 rounded-md border text-sm hover:bg-muted`,children:[(0,H.jsx)(ae,{size:15}),`Assign`]}),(0,H.jsxs)(`button`,{type:`button`,onClick:()=>{!t||!n||(c(`kanban.task.dispatch`,lt(`dispatch`)),ct(``),window.setTimeout(()=>f(t.id),200))},className:`inline-flex h-9 items-center justify-center gap-2 rounded-md bg-primary text-sm text-primary-foreground hover:bg-primary/90`,children:[(0,H.jsx)(l,{size:15}),`Dispatch`]})]})]}),e.length>1&&!r?(0,H.jsxs)(`div`,{className:`mt-4 space-y-2 rounded-md border bg-background p-2`,children:[(0,H.jsxs)(`label`,{className:`block`,children:[(0,H.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:`Target board`}),(0,H.jsx)(`select`,{value:j,onChange:e=>xe(e.target.value),className:`h-8 w-full rounded-md border bg-background px-2 text-sm outline-none focus:border-primary`,children:e.filter(e=>e.id!==t?.id).map(e=>(0,H.jsx)(`option`,{value:e.id,children:e.title},e.id))})]}),(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,H.jsxs)(`button`,{type:`button`,onClick:()=>{!t||!n||!j||c(`kanban.task.copy`,{boardId:t.id,taskId:n.id,targetBoardId:j})},disabled:!j,className:`inline-flex h-9 items-center justify-center gap-2 rounded-md border text-sm hover:bg-muted disabled:opacity-50`,children:[(0,H.jsx)(o,{size:15}),`Copy`]}),(0,H.jsxs)(`button`,{type:`button`,onClick:()=>{!t||!n||!j||c(`kanban.task.transfer`,{boardId:t.id,taskId:n.id,targetBoardId:j})},disabled:!j,className:`inline-flex h-9 items-center justify-center gap-2 rounded-md border text-sm hover:bg-muted disabled:opacity-50`,children:[(0,H.jsx)(ne,{size:15}),`Transfer`]})]})]}):null,(0,H.jsxs)(`div`,{className:`mt-5`,children:[(0,H.jsx)(`div`,{className:`mb-2 text-xs font-semibold uppercase text-muted-foreground`,children:`Completion checks`}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(n.successCriteria??[]).map(e=>(0,H.jsxs)(`div`,{className:`grid grid-cols-[auto_1fr_92px] items-center gap-2 rounded-md border bg-background px-2 py-1.5 text-xs`,children:[(0,H.jsx)(S,{size:13,className:e.status===`passed`?`text-success`:`text-muted-foreground`}),(0,H.jsx)(`span`,{className:`min-w-0 truncate`,children:e.description}),(0,H.jsx)(`select`,{value:e.status,onChange:r=>c(`kanban.task.check.update`,{boardId:t?.id,taskId:n.id,checkId:e.id,status:r.target.value}),className:`h-7 rounded border bg-background px-1 text-[11px]`,children:[`pending`,`passed`,`failed`,`skipped`].map(e=>(0,H.jsx)(`option`,{value:e,children:e},e))})]},e.id)),(0,H.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,H.jsx)(`input`,{value:Qe,onChange:e=>et(e.target.value),onKeyDown:e=>e.key===`Enter`&&_t(),placeholder:`Add a verifiable completion check…`,className:`h-8 min-w-0 flex-1 rounded-md border bg-background px-2 text-xs outline-none focus:border-primary`}),(0,H.jsx)(`button`,{type:`button`,onClick:_t,className:`h-8 rounded-md border px-2 hover:bg-muted`,children:(0,H.jsx)(se,{size:14})})]})]})]}),(0,H.jsx)(Ge,{task:n,events:p,sessionId:_,loading:h,error:g,onRefresh:v}),(0,H.jsxs)(`div`,{className:`mt-4`,children:[(0,H.jsx)(`div`,{className:`mb-2 text-xs font-semibold uppercase text-muted-foreground`,children:`Record decision / outcome`}),(0,H.jsxs)(`div`,{className:`mb-1.5 grid grid-cols-2 gap-1.5`,children:[(0,H.jsx)(`select`,{value:rt,onChange:e=>Z(e.target.value),"aria-label":`Task activity kind`,className:`h-8 rounded-md border bg-background px-2 text-xs`,children:[`decision`,`attempt`,`result`,`blocker`,`observation`].map(e=>(0,H.jsx)(`option`,{value:e,children:e},e))}),(0,H.jsx)(`select`,{value:it,onChange:e=>at(e.target.value),"aria-label":`Task activity outcome`,className:`h-8 rounded-md border bg-background px-2 text-xs`,children:[`unknown`,`succeeded`,`failed`,`partial`,`skipped`].map(e=>(0,H.jsx)(`option`,{value:e,children:e},e))})]}),(0,H.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,H.jsx)(`input`,{value:Y,onChange:e=>tt(e.target.value),onKeyDown:e=>e.key===`Enter`&&vt(),placeholder:`What was decided, attempted, or produced?`,className:`h-8 min-w-0 flex-1 rounded-md border bg-background px-2 text-xs outline-none focus:border-primary`}),(0,H.jsx)(`button`,{type:`button`,onClick:vt,className:`h-8 rounded-md border px-2 hover:bg-muted`,"aria-label":`Record task decision or outcome`,children:(0,H.jsx)(se,{size:14})})]}),(0,H.jsx)(`input`,{value:nt,onChange:e=>X(e.target.value),placeholder:`Optional evidence, rationale, command, link, or failure detail…`,"aria-label":`Task activity details`,className:`mt-1.5 h-8 w-full rounded-md border bg-background px-2 text-xs outline-none focus:border-primary`})]})]}):null]}):null}function Dt(e,t){return e?.columns.find(e=>e.id===t)?.title??t}var Ot={assigned:`bg-info/10 text-info`,queued:`bg-info/10 text-info`,running:`bg-warning/10 text-warning`,completed:`bg-success/10 text-success`,failed:`bg-destructive/10 text-destructive`,cancelled:`bg-muted text-muted-foreground`};function kt(e,t){if(!e)return null;let n=Date.parse(e);if(Number.isNaN(n))return null;let r=t?Date.parse(t):Date.now();if(Number.isNaN(r))return null;let i=Math.max(0,Math.round((r-n)/1e3));if(i<60)return`${i}s`;let a=Math.floor(i/60);return a<60?`${a}m ${i%60}s`:`${Math.floor(a/60)}h ${a%60}m`}function At({assignment:e}){let t=e.status===`running`,n=kt(e.dispatchedAt,e.completedAt),r=V(e.name)??V(e.agentId),i=V(e.role),a=V(e.provider),o=V(e.model),s=[];return r&&s.push({label:`Agent`,value:r}),i&&s.push({label:`Role`,value:i}),e.modelRouting&&s.push({label:`Model source`,value:e.modelRouting}),(a||o)&&s.push({label:`Model`,value:(0,H.jsxs)(`span`,{className:`font-mono text-[11px]`,children:[a?`${a}/`:``,o??`—`]})}),e.subagentId&&s.push({label:`Subagent`,value:(0,H.jsx)(`span`,{className:`font-mono text-[11px]`,children:e.subagentId})}),n&&s.push({label:e.completedAt?`Duration`:`Elapsed`,value:n}),typeof e.attempt==`number`&&s.push({label:`Attempt`,value:`${e.attempt}${e.maxAttempts?` / ${e.maxAttempts}`:``}`}),e.costCeilingUsd&&s.push({label:`Cost ceiling`,value:`$${e.costCeilingUsd.toFixed(2)}`}),e.fallbackProfile&&s.push({label:`Fallback profile`,value:e.fallbackProfile}),e.fallbackModels?.length&&s.push({label:`Fallbacks`,value:e.fallbackModels.join(` → `)}),e.skills?.length&&s.push({label:`Skills`,value:e.skills.join(`, `)}),e.tools?.length&&s.push({label:`Tools`,value:e.tools.join(`, `)}),e.leaseExpiresAt&&s.push({label:`Lease expires`,value:new Date(e.leaseExpiresAt).toLocaleString()}),(0,H.jsxs)(`div`,{className:`mt-4 rounded-md border bg-background p-2.5`,children:[(0,H.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:`Live run`}),(0,H.jsxs)(`span`,{className:O(`ml-auto inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] font-medium capitalize`,Ot[e.status]??`bg-muted text-muted-foreground`),children:[t&&(0,H.jsx)(`span`,{className:`h-1.5 w-1.5 animate-pulse rounded-full bg-current`,"aria-hidden":!0}),e.status]})]}),s.length>0&&(0,H.jsx)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-xs`,children:s.map(e=>(0,H.jsxs)(`div`,{className:`contents`,children:[(0,H.jsx)(`dt`,{className:`text-muted-foreground`,children:e.label}),(0,H.jsx)(`dd`,{className:`min-w-0 truncate text-right text-foreground`,children:e.value})]},e.label))}),e.lastResult&&(0,H.jsxs)(`div`,{className:`mt-2`,children:[(0,H.jsx)(`div`,{className:`mb-1 text-[10px] uppercase text-muted-foreground`,children:`Last result`}),(0,H.jsx)(`div`,{className:`max-h-24 overflow-y-auto whitespace-pre-wrap rounded bg-muted px-2 py-1 text-[11px] leading-relaxed text-foreground`,children:e.lastResult})]}),e.error&&(0,H.jsx)(`div`,{className:`mt-2 rounded border border-destructive/30 bg-destructive/10 px-2 py-1 text-[11px] text-destructive`,children:e.error})]})}function jt({label:e,value:t}){return(0,H.jsxs)(`div`,{className:`rounded-md border bg-background px-2 py-1.5`,children:[(0,H.jsx)(`div`,{className:`text-[10px] uppercase text-muted-foreground`,children:e}),(0,H.jsx)(`div`,{className:`mt-0.5 truncate text-xs font-medium`,children:t})]})}function Q({label:e,value:t,onChange:n}){return(0,H.jsxs)(`label`,{className:`block`,children:[(0,H.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:e}),(0,H.jsx)(`input`,{value:t,onChange:e=>n(e.target.value),className:`h-8 w-full rounded-md border bg-background px-2 text-sm outline-none focus:border-primary`})]})}function $({label:e,value:t,options:n,placeholder:r,onChange:i}){return(0,H.jsxs)(`label`,{className:`block`,children:[(0,H.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:e}),(0,H.jsxs)(`select`,{value:t,onChange:e=>i(e.target.value),className:`h-8 w-full rounded-md border bg-background px-2 text-sm outline-none focus:border-primary`,children:[r&&(0,H.jsx)(`option`,{value:``,children:r}),n.map(e=>(0,H.jsx)(`option`,{value:e,children:e},e))]})]})}function Mt(e){let t=`rounded px-1.5 py-0.5`;return e===`critical`?`${t} bg-destructive/10 text-destructive`:e===`high`?`${t} bg-warning/10 text-warning`:e===`low`?`${t} bg-muted text-muted-foreground`:`${t} bg-info/10 text-info`}export{vt as KanbanView};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{An as t,En as n,Hi as r,Ht as i,Nr as a,Qi as o,Qr as s,Tt as c,Xn as l,Yi as u,Zt as d,at as f,ea as p,fr as m,ii as h,kr as g,pt as _,qt as v,tt as y,xn as b,zi as x}from"./vendor-JNPeA-SL.js";import"./i18n-BcnwAuXt.js";import{n as S}from"./ui-store-lBwi9h6q.js";import{t as C}from"./utils-BLVofF8S.js";import{R as w,S as T,T as E,Y as D}from"./index-MIiPbE0D.js";var O=e(p(),1),k=y(),A={note:m,ask:x,assign:i,steer:v,btw:s,broadcast:i,status:a,result:r},j={high:`border-destructive/25 bg-destructive/10 text-destructive`,normal:`border-border bg-muted text-muted-foreground`,low:`border-primary/20 bg-primary/10 text-primary`};function M(e){return new Date(e).toLocaleString()}function N(e){let t=new Date(e),n=Date.now()-t.getTime();return n<6e4?o.t(`common:time.justNow`):n<36e5?o.t(`common:time.minutesAgo`,{count:Math.round(n/6e4)}):n<864e5?o.t(`common:time.hoursAgo`,{count:Math.round(n/36e5)}):n<6048e5?o.t(`common:time.daysAgo`,{count:Math.round(n/864e5)}):t.toLocaleDateString()}function P(){let{t:e}=u();return(0,k.jsx)(`div`,{className:`flex h-full min-h-0 flex-1 items-center justify-center bg-[hsl(var(--surface-2)/0.45)] p-4`,children:(0,k.jsxs)(`div`,{className:`ws-surface flex max-w-md flex-col items-center gap-3 rounded-xl p-6 text-center text-muted-foreground`,children:[(0,k.jsx)(`span`,{className:`flex h-12 w-12 items-center justify-center rounded-lg bg-primary/10 text-primary`,children:(0,k.jsx)(n,{className:`h-6 w-6`})}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`div`,{className:`text-sm font-semibold text-foreground`,children:e(`activity:mailbox.emptyDetail`)}),(0,k.jsx)(`div`,{className:`mt-1 text-xs`,children:e(`activity:mailbox.emptyDetailHint`)})]})]})})}function F({readBy:e}){let{t}=u(),n=Object.entries(e);return n.length===0?null:(0,k.jsxs)(`div`,{className:`space-y-1`,children:[(0,k.jsx)(`div`,{className:`text-[10px] font-semibold text-muted-foreground uppercase tracking-wide`,children:t(`activity:mailbox.readBy`)}),(0,k.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:n.map(([e,t])=>(0,k.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] bg-success/10 text-success`,title:M(t),children:[(0,k.jsx)(r,{className:`h-2.5 w-2.5`}),e]},e))})]})}function I({className:e}){let{t:n}=u(),i=S(e=>e.selectedMailMessage),a=S(e=>e.setSelectedMailMessage);(0,O.useEffect)(()=>()=>{a(null)},[a]);function o(){a(null),w(`chat`)}if(!i)return(0,k.jsx)(P,{});let s=A[i.type]??b,p=n(`activity:mailbox.type.${i.type}`,{defaultValue:i.type}),m=j[i.priority]??j.normal,v=i.scope?{scope:i.scope,recipientSessionId:i.recipientSessionId}:D(i.to),y=i.to===`*`||i.to===`all`?n(`activity:mailbox.everyone`):i.to,x=v.scope===`session`?n(`activity:mailbox.sessionScope`,{sid:v.recipientSessionId??``}):v.scope===`project`?n(`activity:mailbox.projectScope`):n(`activity:mailbox.directScope`);return(0,k.jsx)(`div`,{className:C(`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden bg-[hsl(var(--surface-2)/0.45)] p-3`,e),children:(0,k.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-border/70 bg-card/75 shadow-sm`,children:[(0,k.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-border/70 px-3 py-3 sm:px-4 shrink-0`,children:[(0,k.jsx)(`button`,{type:`button`,onClick:o,className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-md border border-border/70 bg-background/60 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,title:n(`activity:mailbox.backToChat`),children:(0,k.jsx)(h,{className:`h-4 w-4`})}),(0,k.jsx)(`div`,{className:C(`flex h-9 w-9 shrink-0 items-center justify-center rounded-lg`,i.completed?`bg-success/10`:`bg-primary/10`),children:(0,k.jsx)(s,{className:C(`h-4 w-4`,i.completed?`text-success`:`text-primary`)})}),(0,k.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,k.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,k.jsx)(`h2`,{className:`text-sm font-semibold text-foreground truncate`,children:i.subject}),i.completed&&(0,k.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 rounded-md border border-success/25 bg-success/8 px-1.5 py-0.5 text-[10px] font-semibold text-success`,children:[(0,k.jsx)(r,{className:`h-3 w-3`}),n(`activity:mailbox.completed`)]}),(0,k.jsx)(`span`,{className:C(`rounded-md border px-1.5 py-0.5 text-[10px] font-semibold uppercase`,m),children:i.priority||`normal`})]}),(0,k.jsxs)(`div`,{className:`mt-1 flex min-w-0 flex-wrap items-center gap-2 text-[11px] text-muted-foreground`,children:[(0,k.jsx)(`span`,{className:`min-w-0 truncate font-medium text-foreground/80`,children:i.from}),(0,k.jsx)(`span`,{children:`→`}),(0,k.jsx)(`span`,{className:`min-w-0 truncate`,children:y}),v.scope===`session`&&(0,k.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-semibold bg-warning/12 text-warning`,title:n(`activity:mailbox.sessionScopeTitle`,{sid:v.recipientSessionId??``}),children:[(0,k.jsx)(t,{className:`h-2.5 w-2.5`}),n(`activity:mailbox.sessionLabel`)]}),v.scope===`project`&&(0,k.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-semibold bg-primary/12 text-primary`,children:[(0,k.jsx)(l,{className:`h-2.5 w-2.5`}),n(`activity:mailbox.projectLabel`)]}),(0,k.jsx)(`span`,{className:`opacity-40`,children:`•`}),(0,k.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,k.jsx)(g,{className:`h-3 w-3`}),N(i.timestamp)]})]})]}),(0,k.jsx)(`button`,{type:`button`,onClick:o,className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,title:n(`activity:mailbox.closeTitle`),children:(0,k.jsx)(f,{className:`h-4 w-4`})})]}),(0,k.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,k.jsx)(`div`,{className:`mx-auto w-full max-w-4xl px-4 py-5`,children:(0,k.jsx)(`div`,{className:`markdown-content prose prose-sm dark:prose-invert max-w-none text-sm leading-relaxed`,children:(0,k.jsx)(E,{components:T,children:i.body})})})}),(0,k.jsxs)(`div`,{className:`border-t border-border/70 bg-muted/20 px-4 py-3 shrink-0`,children:[(0,k.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 gap-x-6 gap-y-2 text-xs`,children:[(0,k.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,k.jsx)(c,{className:`h-3 w-3 shrink-0`}),(0,k.jsx)(`span`,{children:p})]}),(0,k.jsx)(`div`,{className:`flex items-center gap-1.5`,children:(0,k.jsx)(`span`,{className:C(`rounded border px-1.5 py-0.5 text-[10px] font-semibold uppercase`,m),children:i.priority||`normal`})}),(0,k.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,k.jsx)(_,{className:`h-3 w-3 shrink-0`}),(0,k.jsx)(`span`,{className:`truncate`,title:i.from,children:i.from})]}),(0,k.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[v.scope===`session`?(0,k.jsx)(t,{className:`h-3 w-3 shrink-0 text-warning`}):(0,k.jsx)(l,{className:`h-3 w-3 shrink-0 text-primary`}),(0,k.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wide shrink-0`,children:n(`activity:mailbox.scopeLabel`)}),(0,k.jsx)(`span`,{className:`truncate`,children:x})]}),(0,k.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,k.jsx)(g,{className:`h-3 w-3 shrink-0`}),(0,k.jsx)(`span`,{children:M(i.timestamp)})]}),i.replyTo&&(0,k.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground col-span-2`,children:[(0,k.jsx)(d,{className:`h-3 w-3 shrink-0`}),(0,k.jsx)(`span`,{className:`truncate`,children:n(`activity:mailbox.replyTo`,{id:i.replyTo})})]}),i.completed&&i.completedBy&&(0,k.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground col-span-2`,children:[(0,k.jsx)(r,{className:`h-3 w-3 shrink-0 text-success`}),(0,k.jsx)(`span`,{children:i.completedAt?n(`activity:mailbox.completedByAt`,{name:i.completedBy,time:M(i.completedAt)}):n(`activity:mailbox.completedBy`,{name:i.completedBy})})]}),i.outcome&&(0,k.jsxs)(`div`,{className:`flex items-start gap-1.5 text-muted-foreground col-span-2 sm:col-span-4`,children:[(0,k.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wide shrink-0 mt-0.5`,children:n(`activity:mailbox.outcome`)}),(0,k.jsx)(`span`,{children:i.outcome})]}),i.taskContext&&(0,k.jsxs)(`div`,{className:`flex items-start gap-1.5 text-muted-foreground col-span-2 sm:col-span-4`,children:[(0,k.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wide shrink-0 mt-0.5`,children:n(`activity:mailbox.task`)}),(0,k.jsx)(`span`,{children:i.taskContext})]})]}),Object.keys(i.readBy??{}).length>0&&(0,k.jsx)(`div`,{className:`mt-3 pt-3 border-t border-border/50`,children:(0,k.jsx)(F,{readBy:i.readBy})})]})]})})}export{I as MailboxDetailView};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{$n as t,Ci as n,Cr as r,Fn as i,Gt as a,Ii as o,It as s,Kr as c,Pr as l,Qt as u,Rr as d,Tt as f,Ut as p,Vr as m,Zn as h,Zr as g,_,_r as ee,a as v,an as y,at as b,di as x,ea as S,f as C,fi as w,fr as T,i as E,ii as te,jr as D,ki as ne,ln as re,mn as O,n as ie,pi as k,r as ae,rn as oe,s as A,si as j,sn as M,tt as se,un as ce,vr as le,xt as ue,yi as de}from"./vendor-JNPeA-SL.js";import{n as fe}from"./ui-store-lBwi9h6q.js";import{t as N}from"./ws-client-3f38Kop2.js";import{t as P}from"./utils-BLVofF8S.js";import{A as pe,E as F,M as me,N as he,O as ge,P as _e,at as ve,g as ye,j as be,k as xe,v as I}from"./index-MIiPbE0D.js";import{_ as Se,a as L,b as Ce,c as R,d as we,f as Te,g as Ee,h as De,i as z,l as Oe,m as B,n as ke,o as Ae,p as je,r as V,s as Me,t as Ne,u as Pe,v as Fe,y as H}from"./shared-aqSRO8IM.js";var U=e(S(),1),W=se(),G=212,Ie=188;function Le(e){return e.length>14?`${e.slice(0,11)}…`:e}function Re(e,t=58){let n=e.replace(/\s+/g,` `).trim();return n.length>t?`${n.slice(0,t-1)}…`:n}function ze(e){return e.type===`symbol`?[e.path,e.symbol?`#${e.symbol}`:``].filter(Boolean).join(``):e.path??e.command??e.symbol??e.type}function Be(e){return e===`active`?`border-success/45 bg-success/10 text-success`:e===`stale`?`border-warning/45 bg-warning/10 text-warning`:e===`contradicted`?`border-destructive/45 bg-destructive/10 text-destructive`:e===`superseded`?`border-warning/35 bg-warning/5 text-warning`:`border-border bg-muted/55 text-muted-foreground`}function Ve({data:e}){let{entry:t,center:n}=e;return(0,W.jsxs)(`div`,{className:n?`border border-primary/70 bg-card px-3 py-2.5 text-card-foreground shadow-[0_0_0_1px_hsl(var(--primary)/0.2),0_0_24px_hsl(var(--primary)/0.12)]`:`border border-border/80 bg-card/95 px-3 py-2.5 text-card-foreground shadow-lg`,style:{width:G},title:t.text,children:[(0,W.jsx)(A,{type:`target`,position:_.Top,className:`!border-background !bg-muted-foreground`}),(0,W.jsx)(A,{type:`source`,position:_.Bottom,className:`!border-background !bg-primary`}),(0,W.jsx)(A,{type:`source`,position:_.Right,className:`!border-background !bg-primary`}),(0,W.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,W.jsx)(`span`,{className:`border px-1.5 py-0.5 text-[9px] font-bold uppercase ${Be(t.status)}`,children:t.status}),(0,W.jsx)(`span`,{className:`ml-auto truncate font-mono text-[9px] text-muted-foreground`,children:Le(t.id)})]}),(0,W.jsx)(`p`,{className:`mt-2 line-clamp-2 text-[11px] leading-4 text-foreground/90`,children:Re(t.text)}),(0,W.jsx)(`p`,{className:`mt-1 font-mono text-[9px] uppercase text-muted-foreground`,children:t.kind})]})}function K({data:e}){return(0,W.jsxs)(`div`,{className:`border border-info/40 bg-info/8 px-2.5 py-2 text-card-foreground shadow-lg`,style:{width:Ie},title:e.label,children:[(0,W.jsx)(A,{type:`target`,position:_.Left,className:`!border-background !bg-info`}),(0,W.jsx)(`p`,{className:`font-mono text-[9px] font-bold uppercase text-info`,children:e.anchor.type}),(0,W.jsx)(`p`,{className:`mt-1 truncate font-mono text-[10px] text-foreground/85`,children:e.label})]})}var He={memoryNode:Ve,anchorNode:K};function q(e){return{id:e,revision:0,scope:`project`,kind:`fact`,status:`deleted`,text:`Memory is unavailable or has been removed.`,importance:0,confidence:0,freshness:0,tags:[],anchors:[],createdAt:``,updatedAt:``}}function J({centerMemory:e,allMemories:t}){let{nodes:n,edges:r}=(0,U.useMemo)(()=>{let n=[],r=[],i=new Map(t.map(e=>[e.id,e]));n.push({id:e.id,type:`memoryNode`,position:{x:320-G/2,y:120},data:{entry:e,center:!0}});let a=[...e.supersededBy?[{id:e.supersededBy,relation:`superseded by`}]:[],...(e.supersedes??[]).map(e=>({id:e,relation:`supersedes`})),...(e.contradicts??[]).map(e=>({id:e,relation:`contradicts`}))],o=320-(a.length-1)*220/2;return a.forEach((t,a)=>{let s=i.get(t.id)??q(t.id),c=t.relation===`superseded by`,l=c?0:280+Math.floor(a/3)*130,u=c?320-G/2:o+a*220-G/2;n.push({id:`memory:${t.id}:${a}`,type:`memoryNode`,position:{x:u,y:l},data:{entry:s,center:!1}});let d=t.relation===`contradicts`,f=c?`memory:${t.id}:${a}`:e.id,p=c?e.id:`memory:${t.id}:${a}`;r.push({id:`relation:${t.relation}:${t.id}:${a}`,source:f,target:p,type:`smoothstep`,animated:!d,label:t.relation,style:{stroke:d?`hsl(var(--destructive))`:`hsl(var(--primary))`,strokeWidth:1.7,...d?{strokeDasharray:`5 4`}:{}},labelStyle:{fill:d?`hsl(var(--destructive))`:`hsl(var(--muted-foreground))`,fontSize:9,fontWeight:700},labelBgStyle:{fill:`hsl(var(--card))`,fillOpacity:.9}})}),e.anchors.forEach((t,i)=>{let a=`anchor:${i}`;n.push({id:a,type:`anchorNode`,position:{x:540,y:120+(i-(e.anchors.length-1)/2)*66},data:{anchor:t,label:ze(t)}}),r.push({id:`anchor-edge:${i}`,source:e.id,target:a,type:`smoothstep`,style:{stroke:`hsl(var(--info))`,strokeWidth:1.3}})}),{nodes:n,edges:r}},[t,e]);return n.length<=1?null:(0,W.jsxs)(`section`,{className:`overflow-hidden border border-border/75 bg-background/35`,"aria-label":`Memory relationship graph`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border/70 bg-card/55 px-3 py-2`,children:[(0,W.jsx)(`p`,{className:`text-[10px] font-bold uppercase tracking-[0.16em] text-muted-foreground`,children:`Relationship map`}),(0,W.jsxs)(`span`,{className:`font-mono text-[10px] text-muted-foreground`,children:[n.length,` nodes · `,r.length,` edges`]})]}),(0,W.jsx)(`div`,{className:`h-[320px] w-full`,"aria-hidden":`true`,children:(0,W.jsxs)(C,{nodes:n,edges:r,nodeTypes:He,fitView:!0,fitViewOptions:{padding:.24,maxZoom:1.05},minZoom:.4,maxZoom:1.5,nodesConnectable:!1,elementsSelectable:!1,panOnScroll:!1,zoomOnScroll:!1,proOptions:{hideAttribution:!0},children:[(0,W.jsx)(ae,{variant:E.Dots,gap:18,size:1,color:`hsl(var(--muted-foreground) / 0.18)`}),(0,W.jsx)(v,{showInteractive:!1,className:`!border-border !bg-card !shadow-lg`})]})})]})}function Ue({memory:e,allMemories:t,relatedMemories:n,onClose:r,onOpenMemory:i,onEdit:a,onDelete:o,onTagSelect:s,onNotice:l}){return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-b border-border/70 bg-card/65 px-4 py-3 backdrop-blur-xl`,children:[(0,W.jsx)(F,{variant:`ghost`,size:`icon`,className:`md:hidden`,onClick:r,"aria-label":`Back to memory list`,children:(0,W.jsx)(te,{className:`size-4`})}),(0,W.jsx)(`span`,{className:P(`text-[10px] font-bold uppercase tracking-[0.14em]`,De(e.kind)),children:V[e.kind]??e.kind}),(0,W.jsx)(Oe,{status:e.status}),(0,W.jsx)(`span`,{className:`border border-border/70 px-2 py-0.5 font-mono text-[9px] uppercase text-muted-foreground`,children:e.scope}),e.audience&&(0,W.jsxs)(`span`,{className:`flex items-center gap-1 border border-primary/30 bg-primary/10 px-2 py-0.5 font-mono text-[9px] text-primary`,title:je(e.audience),children:[(0,W.jsx)(c,{className:`size-3`}),je(e.audience)]}),(0,W.jsxs)(`div`,{className:`ml-auto flex items-center gap-1.5`,children:[(0,W.jsx)(F,{variant:`ghost`,size:`icon`,"aria-label":`Copy memory ID`,title:`Copy memory ID`,onClick:()=>{navigator.clipboard?.writeText(e.id),l(`Memory ID copied.`)},children:(0,W.jsx)(D,{className:`size-4`})}),(0,W.jsxs)(F,{variant:`outline`,size:`sm`,onClick:a,disabled:e.status===`deleted`,children:[(0,W.jsx)(M,{className:`size-3.5`}),` Edit`]}),(0,W.jsxs)(F,{variant:`destructive`,size:`sm`,onClick:o,disabled:e.status===`deleted`,children:[(0,W.jsx)(ue,{className:`size-3.5`}),` Delete`]})]})]}),(0,W.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain p-4 md:p-5`,children:(0,W.jsxs)(`div`,{className:`mx-auto max-w-5xl space-y-5`,children:[(0,W.jsx)(Y,{memory:e}),(0,W.jsx)(We,{memory:e}),e.tags.length>0&&(0,W.jsx)(X,{tags:e.tags,onTagSelect:s}),e.anchors.length>0&&(0,W.jsx)(Z,{anchors:e.anchors}),n.length>0&&(0,W.jsx)(Ge,{relatedMemories:n,allMemories:t,onOpenMemory:i}),(0,W.jsx)(J,{centerMemory:e,allMemories:t}),(0,W.jsx)(Q,{memory:e}),e.status===`deleted`&&(0,W.jsx)(Ke,{contextPolicy:e.contextPolicy})]})})]})}function Y({memory:e}){return(0,W.jsxs)(`div`,{className:`relative overflow-hidden border border-border/75 bg-card/55 p-5 shadow-[inset_0_1px_0_hsl(var(--foreground)/0.04)]`,children:[(0,W.jsx)(`div`,{className:`pointer-events-none absolute -right-10 -top-10 size-36 bg-[radial-gradient(circle,hsl(var(--info)/0.13),transparent_68%)]`}),(0,W.jsx)(`p`,{className:`relative whitespace-pre-wrap text-sm leading-7 text-foreground md:text-[15px]`,children:e.text}),e.summary&&(0,W.jsx)(`p`,{className:`relative mt-4 border-l-2 border-info/50 pl-3 text-xs italic leading-5 text-muted-foreground`,children:e.summary}),(0,W.jsxs)(`div`,{className:`relative mt-5 flex flex-wrap items-center gap-2 border-t border-border/60 pt-3`,children:[(0,W.jsx)(`code`,{className:`min-w-0 break-all font-mono text-[10px] text-muted-foreground`,children:e.id}),(0,W.jsxs)(`span`,{className:`ml-auto font-mono text-[10px] text-muted-foreground`,children:[`revision `,e.revision]})]})]})}function We({memory:e}){return(0,W.jsx)(`div`,{className:`grid gap-px bg-border/60 sm:grid-cols-3`,children:[[`Importance`,e.importance,s],[`Confidence`,e.confidence,l],[`Freshness`,e.freshness,u]].map(([e,t,n])=>(0,W.jsxs)(`div`,{className:`bg-card/60 p-3`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(n,{className:`size-3.5 text-info`}),(0,W.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-[0.13em] text-muted-foreground`,children:e}),(0,W.jsxs)(`span`,{className:`ml-auto font-mono text-xs font-bold tabular-nums`,children:[Math.round(t*100),`%`]})]}),(0,W.jsx)(`div`,{className:`mt-2 h-1 bg-muted`,children:(0,W.jsx)(`div`,{className:`h-full bg-info shadow-[0_0_8px_hsl(var(--info)/0.45)]`,style:{width:`${Math.round(t*100)}%`}})})]},e))})}function X({tags:e,onTagSelect:t}){return(0,W.jsxs)(`section`,{children:[(0,W.jsxs)(`h3`,{className:`mb-2 flex items-center gap-2 text-[10px] font-bold uppercase tracking-[0.14em] text-muted-foreground`,children:[(0,W.jsx)(f,{className:`size-3.5 text-info`}),` Tags`]}),(0,W.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:e.map(e=>(0,W.jsxs)(`button`,{type:`button`,onClick:()=>t(e),className:`border border-info/25 bg-info/5 px-2 py-1 font-mono text-[10px] text-info hover:border-info/55 hover:bg-info/10`,children:[`#`,e]},e))})]})}function Z({anchors:e}){return(0,W.jsxs)(`section`,{className:`border border-border/75 bg-card/40`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border/65 px-3 py-2.5`,children:[(0,W.jsxs)(`h3`,{className:`flex items-center gap-2 text-[10px] font-bold uppercase tracking-[0.14em] text-muted-foreground`,children:[(0,W.jsx)(ne,{className:`size-3.5 text-info`}),` Anchors`]}),(0,W.jsx)(`span`,{className:`font-mono text-[10px] text-muted-foreground`,children:e.length})]}),(0,W.jsx)(`ul`,{className:`divide-y divide-border/55`,children:e.map((e,t)=>(0,W.jsxs)(`li`,{className:`flex min-w-0 items-start gap-3 px-3 py-2.5`,children:[(0,W.jsx)(`span`,{className:`mt-0.5 flex size-7 shrink-0 items-center justify-center border border-info/25 bg-info/5 text-info`,children:e.type===`command`?(0,W.jsx)(w,{className:`size-3.5`}):(0,W.jsx)(ne,{className:`size-3.5`})}),(0,W.jsxs)(`div`,{className:`min-w-0`,children:[(0,W.jsx)(`p`,{className:`text-[9px] font-bold uppercase text-muted-foreground`,children:e.type}),(0,W.jsxs)(`p`,{className:`mt-0.5 break-all font-mono text-[10px] leading-4 text-foreground/85`,children:[e.path??e.command??`—`,e.symbol?`#${e.symbol}`:``]})]}),(e.lineStart||e.lineEnd)&&(0,W.jsxs)(`span`,{className:`ml-auto shrink-0 font-mono text-[9px] text-muted-foreground`,children:[`L`,e.lineStart??`?`,`–`,e.lineEnd??`?`]})]},`${e.type}:${e.path??e.command??e.symbol}:${t}`))})]})}function Ge({relatedMemories:e,allMemories:n,onOpenMemory:r}){return(0,W.jsxs)(`section`,{className:`border border-border/75 bg-card/40`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border/65 px-3 py-2.5`,children:[(0,W.jsxs)(`h3`,{className:`flex items-center gap-2 text-[10px] font-bold uppercase tracking-[0.14em] text-muted-foreground`,children:[(0,W.jsx)(t,{className:`size-3.5 text-info`}),` Memory relationships`]}),(0,W.jsx)(`span`,{className:`font-mono text-[10px] text-muted-foreground`,children:e.length})]}),(0,W.jsx)(`ul`,{className:`divide-y divide-border/55`,children:e.map(e=>{let t=n.find(t=>t.id===e.id);return(0,W.jsx)(`li`,{children:(0,W.jsxs)(`button`,{type:`button`,disabled:!t,onClick:()=>t&&r(t.id),className:`group flex w-full min-w-0 items-center gap-3 px-3 py-2.5 text-left hover:bg-info/5 disabled:cursor-not-allowed disabled:opacity-55`,children:[(0,W.jsx)(`span`,{className:P(`w-24 shrink-0 text-[9px] font-bold uppercase`,e.relation===`Contradicts`?`text-destructive`:`text-info`),children:e.relation}),(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs`,children:t?Ee(t.text,95):`Referenced memory is unavailable`}),(0,W.jsx)(`code`,{className:`hidden max-w-32 truncate font-mono text-[9px] text-muted-foreground sm:block`,children:e.id}),t&&(0,W.jsx)(d,{className:`size-3.5 shrink-0 text-muted-foreground group-hover:text-info`})]})},`${e.relation}:${e.id}`)})})]})}function Q({memory:e}){return(0,W.jsx)(`section`,{className:`grid gap-px bg-border/60 sm:grid-cols-2 lg:grid-cols-4`,children:[[`Created`,B(e.createdAt),g],[`Updated`,B(e.updatedAt),u],[`Last accessed`,B(e.lastAccessedAt),O],[`Last verified`,B(e.lastVerifiedAt),s]].map(([e,t,n])=>(0,W.jsxs)(`div`,{className:`bg-card/50 p-3`,children:[(0,W.jsx)(n,{className:`size-3.5 text-muted-foreground`}),(0,W.jsx)(`p`,{className:`mt-2 text-[9px] font-bold uppercase tracking-[0.12em] text-muted-foreground`,children:e}),(0,W.jsx)(`p`,{className:`mt-1 text-[10px] leading-4 text-foreground/85`,children:t})]},e))})}function Ke({contextPolicy:e}){return(0,W.jsxs)(`div`,{className:`flex items-start gap-3 border border-border bg-muted/50 p-4 text-xs text-muted-foreground`,children:[(0,W.jsx)(j,{className:`mt-0.5 size-4 shrink-0`}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`p`,{className:`font-bold text-foreground`,children:`Deleted memory`}),(0,W.jsx)(`p`,{className:`mt-1 leading-5`,children:e===`never`?`This record is audit-only and carries an absolute ban: it can never enter LLM context.`:`The record is inactive and cannot be edited, but remains eligible as historical evidence when retrieval finds it relevant.`})]})]})}var qe={filePath:``,primaryMatches:[],symbolMatches:[],relatedMatches:[],totalCount:0,activeCount:0,supersededCount:0,reviewPendingCount:0};function Je(e){let{filePath:t,lineStart:n,lineEnd:r,limit:i=50,showSuperseded:a=!0,showDeleted:o=!1,autoFetch:s=!0,sendOptions:c}=e,l=c?JSON.stringify(c):``,[u,d]=(0,U.useState)(null),[f,p]=(0,U.useState)(!1),[m,h]=(0,U.useState)(null),g=(0,U.useRef)(0),_=(0,U.useRef)(null),ee=(0,U.useRef)(c);ee.current=c;let v=(0,U.useCallback)(()=>{if(!t){d(null),h(null),p(!1);return}let e=++g.current;p(!0),h(null);let s=N();if(!s){h(`WebSocket client unavailable`),p(!1);return}_.current?.(),_.current=null;let c=t,l=s.on(`memory.super.forFile`,t=>{if(e!==g.current)return;let n=t.payload.response;n&&n.filePath!==c||(t.payload.error?(h(t.payload.error),d(null)):(d(n??qe),h(null)),p(!1))});_.current=l;let u={filePath:t,limit:i,showSuperseded:a,showDeleted:o,...n===void 0?{}:{lineStart:n},...r===void 0?{}:{lineEnd:r}};try{s.findMemoriesForFile(u,ee.current??void 0)}catch(t){l(),_.current===l&&(_.current=null),e===g.current&&(h(t instanceof Error?t.message:String(t)),p(!1))}},[t,n,r,i,a,o]);(0,U.useEffect)(()=>{if(s)return v(),()=>{g.current++,_.current?.(),_.current=null}},[s,v,l]);let y=(0,U.useCallback)(()=>{v()},[v]);return(0,U.useEffect)(()=>()=>{_.current?.(),_.current=null},[]),{data:u,loading:f,error:m,refetch:y}}function Ye(e){return e>=.9?`bg-success/15 border-success/40`:e>=.7?`bg-info/15 border-info/40`:e>=.4?`bg-warning/10 border-warning/30`:`bg-muted/30 border-border/40`}function Xe(e){switch(e){case`scope_file`:return`scope: file`;case`scope_symbol`:return`scope: symbol`;case`anchor_file`:return`anchor: file`;case`anchor_symbol`:return`anchor: symbol`;case`anchor_directory`:return`anchor: directory`;case`mention`:return`text mention`}}function Ze({match:e,cursorBoosted:t,onShowMemory:n,onAcceptDeletion:r,onKeep:i,onUpdate:a,onMarkPermanent:o,onRecover:s,pendingAction:c}){let l=e.memory.status===`deleted`,d=e.memory.status===`superseded`,f=e.pendingReview,p=c!==void 0,g=t===!0;return(0,W.jsxs)(`article`,{className:P(`group relative rounded-md border px-3 py-2 text-sm transition-colors`,Ye(e.matchStrength),g&&`ring-1 ring-primary/40 ring-offset-0`,l&&`opacity-70`),"data-match-via":e.matchedVia,"data-memory-id":e.memory.id,children:[(0,W.jsx)(`header`,{className:`flex items-start justify-between gap-2`,children:(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] uppercase tracking-wide`,children:[(0,W.jsx)(`span`,{className:P(`font-mono`,De(e.memory.kind)),children:V[e.memory.kind]??e.memory.kind}),(0,W.jsx)(`span`,{className:`text-muted-foreground`,children:`·`}),(0,W.jsx)(`span`,{className:`font-mono text-muted-foreground`,children:Xe(e.matchedVia)}),g&&(0,W.jsxs)(`span`,{className:`flex items-center gap-0.5 rounded-sm bg-primary/15 px-1 py-0.5 font-mono text-primary`,title:`Cursor line range matches this memory's anchor`,children:[(0,W.jsx)(y,{className:`size-2.5`}),` cursor`]}),f&&(0,W.jsxs)(`span`,{className:`flex items-center gap-0.5 rounded-sm bg-warning/15 px-1 py-0.5 font-mono text-warning`,title:`Hygiene review: ${f.reason} (${f.ageDays}d old)`,children:[(0,W.jsx)(x,{className:`size-2.5`}),` review`]}),l&&(0,W.jsx)(`span`,{className:`font-mono text-destructive`,children:`deleted`}),d&&!l&&(0,W.jsx)(`span`,{className:`font-mono text-muted-foreground`,children:`superseded`})]}),(0,W.jsx)(`p`,{className:`mt-1 text-foreground/90`,children:Ee(e.memory.text,200)}),(0,W.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-[10px] text-muted-foreground`,children:[(0,W.jsx)(Oe,{status:e.memory.status}),(0,W.jsxs)(`span`,{children:[`updated `,Fe(e.memory.updatedAt)]})]})]})}),(0,W.jsxs)(`footer`,{className:`mt-2 flex flex-wrap items-center gap-1.5`,children:[l&&s&&(0,W.jsxs)(F,{type:`button`,size:`sm`,variant:`outline`,disabled:p,onClick:()=>s(e.memory.id),className:`h-7 gap-1 border-primary/40 px-2 text-[11px] text-primary hover:bg-primary/10`,title:`Restore this memory to active status (PR #1: memory_recover)`,children:[(0,W.jsx)(u,{className:`size-3`}),` Recover`]}),d&&e.supersededByActiveId&&n&&(0,W.jsxs)(F,{type:`button`,size:`sm`,variant:`outline`,disabled:p,onClick:()=>n(e.supersededByActiveId),className:`h-7 gap-1 px-2 text-[11px]`,title:`This version is superseded — jump to the active version`,children:[(0,W.jsx)(h,{className:`size-3`}),` Go to active`]}),f&&(0,W.jsxs)(W.Fragment,{children:[f.suggestedAction===`delete`&&(0,W.jsxs)(F,{type:`button`,size:`sm`,variant:`destructive`,disabled:p,onClick:()=>r?.(f.candidateId,e.memory.id),className:`h-7 gap-1 px-2 text-[11px]`,title:`Accept hygiene's deletion suggestion — memory will be forgotten`,children:[(0,W.jsx)(m,{className:`size-3`}),` Accept Deletion`]}),(0,W.jsxs)(F,{type:`button`,size:`sm`,variant:`outline`,disabled:p,onClick:()=>i?.(f.candidateId,e.memory.id),className:`h-7 gap-1 px-2 text-[11px]`,title:`Reject the suggestion — memory stays as-is and may be re-suggested later`,children:[(0,W.jsx)(b,{className:`size-3`}),` Keep`]}),(0,W.jsxs)(F,{type:`button`,size:`sm`,variant:`outline`,disabled:p,onClick:()=>a?.(e.memory.id),className:`h-7 gap-1 px-2 text-[11px]`,title:`Update the memory's content — versioning creates a new active record`,children:[(0,W.jsx)(k,{className:`size-3`}),` Update`]}),o&&(0,W.jsxs)(F,{type:`button`,size:`sm`,variant:`outline`,disabled:p,onClick:()=>o(e.memory.id),className:`h-7 gap-1 border-warning/40 px-2 text-[11px] text-warning hover:bg-warning/10`,title:"Promote to `permanent` — hygiene will never surface this again",children:[(0,W.jsx)(y,{className:`size-3`}),` Mark as Permanent`]})]}),n&&!l&&(0,W.jsxs)(F,{type:`button`,size:`sm`,variant:`ghost`,disabled:p,onClick:()=>n(e.memory.id),className:`h-7 gap-1 px-2 text-[11px] text-muted-foreground hover:text-foreground`,title:`Open the full record in MemoryManager`,children:[(0,W.jsx)(le,{className:`size-3`}),` Show full`]}),c&&(0,W.jsxs)(`span`,{className:`ml-auto flex items-center gap-1 text-[10px] text-muted-foreground`,children:[(0,W.jsx)(de,{className:`size-3 animate-spin`}),` `,c]})]})]})}function Qe({icon:e,title:t,count:n,matches:r,cursorBoosted:i=!1,...a}){if(r.length===0)return null;let o=r.slice(0,50),s=r.length-o.length;return(0,W.jsxs)(`section`,{className:`flex flex-col gap-1.5`,children:[(0,W.jsxs)(`h3`,{className:`flex items-center gap-1.5 px-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:[(0,W.jsx)(e,{className:`size-3`}),(0,W.jsx)(`span`,{children:t}),(0,W.jsxs)(`span`,{className:`font-mono`,children:[`(`,n,`)`]}),i&&(0,W.jsxs)(`span`,{className:`ml-auto flex items-center gap-0.5 font-mono text-[9px] text-primary`,children:[(0,W.jsx)(y,{className:`size-2.5`}),` cursor boost`]})]}),(0,W.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:o.map(e=>(0,W.jsx)(Ze,{match:e,cursorBoosted:i&&(e.matchedVia===`anchor_symbol`||e.matchedVia===`scope_symbol`),pendingAction:a.pendingActionById.get(e.memory.id),...a},e.memory.id))}),s>0&&(0,W.jsxs)(`p`,{className:`px-1 text-[10px] text-muted-foreground`,children:[`+`,s,` more — refine the cursor or limit to narrow.`]})]})}function $e({filePath:e,lineStart:t,lineEnd:n,open:r,onClose:i,onShowMemory:a,onAcceptDeletion:s,onKeep:c,onUpdate:l,onMarkPermanent:d,onRecover:f}){let[p,m]=(0,U.useState)(!1),[h,g]=(0,U.useState)(new Map),{data:_,loading:v,error:b,refetch:S}=Je({filePath:e,lineStart:t,lineEnd:n,showDeleted:p,autoFetch:r}),C=t!==void 0&&n!==void 0,w=(0,U.useCallback)(async(e,t,n)=>{if(n){g(n=>new Map(n).set(e,t));try{await n(e)}finally{g(t=>{let n=new Map(t);return n.delete(e),n})}}},[]);if((0,U.useEffect)(()=>{m(!1)},[e]),!r)return null;let E=_,te=E?.totalCount??0;return(0,W.jsxs)(`aside`,{className:`flex h-full min-h-0 w-full flex-col border-l border-border/70 bg-card/15`,"aria-label":`File memory drawer`,"data-file-path":e??``,children:[(0,W.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-border/60 px-3 py-2`,children:[(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] uppercase tracking-wide text-muted-foreground`,children:[(0,W.jsx)(T,{className:`size-3`}),(0,W.jsx)(`span`,{className:`truncate font-mono`,title:e??``,children:e??`(no file)`})]}),(0,W.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-2 text-[10px] text-muted-foreground`,children:[(0,W.jsxs)(`span`,{className:`font-mono`,children:[te,` memories`]}),E&&E.reviewPendingCount>0&&(0,W.jsxs)(`span`,{className:`flex items-center gap-0.5 font-mono text-warning`,children:[(0,W.jsx)(x,{className:`size-3`}),E.reviewPendingCount,` pending review`]}),E&&E.supersededCount>0&&(0,W.jsxs)(`span`,{className:`font-mono`,children:[E.supersededCount,` superseded`]})]})]}),(0,W.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,W.jsx)(F,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>S(),disabled:v||!e,className:`h-7 w-7 p-0`,"aria-label":`Refresh`,title:`Re-query for this file`,children:(0,W.jsx)(u,{className:P(`size-3.5`,v&&`animate-spin`)})}),(0,W.jsx)(F,{type:`button`,size:`sm`,variant:`ghost`,onClick:i,className:`h-7 w-7 p-0`,"aria-label":`Close drawer`,title:`Close memory drawer`,children:(0,W.jsx)(o,{className:`size-3.5`})})]})]}),(0,W.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-border/40 bg-background/40 px-3 py-1.5 text-[10px] text-muted-foreground`,children:[(0,W.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-1.5`,children:[(0,W.jsx)(`input`,{type:`checkbox`,checked:p,onChange:e=>m(e.target.checked),className:`size-3 accent-primary`,disabled:!e,"data-testid":`memory-drawer-show-deleted`}),p?(0,W.jsx)(le,{className:`size-3`}):(0,W.jsx)(ee,{className:`size-3`}),(0,W.jsx)(`span`,{children:`Show recoverable (deleted)`})]}),C&&(0,W.jsxs)(`span`,{className:`ml-auto flex items-center gap-1 font-mono text-[10px] text-primary`,children:[(0,W.jsx)(y,{className:`size-3`}),` lines `,t,`–`,n]})]}),(0,W.jsx)(`div`,{className:`flex-1 overflow-y-auto px-3 py-3`,children:e?v&&!E?(0,W.jsx)(et,{loading:!0,message:`Loading memories…`}):b?(0,W.jsx)(et,{tone:`error`,message:`Error: ${b}`}):!E||te===0?(0,W.jsx)(et,{message:`No memories attached to ${e} yet.`}):(0,W.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,W.jsx)(Qe,{icon:y,title:`Cursor boost`,count:E.symbolMatches.length,cursorBoosted:C,matches:E.symbolMatches,pendingActionById:h,onShowMemory:a,onAcceptDeletion:(e,t)=>w(t,`accepting…`,()=>s?.(e,t)),onKeep:(e,t)=>w(t,`keeping…`,()=>c?.(e,t)),onUpdate:e=>w(e,`updating…`,()=>l?.(e)),onMarkPermanent:e=>w(e,`marking…`,()=>d?.(e)),onRecover:e=>w(e,`recovering…`,()=>f?.(e))}),(0,W.jsx)(Qe,{icon:T,title:`File-scoped`,count:E.primaryMatches.length,matches:E.primaryMatches,pendingActionById:h,onShowMemory:a,onAcceptDeletion:(e,t)=>w(t,`accepting…`,()=>s?.(e,t)),onKeep:(e,t)=>w(t,`keeping…`,()=>c?.(e,t)),onUpdate:e=>w(e,`updating…`,()=>l?.(e)),onMarkPermanent:e=>w(e,`marking…`,()=>d?.(e)),onRecover:e=>w(e,`recovering…`,()=>f?.(e))}),(0,W.jsx)(Qe,{icon:le,title:`Mentioned in`,count:E.relatedMatches.length,matches:E.relatedMatches,pendingActionById:h,onShowMemory:a,onAcceptDeletion:(e,t)=>w(t,`accepting…`,()=>s?.(e,t)),onKeep:(e,t)=>w(t,`keeping…`,()=>c?.(e,t)),onUpdate:e=>w(e,`updating…`,()=>l?.(e)),onMarkPermanent:e=>w(e,`marking…`,()=>d?.(e)),onRecover:e=>w(e,`recovering…`,()=>f?.(e))})]}):(0,W.jsx)(et,{message:`Open a file to see its memories.`})})]})}function et({message:e,loading:t=!1,tone:n=`default`}){return(0,W.jsxs)(`div`,{className:P(`flex min-h-[120px] flex-col items-center justify-center gap-2 rounded-md border border-dashed border-border/60 px-4 py-6 text-center text-[11px]`,n===`error`?`text-destructive`:`text-muted-foreground`),children:[t&&(0,W.jsx)(de,{className:`size-4 animate-spin`}),(0,W.jsx)(`p`,{children:e})]})}function tt({mode:e,draft:t,busy:n,error:r,onChange:o,onCancel:s,onSubmit:c}){let l=(0,U.useRef)(null);(0,U.useEffect)(()=>{l.current?.focus()},[]);let u=(e,n)=>{o({...t,[e]:n})},d=()=>{u(`anchors`,[...t.anchors,{type:`file`,path:``}])};return(0,W.jsxs)(`form`,{className:`flex min-h-0 flex-1 flex-col`,onSubmit:e=>{e.preventDefault(),c()},"aria-busy":n,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-b border-border/70 bg-card/70 px-4 py-3 backdrop-blur-xl`,children:[(0,W.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,W.jsx)(`span`,{className:`flex size-8 items-center justify-center border border-info/35 bg-info/10 text-info`,children:e===`create`?(0,W.jsx)(k,{className:`size-4`}):(0,W.jsx)(M,{className:`size-4`})}),(0,W.jsxs)(`div`,{className:`min-w-0`,children:[(0,W.jsx)(`p`,{className:`truncate text-sm font-bold`,children:e===`create`?`Capture a memory`:`Edit memory`}),(0,W.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:e===`create`?`Add durable knowledge with retrieval metadata.`:`Update content without losing provenance.`})]})]}),(0,W.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,W.jsxs)(F,{type:`button`,variant:`ghost`,size:`sm`,onClick:s,disabled:n,children:[(0,W.jsx)(b,{className:`size-3.5`}),` Cancel`]}),(0,W.jsxs)(F,{type:`submit`,size:`sm`,disabled:n||!t.text.trim(),children:[n?(0,W.jsx)(de,{className:`size-3.5 animate-spin`}):e===`create`?(0,W.jsx)(oe,{className:`size-3.5`}):(0,W.jsx)(a,{className:`size-3.5`}),n?`Saving…`:e===`create`?`Create memory`:`Save changes`]})]})]}),(0,W.jsx)(`div`,{className:`flex-1 overflow-y-auto overscroll-contain p-4 md:p-5`,children:(0,W.jsxs)(`div`,{className:`mx-auto max-w-4xl space-y-5`,children:[r&&(0,W.jsxs)(`div`,{role:`alert`,className:`flex items-start gap-2 border border-destructive/40 bg-destructive/10 px-3 py-2.5 text-sm text-destructive`,children:[(0,W.jsx)(x,{className:`mt-0.5 size-4 shrink-0`}),(0,W.jsx)(`span`,{children:r})]}),(0,W.jsxs)(`section`,{className:`border border-border/75 bg-card/45 p-4`,children:[(0,W.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`h3`,{className:`text-xs font-bold uppercase tracking-[0.14em]`,children:`Knowledge`}),(0,W.jsx)(`p`,{className:`mt-1 text-[10px] text-muted-foreground`,children:`Write the durable fact or decision in complete, searchable language.`})]}),(0,W.jsxs)(`span`,{className:`font-mono text-[10px] text-muted-foreground tabular-nums`,children:[t.text.length,` chars`]})]}),(0,W.jsx)(`label`,{htmlFor:`memory-text`,className:`sr-only`,children:`Memory content`}),(0,W.jsx)(`textarea`,{ref:l,id:`memory-text`,value:t.text,onChange:e=>u(`text`,e.target.value),rows:7,required:!0,placeholder:`Example: WebUI state is owned by Zustand stores; server messages update those stores through singleton WebSocket handlers.`,className:`min-h-36 w-full resize-y border border-input bg-background/75 px-3 py-3 text-sm leading-6 text-foreground shadow-inner placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`})]}),(0,W.jsxs)(`section`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:[(0,W.jsxs)(`div`,{className:`min-w-0`,children:[(0,W.jsx)(`label`,{htmlFor:`memory-kind`,className:`mb-1.5 block text-[10px] font-bold uppercase tracking-[0.14em] text-muted-foreground`,children:`Kind`}),(0,W.jsx)(`select`,{id:`memory-kind`,value:t.kind,onChange:e=>u(`kind`,e.target.value),className:`h-10 w-full border border-input bg-background px-3 text-sm`,children:z.map(e=>(0,W.jsx)(`option`,{value:e,children:V[e]},e))})]}),e===`create`?(0,W.jsxs)(`div`,{className:`min-w-0`,children:[(0,W.jsx)(`label`,{htmlFor:`memory-scope`,className:`mb-1.5 block text-[10px] font-bold uppercase tracking-[0.14em] text-muted-foreground`,children:`Scope`}),(0,W.jsx)(`select`,{id:`memory-scope`,value:t.scope,onChange:e=>u(`scope`,e.target.value),className:`h-10 w-full border border-input bg-background px-3 text-sm`,children:L.map(e=>(0,W.jsx)(`option`,{value:e,children:e},e))})]}):(0,W.jsxs)(`div`,{className:`min-w-0`,children:[(0,W.jsx)(`label`,{htmlFor:`memory-status`,className:`mb-1.5 block text-[10px] font-bold uppercase tracking-[0.14em] text-muted-foreground`,children:`Lifecycle status`}),(0,W.jsx)(`select`,{id:`memory-status`,value:t.status,onChange:e=>u(`status`,e.target.value),className:`h-10 w-full border border-input bg-background px-3 text-sm`,children:ke.map(e=>(0,W.jsx)(`option`,{value:e,children:e},e))})]}),(0,W.jsxs)(`div`,{className:P(`min-w-0`,e===`create`?`sm:col-span-2 lg:col-span-1`:``),children:[(0,W.jsx)(`label`,{htmlFor:`memory-tags`,className:`mb-1.5 block text-[10px] font-bold uppercase tracking-[0.14em] text-muted-foreground`,children:`Tags`}),(0,W.jsx)(I,{id:`memory-tags`,value:t.tags,onChange:e=>u(`tags`,e.target.value),placeholder:`architecture, webui, workflow`,className:`h-10 bg-background`})]})]}),(0,W.jsxs)(`section`,{className:`grid gap-3 sm:grid-cols-3`,children:[(0,W.jsx)(R,{id:`memory-importance`,label:`Importance`,value:t.importance,onChange:e=>u(`importance`,e)}),(0,W.jsx)(R,{id:`memory-confidence`,label:`Confidence`,value:t.confidence,onChange:e=>u(`confidence`,e)}),(0,W.jsx)(R,{id:`memory-freshness`,label:`Freshness`,value:t.freshness,onChange:e=>u(`freshness`,e)})]}),(0,W.jsxs)(`section`,{className:`border border-border/75 bg-card/45 p-4`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`h3`,{className:`text-xs font-bold uppercase tracking-[0.14em]`,children:`Anchors`}),(0,W.jsx)(`p`,{className:`mt-1 text-[10px] text-muted-foreground`,children:`Bind knowledge to files, symbols, packages, tests, Git paths, or commands.`})]}),(0,W.jsxs)(F,{type:`button`,variant:`outline`,size:`sm`,onClick:d,children:[(0,W.jsx)(oe,{className:`size-3.5`}),` Add anchor`]})]}),t.anchors.length===0?(0,W.jsxs)(`button`,{type:`button`,onClick:d,className:`mt-4 flex w-full items-center justify-center gap-2 border border-dashed border-border px-4 py-7 text-xs text-muted-foreground transition-colors hover:border-info/50 hover:bg-info/5 hover:text-info`,children:[(0,W.jsx)(i,{className:`size-4`}),` No anchors yet — add one to improve retrieval precision`]}):(0,W.jsx)(`div`,{className:`mt-4 space-y-2`,children:t.anchors.map((e,n)=>(0,W.jsxs)(`div`,{className:`grid gap-2 border border-border/65 bg-background/40 p-2 sm:grid-cols-[9rem_minmax(0,1fr)_auto]`,children:[(0,W.jsxs)(`label`,{className:`sr-only`,htmlFor:`anchor-type-${n}`,children:[`Anchor `,n+1,` type`]}),(0,W.jsx)(`select`,{id:`anchor-type-${n}`,value:e.type,onChange:e=>{let r=e.target.value,i=r===`command`?{type:r,command:``}:{type:r,path:``};u(`anchors`,t.anchors.map((e,t)=>t===n?i:e))},className:`h-10 border border-input bg-background px-2 text-xs`,children:Ne.map(e=>(0,W.jsx)(`option`,{value:e,children:e},e))}),(0,W.jsxs)(`div`,{className:P(`grid min-w-0 gap-2`,e.type===`symbol`&&`sm:grid-cols-[minmax(0,1fr)_11rem]`),children:[(0,W.jsxs)(`label`,{className:`sr-only`,htmlFor:`anchor-value-${n}`,children:[`Anchor `,n+1,` value`]}),(0,W.jsx)(I,{id:`anchor-value-${n}`,value:Pe(e),onChange:e=>{u(`anchors`,t.anchors.map((t,r)=>r===n?Ce(t,e.target.value):t))},placeholder:e.type===`command`?`pnpm test --filter webui`:`packages/webui/src/App.tsx`,className:`h-10 min-w-0 bg-background font-mono text-xs`}),e.type===`symbol`&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`label`,{className:`sr-only`,htmlFor:`anchor-symbol-${n}`,children:[`Anchor `,n+1,` symbol`]}),(0,W.jsx)(I,{id:`anchor-symbol-${n}`,value:e.symbol??``,onChange:e=>{u(`anchors`,t.anchors.map((t,r)=>r===n?{...t,symbol:e.target.value}:t))},placeholder:`Symbol name`,className:`h-10 bg-background font-mono text-xs`})]})]}),(0,W.jsx)(F,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":`Remove anchor ${n+1}`,onClick:()=>u(`anchors`,t.anchors.filter((e,t)=>t!==n)),children:(0,W.jsx)(ue,{className:`size-4 text-destructive`})})]},`${e.type}:${n}`))})]}),(0,W.jsxs)(`section`,{className:`grid gap-3 border border-border/75 bg-card/45 p-4 sm:grid-cols-2`,children:[(0,W.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,W.jsx)(`h3`,{className:`text-xs font-bold uppercase tracking-[0.14em]`,children:`Relationships`}),(0,W.jsx)(`p`,{className:`mt-1 text-[10px] text-muted-foreground`,children:`Reference exact memory IDs. Relationships are validated and graph edges are rebuilt by Super Memory.`})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`label`,{htmlFor:`memory-supersedes`,className:`mb-1.5 block text-[10px] font-bold uppercase tracking-[0.14em] text-muted-foreground`,children:`Supersedes`}),(0,W.jsx)(I,{id:`memory-supersedes`,value:t.supersedes,onChange:e=>u(`supersedes`,e.target.value),placeholder:`mem_id, mem_id`,className:`h-10 bg-background font-mono text-xs`})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`label`,{htmlFor:`memory-contradicts`,className:`mb-1.5 block text-[10px] font-bold uppercase tracking-[0.14em] text-muted-foreground`,children:`Contradicts`}),(0,W.jsx)(I,{id:`memory-contradicts`,value:t.contradicts,onChange:e=>u(`contradicts`,e.target.value),placeholder:`mem_id, mem_id`,className:`h-10 bg-background font-mono text-xs`})]})]}),(0,W.jsxs)(`section`,{className:`space-y-2`,children:[(0,W.jsx)(`h3`,{className:`text-[10px] font-bold uppercase tracking-[0.14em] text-muted-foreground`,children:`Audience (Optional)`}),(0,W.jsx)(`p`,{className:`text-[10px] text-muted-foreground/70`,children:`Target this memory to specific agent types. Leave empty for general project memory.`}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`label`,{htmlFor:`memory-audience-roles`,className:`mb-1.5 block text-[10px] font-bold uppercase tracking-[0.14em] text-muted-foreground`,children:`Roles`}),(0,W.jsx)(I,{id:`memory-audience-roles`,value:t.audienceRoles,onChange:e=>u(`audienceRoles`,e.target.value),placeholder:`reviewer, refactor-planner`,className:`h-9 bg-background font-mono text-xs`})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`label`,{htmlFor:`memory-audience-task-types`,className:`mb-1.5 block text-[10px] font-bold uppercase tracking-[0.14em] text-muted-foreground`,children:`Task types`}),(0,W.jsx)(I,{id:`memory-audience-task-types`,value:t.audienceTaskTypes,onChange:e=>u(`audienceTaskTypes`,e.target.value),placeholder:`review, refactor, bugfix`,className:`h-9 bg-background font-mono text-xs`})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`label`,{htmlFor:`memory-audience-modes`,className:`mb-1.5 block text-[10px] font-bold uppercase tracking-[0.14em] text-muted-foreground`,children:`Modes`}),(0,W.jsx)(I,{id:`memory-audience-modes`,value:t.audienceModes,onChange:e=>u(`audienceModes`,e.target.value),placeholder:`teach, code-review`,className:`h-9 bg-background font-mono text-xs`})]})]})]})})]})}function nt({searchQuery:e,statusFilter:t,kindFilter:r,audienceOnly:i,tagFilter:a,hasFilters:o,allTags:s,stats:l,onSearchChange:u,onStatusFilterChange:d,onKindFilterChange:m,onToggleAudienceOnly:h,onTagFilterChange:g,onClearFilters:_}){return(0,W.jsxs)(`div`,{className:`shrink-0 space-y-2 overflow-hidden border-b border-border/70 bg-card/45 p-3`,children:[(0,W.jsxs)(`div`,{className:`flex gap-2`,children:[(0,W.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,W.jsx)(p,{className:`pointer-events-none absolute left-3 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground`}),(0,W.jsx)(I,{"aria-label":`Search memories`,value:e,onChange:e=>u(e.target.value),placeholder:`Search content, IDs, tags, anchors…`,className:`h-10 min-w-0 bg-background pl-9 pr-8 text-xs`}),e&&(0,W.jsx)(`button`,{type:`button`,"aria-label":`Clear search`,onClick:()=>u(``),className:`absolute right-2 top-1/2 -translate-y-1/2 p-1 text-muted-foreground hover:text-foreground`,children:(0,W.jsx)(b,{className:`size-3.5`})})]}),(0,W.jsx)(F,{variant:i?`default`:`ghost`,size:`icon`,onClick:h,"aria-label":`Filter audience-scoped only`,title:`Show only audience-scoped memories`,className:`shrink-0`,children:(0,W.jsx)(c,{className:`size-4`})}),o&&(0,W.jsx)(F,{variant:`ghost`,size:`icon`,onClick:_,"aria-label":`Clear all filters`,title:`Clear all filters`,children:(0,W.jsx)(n,{className:`size-4`})})]}),(0,W.jsxs)(`div`,{className:`grid gap-2`,children:[(0,W.jsx)(`label`,{className:`sr-only`,htmlFor:`memory-status-filter`,children:`Filter by status`}),(0,W.jsxs)(`select`,{id:`memory-status-filter`,value:t,onChange:e=>d(e.target.value),className:`h-9 min-w-0 border border-input bg-background px-2 text-xs`,children:[(0,W.jsx)(`option`,{value:`all`,children:`All statuses`}),Ae.map(e=>(0,W.jsxs)(`option`,{value:e,children:[e,` · `,l?.byStatus[e]??0]},e))]}),(0,W.jsx)(`label`,{className:`sr-only`,htmlFor:`memory-kind-filter`,children:`Filter by kind`}),(0,W.jsxs)(`select`,{id:`memory-kind-filter`,value:r,onChange:e=>m(e.target.value),className:`h-9 min-w-0 border border-input bg-background px-2 text-xs`,children:[(0,W.jsx)(`option`,{value:`all`,children:`All kinds`}),z.map(e=>(0,W.jsxs)(`option`,{value:e,children:[V[e],` · `,l?.byKind[e]??0]},e))]})]}),s.length>0&&(0,W.jsxs)(`fieldset`,{className:`min-w-0 border-0 p-0`,children:[(0,W.jsx)(`legend`,{className:`sr-only`,children:`Popular tags`}),(0,W.jsx)(`div`,{className:`no-scrollbar flex gap-1.5 overflow-x-auto pb-0.5`,children:s.slice(0,18).map(([e,t])=>(0,W.jsxs)(`button`,{type:`button`,"aria-pressed":a===e,onClick:()=>g(a===e?null:e),className:P(`flex shrink-0 items-center gap-1 border px-2 py-1 text-[10px] transition-colors`,a===e?`border-info/55 bg-info/10 text-info`:`border-border/70 bg-background/45 text-muted-foreground hover:border-info/35 hover:text-foreground`),children:[(0,W.jsx)(f,{className:`size-2.5`}),` `,e,(0,W.jsx)(`span`,{className:`font-mono opacity-60`,children:t})]},e))})]})]})}var rt=100;function it({memoryListRef:e,memories:t,filteredMemories:n,selectedId:r,onSelectMemory:i,onOpenCreate:a,onClearFilters:o}){let s=n.length>rt,c=ie({count:n.length,getScrollElement:()=>e.current,estimateSize:()=>100,overscan:8,enabled:s});return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-border/60 px-3 py-2 text-[10px] text-muted-foreground`,children:[(0,W.jsxs)(`span`,{children:[n.length,` of `,t.length,` memories`]}),(0,W.jsx)(`span`,{className:`font-mono uppercase`,children:`updated ↓`})]}),(0,W.jsx)(`section`,{ref:e,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,"aria-label":`Memories`,children:n.length===0?(0,W.jsx)(at,{hasMemories:t.length>0,onOpenCreate:a,onClearFilters:o}):s?(0,W.jsx)(`div`,{style:{height:`${c.getTotalSize()}px`,width:`100%`,position:`relative`},children:c.getVirtualItems().map(e=>{let t=n[e.index];return t?(0,W.jsx)(`div`,{"data-index":e.index,ref:c.measureElement,style:{position:`absolute`,top:0,left:0,width:`100%`,transform:`translateY(${e.start}px)`},children:(0,W.jsx)(ot,{memory:t,isSelected:r===t.id,onClick:()=>i(t.id)})},t.id):null})}):n.map(e=>(0,W.jsx)(ot,{memory:e,isSelected:r===e.id,onClick:()=>i(e.id)},e.id))})]})}function at({hasMemories:e,onOpenCreate:t,onClearFilters:i}){return(0,W.jsxs)(`div`,{className:`flex min-h-64 flex-col items-center justify-center px-6 text-center`,children:[(0,W.jsx)(`span`,{className:`flex size-12 items-center justify-center border border-dashed border-border text-muted-foreground`,children:(0,W.jsx)(r,{className:`size-5`})}),(0,W.jsx)(`h2`,{className:`mt-4 text-sm font-bold`,children:e?`No matching memories`:`Build your memory graph`}),(0,W.jsx)(`p`,{className:`mt-1 max-w-xs text-xs leading-5 text-muted-foreground`,children:e?`Change the filters or clear the search query.`:`Capture durable facts, decisions, conventions, and file-bound notes for every agent.`}),(0,W.jsxs)(F,{className:`mt-4`,variant:`outline`,size:`sm`,onClick:e?i:t,children:[e?(0,W.jsx)(n,{className:`size-3.5`}):(0,W.jsx)(oe,{className:`size-3.5`}),e?`Clear filters`:`Create first memory`]})]})}function ot({memory:e,isSelected:t,onClick:n}){return(0,W.jsxs)(`button`,{type:`button`,"aria-current":t?`true`:void 0,onClick:n,className:P(`group relative block w-full border-b border-border/55 px-3 py-3 text-left transition-[background-color,border-color] hover:bg-info/5`,t&&`bg-info/8`),children:[t&&(0,W.jsx)(`span`,{className:`absolute inset-y-0 left-0 w-0.5 bg-info shadow-[0_0_10px_hsl(var(--info)/0.7)]`}),(0,W.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,W.jsx)(`span`,{className:P(`truncate text-[10px] font-bold uppercase tracking-[0.1em]`,De(e.kind)),children:V[e.kind]??e.kind}),(0,W.jsx)(Oe,{status:e.status}),(0,W.jsxs)(`span`,{className:`ml-auto shrink-0 font-mono text-[9px] text-muted-foreground`,children:[`r`,e.revision]})]}),(0,W.jsx)(`p`,{className:P(`mt-2 line-clamp-2 text-xs leading-5 text-foreground/90`,e.status===`deleted`&&`line-through opacity-60`),children:Ee(e.text)}),(0,W.jsxs)(`div`,{className:`mt-2 flex min-w-0 items-center gap-1.5`,children:[(0,W.jsx)(`span`,{className:`border border-border/60 bg-background/50 px-1.5 py-0.5 font-mono text-[9px] uppercase text-muted-foreground`,children:e.scope}),e.audience&&(0,W.jsxs)(`span`,{className:`flex items-center gap-0.5 border border-primary/30 bg-primary/10 px-1.5 py-0.5 font-mono text-[9px] text-primary`,children:[(0,W.jsx)(c,{className:`size-2.5`}),(e.audience.roles??e.audience.taskTypes??e.audience.modes??[]).slice(0,1)[0]??`scoped`]}),e.tags.slice(0,2).map(e=>(0,W.jsxs)(`span`,{className:`max-w-24 truncate border border-border/60 px-1.5 py-0.5 font-mono text-[9px] text-muted-foreground`,children:[`#`,e]},e)),e.tags.length>2&&(0,W.jsxs)(`span`,{className:`font-mono text-[9px] text-muted-foreground`,children:[`+`,e.tags.length-2]}),(0,W.jsx)(`span`,{className:`ml-auto shrink-0 text-[9px] text-muted-foreground`,children:Fe(e.updatedAt)}),(0,W.jsx)(d,{className:`size-3 shrink-0 text-muted-foreground transition-transform group-hover:translate-x-0.5 group-hover:text-info`})]})]})}function st(){let{client:e,listSuperMemories:t,rememberSuperMemory:n,updateSuperMemory:r,deleteSuperMemory:i,recoverSuperMemory:a,resolveMemoryCandidate:o,backfillRecoverable:s}=_e(),l=ve(e=>e.wsConnected),d=fe(e=>e.setCurrentView),f=ye(`memory`),[p,h]=(0,U.useState)([]),[g,_]=(0,U.useState)(null),[ee,v]=(0,U.useState)(!0),[y,b]=(0,U.useState)(!1),[S,C]=(0,U.useState)(null),[w,T]=(0,U.useState)(null),[E,D]=(0,U.useState)(null),[ne,O]=(0,U.useState)(null),[ie,k]=(0,U.useState)(!1),[ae,A]=(0,U.useState)(!1),[j,M]=(0,U.useState)(Te),[se,le]=(0,U.useState)(Te),[N,I]=(0,U.useState)(null),[L,Ce]=(0,U.useState)(null),[R,De]=(0,U.useState)(``),[z,Oe]=(0,U.useState)(`all`),[B,ke]=(0,U.useState)(`all`),[Ae,je]=(0,U.useState)(!1),[V,Ne]=(0,U.useState)(null),[Pe,Fe]=(0,U.useState)(!1),[G,Ie]=(0,U.useState)(null),[Le,Re]=(0,U.useState)(void 0),[ze,Be]=(0,U.useState)(void 0),Ve=(0,U.useRef)(!1),K=(0,U.useRef)(!0),He=(0,U.useRef)(0),q=(0,U.useRef)(0),J=(0,U.useRef)(null),Y=(0,U.useRef)(null),We=(0,U.useMemo)(()=>JSON.stringify(j)!==JSON.stringify(se),[se,j]),X=(0,U.useMemo)(()=>p.find(e=>e.id===ne)??null,[p,ne]),Z=(0,U.useCallback)(()=>{let n=++He.current;J.current?.(),b(!0),C(null),Ve.current||v(!0);let r=()=>{},i=null,a=!1,o=()=>{a||(a=!0,i!==null&&clearTimeout(i),r(),J.current===o&&(J.current=null))};r=e.on(`memory.super.list`,e=>{if(n!==He.current||!K.current){o();return}if(o(),e.payload.error)C(e.payload.error);else{let t=e.payload.memories??[];h(t),_(e.payload.stats??null),Ve.current=!0,O(e=>e&&t.some(t=>t.id===e)?e:null)}v(!1),b(!1)}),i=setTimeout(()=>{n!==He.current||!K.current||(o(),C(`The memory store did not respond. Check the WebSocket connection and try again.`),v(!1),b(!1))},2e4),J.current=o,t({echoToChat:!1})},[e,t]);(0,U.useEffect)(()=>(K.current=!0,Z(),()=>{K.current=!1,He.current+=1,q.current+=1,J.current?.(),Y.current?.()}),[Z]);let Ge=(0,U.useRef)(l);(0,U.useEffect)(()=>{l&&!Ge.current&&Ve.current&&Z(),Ge.current=l},[Z,l]),(0,U.useEffect)(()=>{if(!E)return;let e=setTimeout(()=>D(null),4e3);return()=>clearTimeout(e)},[E]);let Q=(0,U.useCallback)(()=>!We||!ie&&!ae?!0:window.confirm(`Discard the unsaved memory changes?`),[ae,We,ie]),Ke=(0,U.useCallback)(()=>{if(!Q())return;let e=Te();M(e),le(e),A(!0),k(!1),O(null),T(null)},[Q]),qe=(0,U.useCallback)(e=>{Q()&&(O(e),A(!1),k(!1),T(null))},[Q]),Je=(0,U.useCallback)(()=>{if(!X||X.status===`deleted`)return;let e=we(X);M(e),le(e),k(!0),A(!1),T(null)},[X]),Ye=(0,U.useCallback)(()=>{Q()&&(k(!1),A(!1),T(null))},[Q]),Xe=(0,U.useCallback)((t,n,r)=>{if(!j.text.trim()){T(`Memory content is required.`);return}let i=++q.current;Y.current?.(),I(r),T(null),D(null);let a=()=>{},o=null,s=!1,c=()=>{s||(s=!0,o!==null&&clearTimeout(o),a(),Y.current===c&&(Y.current=null))},l=e=>{if(i!==q.current||!K.current){c();return}if(c(),I(null),e.payload.error||!e.payload.memory){T(e.payload.error??`The server returned no memory record.`);return}let t=e.payload.memory;h(e=>[t,...e.filter(e=>e.id!==t.id)]),O(t.id),A(!1),k(!1),D(r===`create`?`Memory captured.`:`Memory updated.`),Z()};a=t===`memory.super.remember`?e.on(`memory.super.remember`,l):e.on(`memory.super.update`,l),o=setTimeout(()=>{i!==q.current||!K.current||(c(),I(null),T(`${r===`create`?`Create`:`Save`} timed out. Your draft is still here.`))},2e4),Y.current=c,n()},[e,j.text,Z]),Ze=(0,U.useCallback)(()=>{Xe(`memory.super.remember`,()=>n({text:j.text.trim(),kind:j.kind,scope:j.scope,tags:H(j.tags),importance:j.importance,confidence:j.confidence,freshness:j.freshness,anchors:Se(j.anchors),...H(j.audienceRoles).length||H(j.audienceTaskTypes).length||H(j.audienceModes).length?{audience:{roles:H(j.audienceRoles),taskTypes:H(j.audienceTaskTypes),modes:H(j.audienceModes)}}:{},supersedes:H(j.supersedes),contradicts:H(j.contradicts)},{echoToChat:!1}),`create`)},[j,n,Xe]),Qe=(0,U.useCallback)(()=>{X&&Xe(`memory.super.update`,()=>r(X.id,{text:j.text.trim(),kind:j.kind,status:j.status,tags:H(j.tags),importance:j.importance,confidence:j.confidence,freshness:j.freshness,anchors:Se(j.anchors),...H(j.audienceRoles).length||H(j.audienceTaskTypes).length||H(j.audienceModes).length?{audience:{roles:H(j.audienceRoles),taskTypes:H(j.audienceTaskTypes),modes:H(j.audienceModes)}}:{},supersedes:H(j.supersedes),contradicts:H(j.contradicts)},{echoToChat:!1}),`update`)},[j,Xe,X,r]),et=(0,U.useCallback)(()=>{if(!L)return;let t=++q.current;Y.current?.(),I(`delete`),T(null);let n=()=>{},r=null,a=!1,o=()=>{a||(a=!0,r!==null&&clearTimeout(r),n(),Y.current===o&&(Y.current=null))};n=e.on(`memory.super.delete`,e=>{if(t!==q.current||!K.current){o();return}if(o(),I(null),!e.payload.success){T(e.payload.message||`Delete failed.`);return}Ce(null),O(null),k(!1),D(`Memory deleted and relationship edges cleaned up.`),Z()}),r=setTimeout(()=>{t!==q.current||!K.current||(o(),I(null),T(`Delete timed out. The memory may still exist; refresh to confirm.`))},2e4),Y.current=o,i(L,`Deleted from the WebUI Memory Manager.`)},[e,i,L,Z]),rt=(0,U.useMemo)(()=>{let e=R.trim().toLowerCase();return p.filter(t=>{if(z!==`all`&&t.status!==z||B!==`all`&&t.kind!==B||V&&!t.tags.includes(V)||Ae&&!t.audience)return!1;if(!e)return!0;let n=t.anchors.map(e=>[e.path,e.symbol,e.command].filter(Boolean).join(` `)).join(` `),r=t.audience?[t.audience.roles?.join(` `)??``,t.audience.taskTypes?.join(` `)??``,t.audience.modes?.join(` `)??``].join(` `):``;return[t.id,t.text,t.summary??``,t.kind,t.scope,t.tags.join(` `),n,r].join(` `).toLowerCase().includes(e)})},[Ae,B,p,R,z,V]),at=(0,U.useMemo)(()=>{let e=new Map;for(let t of p)for(let n of t.tags)e.set(n,(e.get(n)??0)+1);return[...e.entries()].sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0]))},[p]),ot=(0,U.useMemo)(()=>{if(!X)return[];let e=[];X.supersededBy&&e.push({relation:`Superseded by`,id:X.supersededBy});for(let t of X.supersedes??[])e.push({relation:`Supersedes`,id:t});for(let t of X.contradicts??[])e.push({relation:`Contradicts`,id:t});return e},[X]),st=(0,U.useCallback)(()=>{De(``),Oe(`all`),ke(`all`),je(!1),Ne(null)},[]),lt=!!(R||z!==`all`||B!==`all`||V||Ae),ut=ae||!!X,$=Pe&&!!G;return ee&&p.length===0?(0,W.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-busy":`true`,children:[(0,W.jsxs)(`div`,{className:`border-b border-border/70 bg-card/70 px-5 py-4`,children:[(0,W.jsx)(`div`,{className:`h-3 w-28 animate-pulse bg-muted`}),(0,W.jsx)(`div`,{className:`mt-3 h-7 w-56 animate-pulse bg-muted`})]}),(0,W.jsxs)(`div`,{className:`grid flex-1 gap-px bg-border/60 md:grid-cols-[minmax(300px,0.82fr)_minmax(0,1.35fr)]`,children:[(0,W.jsx)(`div`,{className:`space-y-px bg-background p-4`,children:Array.from({length:7},(e,t)=>(0,W.jsx)(`div`,{className:`h-24 animate-pulse border border-border/60 bg-card/45`},t))}),(0,W.jsx)(`div`,{className:`hidden bg-background p-6 md:block`,children:(0,W.jsx)(`div`,{className:`h-full animate-pulse border border-border/60 bg-card/35`})})]}),(0,W.jsx)(`span`,{className:`sr-only`,role:`status`,children:`Loading Super Memory content`})]}):S&&p.length===0?(0,W.jsx)(`div`,{className:`flex h-full min-h-0 items-center justify-center bg-background p-6`,children:(0,W.jsxs)(`div`,{className:`max-w-md border border-destructive/35 bg-card p-6 shadow-2xl`,children:[(0,W.jsx)(`span`,{className:`flex size-11 items-center justify-center border border-destructive/35 bg-destructive/10 text-destructive`,children:(0,W.jsx)(x,{className:`size-5`})}),(0,W.jsx)(`h2`,{className:`mt-4 text-lg font-bold`,children:`Memory store unavailable`}),(0,W.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-muted-foreground`,children:S}),(0,W.jsxs)(`div`,{className:`mt-5 flex gap-2`,children:[(0,W.jsxs)(F,{onClick:Z,children:[(0,W.jsx)(u,{className:`size-4`}),` Retry`]}),(0,W.jsxs)(F,{variant:`outline`,onClick:()=>d(`chat`),children:[(0,W.jsx)(te,{className:`size-4`}),` Back to chat`]})]})]})}):(0,W.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden bg-background`,children:[(0,W.jsxs)(`header`,{className:`relative shrink-0 overflow-hidden border-b border-border/70 bg-card/72 px-4 py-3 backdrop-blur-xl sm:px-5`,children:[(0,W.jsx)(`div`,{className:`pointer-events-none absolute inset-y-0 right-0 w-1/2 bg-[radial-gradient(circle_at_right,hsl(var(--info)/0.11),transparent_68%)]`}),(0,W.jsxs)(`div`,{className:`relative flex flex-wrap items-center gap-3`,children:[(0,W.jsx)(F,{variant:`ghost`,size:`icon`,onClick:()=>d(`chat`),"aria-label":`Back to chat`,title:`Back to chat`,children:(0,W.jsx)(te,{className:`size-4`})}),(0,W.jsx)(`span`,{className:`flex size-10 items-center justify-center border border-info/40 bg-info/10 text-info shadow-[0_0_20px_hsl(var(--info)/0.12)]`,children:(0,W.jsx)(c,{className:`size-5`})}),(0,W.jsxs)(`div`,{className:`min-w-0`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,W.jsx)(`h1`,{className:`text-base font-bold sm:text-lg`,children:`Super Memory`}),(0,W.jsx)(`span`,{className:`border border-success/35 bg-success/10 px-2 py-0.5 font-mono text-[9px] font-bold uppercase text-success`,children:`project knowledge`})]}),(0,W.jsx)(`p`,{className:`mt-0.5 max-w-2xl text-[10px] text-muted-foreground sm:text-xs`,children:`Inspect, connect, curate, and retire durable context used across agent sessions.`})]}),(0,W.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,W.jsxs)(`span`,{className:P(`hidden items-center gap-1.5 border px-2 py-1 font-mono text-[9px] uppercase sm:flex`,l?`border-success/30 text-success`:`border-warning/30 text-warning`),children:[(0,W.jsx)(`span`,{className:`size-1.5 bg-current`}),` `,l?`live store`:`reconnecting`]}),(0,W.jsxs)(F,{variant:`outline`,size:`sm`,onClick:Z,disabled:y,"aria-label":`Refresh memories`,children:[(0,W.jsx)(u,{className:P(`size-3.5`,y&&`animate-spin`)}),(0,W.jsx)(`span`,{className:`hidden sm:inline`,children:`Refresh`})]}),(0,W.jsxs)(F,{size:`sm`,onClick:Ke,children:[(0,W.jsx)(oe,{className:`size-3.5`}),` New memory`]})]})]})]}),(0,W.jsxs)(`div`,{className:`grid shrink-0 grid-cols-2 gap-px border-b border-border/70 bg-border/60 sm:grid-cols-4`,children:[(0,W.jsx)(Me,{label:`Memories`,value:g?.total??p.length,hint:`${rt.length} visible`}),(0,W.jsx)(Me,{label:`Active`,value:g?.byStatus.active??p.filter(e=>e.status===`active`).length,hint:`retrievable`,tone:`success`}),(0,W.jsx)(Me,{label:`Needs review`,value:(g?.byStatus.stale??0)+(g?.byStatus.contradicted??0),hint:`stale + conflicts`,tone:`warning`}),(0,W.jsx)(`div`,{className:`hidden sm:block`,children:(0,W.jsx)(Me,{label:`Graph edges`,value:g?.edges??0,hint:`${at.length} tags`,tone:`info`})})]}),(()=>{let e=p.filter(e=>e.audience).length;if(e===0)return null;let t=new Set;for(let e of p)if(e.audience){for(let n of e.audience.roles??[])t.add(n);for(let n of e.audience.taskTypes??[])t.add(n);for(let n of e.audience.modes??[])t.add(n)}return(0,W.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-border/70 bg-primary/5 px-4 py-1.5`,children:[(0,W.jsx)(c,{className:`size-3.5 text-primary`}),(0,W.jsxs)(`span`,{className:`text-[11px] font-medium text-primary`,children:[e,` audience-scoped memory`,e===1?``:`ies`]}),t.size>0&&(0,W.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[`(`,[...t].sort().join(`, `),`)`]})]})})(),(E||S||w)&&(0,W.jsxs)(`div`,{className:`shrink-0 border-b border-border/70 px-4 py-2`,"aria-live":`polite`,children:[E&&(0,W.jsxs)(`div`,{role:`status`,className:`flex items-center gap-2 text-xs text-success`,children:[(0,W.jsx)(m,{className:`size-3.5`}),` `,E]}),S&&(0,W.jsxs)(`div`,{role:`alert`,className:`flex items-center gap-2 text-xs text-warning`,children:[(0,W.jsx)(x,{className:`size-3.5`}),` `,S,` Existing content remains available.`]}),w&&!ie&&!ae&&(0,W.jsxs)(`div`,{role:`alert`,className:`flex items-center gap-2 text-xs text-destructive`,children:[(0,W.jsx)(x,{className:`size-3.5`}),` `,w]})]}),(0,W.jsxs)(`div`,{className:`grid min-h-0 flex-1 md:grid-cols-[minmax(320px,0.82fr)_minmax(0,1.35fr)]`,children:[(0,W.jsxs)(`section`,{className:P(`min-h-0 border-r border-border/70 bg-card/25`,ut?`hidden md:flex md:flex-col`:`flex flex-col`),"aria-label":`Memory library`,children:[(0,W.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-border/60 px-3 py-1.5`,children:[(0,W.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide text-muted-foreground`,children:`File drawer`}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsxs)(`select`,{value:G??``,onChange:e=>{let t=e.target.value||null;Ie(t),t&&Fe(!0)},className:`max-w-[180px] truncate rounded-sm border border-border/60 bg-background px-1.5 py-0.5 text-[10px] font-mono`,"aria-label":`File for memory drawer`,"data-testid":`memory-drawer-file-select`,children:[(0,W.jsx)(`option`,{value:``,children:`— select a file —`}),p.flatMap(e=>e.anchors??[]).filter(e=>e.type===`file`&&e.path).map((e,t)=>(0,W.jsx)(`option`,{value:e.path,children:e.path},`${e.path}-${t}`))]}),(0,W.jsxs)(F,{type:`button`,size:`sm`,variant:$?`default`:`outline`,onClick:()=>{G&&Fe(e=>!e)},disabled:!G,className:`h-7 gap-1 px-2 text-[11px]`,"aria-pressed":$,title:$?`Hide file memory drawer`:`Show file memory drawer`,children:[$?(0,W.jsx)(ce,{className:`size-3`}):(0,W.jsx)(re,{className:`size-3`}),$?`Hide`:`Show`,` drawer`]})]})]}),(0,W.jsx)(nt,{searchQuery:R,statusFilter:z,kindFilter:B,audienceOnly:Ae,tagFilter:V,hasFilters:lt,allTags:at,stats:g,onSearchChange:De,onStatusFilterChange:Oe,onKindFilterChange:ke,onToggleAudienceOnly:()=>je(e=>!e),onTagFilterChange:Ne,onClearFilters:st}),(0,W.jsx)(it,{memoryListRef:f,memories:p,filteredMemories:rt,selectedId:ne,onSelectMemory:qe,onOpenCreate:Ke,onClearFilters:st})]}),(0,W.jsx)(`section`,{className:P(`min-h-0 bg-background`,ut?`flex flex-col`:`hidden md:flex md:flex-col`),"aria-label":`Memory detail`,children:ae?(0,W.jsx)(tt,{mode:`create`,draft:j,busy:N===`create`,error:w,onChange:M,onCancel:Ye,onSubmit:Ze}):X?ie?(0,W.jsx)(tt,{mode:`edit`,draft:j,busy:N===`update`,error:w,onChange:M,onCancel:Ye,onSubmit:Qe}):$?(0,W.jsx)($e,{filePath:G,lineStart:Le,lineEnd:ze,open:$,onClose:()=>Fe(!1),onShowMemory:e=>O(e),onAcceptDeletion:async(e,t)=>{o({candidateId:e,action:`accept`}),D(`Accepted hygiene review for ${t.slice(0,12)}… (candidate ${e.slice(0,12)}…).`),setTimeout(()=>{Z()},500)},onKeep:async(e,t)=>{o({candidateId:e,action:`reject`}),D(`Kept ${t.slice(0,12)}… (candidate ${e.slice(0,12)}… rejected).`)},onUpdate:e=>{O(e),Je()},onMarkPermanent:async e=>{I(`update`);try{await r(e,{persistence:`permanent`}),D(`Memory ${e.slice(0,12)}… promoted to permanent.`),await Z()}catch(e){T(e instanceof Error?e.message:String(e))}finally{I(null)}},onRecover:async e=>{a({id:e,reason:`recovered via file drawer`}),D(`Recovered ${e.slice(0,12)}…`),setTimeout(()=>{Z()},500)}}):(0,W.jsx)(Ue,{memory:X,allMemories:p,relatedMemories:ot,onClose:()=>O(null),onOpenMemory:qe,onEdit:Je,onDelete:()=>Ce(X.id),onTagSelect:e=>{Ne(e),O(null)},onNotice:D}):(0,W.jsx)(ct,{onCapture:Ke})})]}),(0,W.jsx)(ge,{open:!!L,onOpenChange:e=>{!e&&N!==`delete`&&Ce(null)},children:(0,W.jsxs)(xe,{className:`max-w-md`,children:[(0,W.jsxs)(me,{children:[(0,W.jsx)(`span`,{className:`mb-2 flex size-10 items-center justify-center border border-destructive/35 bg-destructive/10 text-destructive`,children:(0,W.jsx)(ue,{className:`size-4`})}),(0,W.jsx)(he,{children:`Delete this memory?`}),(0,W.jsx)(pe,{className:`leading-6`,children:`Super Memory will mark the record deleted, remove graph edges, and clean references from related memories. The record remains in the audit trail but cannot be restored from this page.`})]}),(0,W.jsx)(`div`,{className:`border border-border/70 bg-background/45 p-3 text-xs text-muted-foreground`,children:Ee(p.find(e=>e.id===L)?.text??``,180)}),(0,W.jsxs)(be,{children:[(0,W.jsx)(F,{variant:`outline`,onClick:()=>Ce(null),disabled:N===`delete`,children:`Cancel`}),(0,W.jsxs)(F,{variant:`destructive`,onClick:et,disabled:N===`delete`,children:[N===`delete`?(0,W.jsx)(de,{className:`size-4 animate-spin`}):(0,W.jsx)(ue,{className:`size-4`}),N===`delete`?`Deleting…`:`Delete memory`]})]})]})})]})}function ct({onCapture:e}){return(0,W.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center justify-center p-8 text-center`,children:[(0,W.jsxs)(`div`,{className:`relative flex size-20 items-center justify-center border border-info/25 bg-info/5 text-info`,children:[(0,W.jsx)(c,{className:`size-8`}),(0,W.jsx)(`span`,{className:`absolute inset-2 border border-info/10`})]}),(0,W.jsx)(`h2`,{className:`mt-5 text-lg font-bold`,children:`Your project’s long-term context`}),(0,W.jsx)(`p`,{className:`mt-2 max-w-md text-sm leading-6 text-muted-foreground`,children:`Select a memory to inspect its metadata and relationship graph, or capture knowledge that future agents should retrieve automatically.`}),(0,W.jsxs)(`div`,{className:`mt-6 grid w-full max-w-lg gap-2 sm:grid-cols-3`,children:[(0,W.jsxs)(`div`,{className:`border border-border/70 bg-card/45 p-3`,children:[(0,W.jsx)(m,{className:`mx-auto size-4 text-success`}),(0,W.jsx)(`p`,{className:`mt-2 text-[10px] font-bold uppercase`,children:`Verified anchors`})]}),(0,W.jsxs)(`div`,{className:`border border-border/70 bg-card/45 p-3`,children:[(0,W.jsx)(c,{className:`mx-auto size-4 text-info`}),(0,W.jsx)(`p`,{className:`mt-2 text-[10px] font-bold uppercase`,children:`Typed relations`})]}),(0,W.jsxs)(`div`,{className:`border border-border/70 bg-card/45 p-3`,children:[(0,W.jsx)(oe,{className:`mx-auto size-4 text-warning`}),(0,W.jsx)(`p`,{className:`mt-2 text-[10px] font-bold uppercase`,children:`Agent recall`})]})]}),(0,W.jsxs)(F,{onClick:e,children:[(0,W.jsx)(oe,{className:`size-4`}),` Capture memory`]})]})}export{st as MemoryManager};
@@ -0,0 +1 @@
1
+ .agent-office{--office-line:hsl(var(--border) / .72);--office-soft:hsl(var(--surface-2) / .78);--office-panel:hsl(var(--card) / .94);height:100%;min-height:0;color:hsl(var(--foreground));background:radial-gradient(circle at 9% 0%, hsl(var(--primary) / .08), transparent 24rem), linear-gradient(135deg, hsl(var(--background)), hsl(var(--surface-2) / .62));grid-template-rows:auto auto minmax(0,1fr) auto;display:grid;position:relative;overflow:hidden}.agent-office:before{pointer-events:none;content:"";opacity:.18;background-image:linear-gradient(hsl(var(--border) / .34) 1px, transparent 1px), linear-gradient(90deg, hsl(var(--border) / .34) 1px, transparent 1px);background-size:28px 28px;position:absolute;inset:0;-webkit-mask-image:linear-gradient(#0000,#000 16% 92%,#0000);mask-image:linear-gradient(#0000,#000 16% 92%,#0000)}.agent-office__header{z-index:4;border-bottom:1px solid var(--office-line);background:hsl(var(--card) / .9);min-height:68px;box-shadow:0 8px 30px hsl(var(--shadow-color) / .08);-webkit-backdrop-filter:blur(18px);backdrop-filter:blur(18px);align-items:center;gap:18px;padding:10px 16px;display:flex;position:relative}.agent-office__title{align-items:center;gap:10px;min-width:210px;display:flex}.agent-office__brand-mark{border:1px solid hsl(var(--primary) / .34);width:38px;height:38px;color:hsl(var(--primary));background:hsl(var(--primary) / .1);border-radius:10px;flex:none;place-items:center;display:grid}.agent-office__brand-mark svg{width:19px;height:19px}.agent-office__title>div>span,.agent-office__detail-header>div>span{color:hsl(var(--muted-foreground));font:500 9px / 1.2 var(--font-mono);letter-spacing:.13em;display:block}.agent-office__title h1{max-width:280px;font:500 15px / 1.2 var(--font-display);text-overflow:ellipsis;white-space:nowrap;margin:3px 0 0;overflow:hidden}.agent-office__live-pill{border:1px solid hsl(var(--success) / .3);color:hsl(var(--success));background:hsl(var(--success) / .08);font:500 9px / 1 var(--font-mono);letter-spacing:.1em;border-radius:999px;align-items:center;gap:6px;padding:5px 8px;display:flex}.agent-office__live-pill>span,.agent-office__pulse-dot{width:6px;height:6px;box-shadow:0 0 0 4px hsl(var(--success) / .12);background:currentColor;border-radius:999px;animation:1.6s ease-in-out infinite agent-office-pulse}.agent-office__summary{flex:auto;justify-content:center;gap:6px;min-width:0;display:flex}.agent-office__summary>div{border-left:1px solid var(--office-line);grid-template-columns:auto auto;align-items:center;gap:0 6px;min-width:92px;padding:6px 9px;display:grid}.agent-office__summary svg{width:13px;height:13px;color:hsl(var(--muted-foreground))}.agent-office__summary strong{font:500 13px / 1 var(--font-mono)}.agent-office__summary span{color:hsl(var(--muted-foreground));grid-column:1/-1;font-size:9px}.agent-office__column-headings,.agent-office__lane{grid-template-columns:180px minmax(430px,1fr) 270px;display:grid}.agent-office__column-headings{z-index:3;border-bottom:1px solid var(--office-line);min-height:28px;color:hsl(var(--muted-foreground));background:hsl(var(--background) / .84);font:500 8px / 1 var(--font-mono);letter-spacing:.14em;align-items:center;padding:0 12px;position:relative}.agent-office__column-headings span{padding:0 12px}.agent-office__column-headings span:last-child{padding-left:16px}.agent-office__client-office{border:1px solid hsl(var(--border));background:hsl(var(--card) / .42);box-shadow:0 14px 38px hsl(var(--shadow-color) / .08);border-radius:16px;margin-bottom:14px;overflow:hidden}.agent-office__client-header{border-bottom:1px solid hsl(var(--border));background:linear-gradient(90deg, hsl(var(--primary) / .07), transparent 42%), hsl(var(--card) / .82);justify-content:space-between;align-items:center;gap:14px;min-height:62px;padding:9px 12px;display:flex}.agent-office__client-title{flex-wrap:wrap;flex:420px;align-items:center;gap:9px;min-width:210px;display:flex}.agent-office__client-copy{flex-direction:column;flex:150px;gap:2px;min-width:0;display:flex}.agent-office__client-copy strong{font:500 12px / 1.2 var(--font-display);text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.agent-office__client-copy>span{max-width:310px;color:hsl(var(--muted-foreground));font:400 8px / 1.2 var(--font-mono);text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.agent-office__client-icon{width:32px;height:32px;color:hsl(var(--primary));background:hsl(var(--primary) / .1);border-radius:9px;flex:none;place-items:center;display:grid}.agent-office__client-icon svg{width:16px;height:16px}.agent-office__client-agent-count{color:hsl(var(--primary));background:hsl(var(--primary) / .09);font:500 8px / 1 var(--font-mono);border-radius:999px;flex:none;padding:3px 6px}.agent-office__client-presence{flex-wrap:wrap;align-items:center;gap:4px;min-width:0;display:flex}.agent-office__presence-chip{border:1px solid hsl(var(--border));min-height:20px;color:hsl(var(--muted-foreground));background:hsl(var(--background) / .5);font:500 7px / 1 var(--font-mono);letter-spacing:.04em;border-radius:999px;flex:none;align-items:center;gap:3px;padding:3px 5px;display:inline-flex}.agent-office__presence-chip svg{width:9px;height:9px}.agent-office__presence-chip.is-live,.agent-office__presence-chip.is-telemetry{border-color:hsl(var(--success) / .25);color:hsl(var(--success));background:hsl(var(--success) / .07)}.agent-office__presence-chip.is-legacy{border-color:hsl(var(--warning) / .28);color:hsl(var(--warning));background:hsl(var(--warning) / .08)}.agent-office__agent-verified{min-height:16px;color:hsl(var(--success));background:hsl(var(--success) / .08);font:500 6px / 1 var(--font-mono);letter-spacing:.04em;border-radius:999px;flex:none;align-items:center;gap:2px;padding:2px 4px;display:inline-flex}.agent-office__agent-verified svg{width:8px;height:8px}.agent-office__client-stats{border:0;flex-wrap:wrap;justify-content:flex-end;gap:5px;min-width:0;margin:0;padding:0;display:flex}.agent-office__client-stats>span{border:1px solid hsl(var(--border));min-height:25px;color:hsl(var(--muted-foreground));background:hsl(var(--background) / .58);font:400 7px / 1 var(--font-mono);letter-spacing:.05em;border-radius:6px;align-items:center;gap:4px;padding:4px 6px;display:inline-flex}.agent-office__client-stats svg{width:11px;height:11px}.agent-office__client-stats strong{color:hsl(var(--foreground));font-size:9px}.agent-office__client-delta strong{color:hsl(var(--success))}.agent-office__client-delta b{color:hsl(var(--destructive));font-weight:500}.agent-office__client-desks{padding:9px 9px 1px}.agent-office__briefing{border-bottom:1px solid hsl(var(--border));background:hsl(var(--background) / .34);grid-template-columns:minmax(0,1.15fr) minmax(300px,.85fr);gap:8px;padding:8px 9px;display:grid}.agent-office__prompt-card,.agent-office__todo-board{border:1px solid hsl(var(--border));min-width:0;min-height:68px;color:hsl(var(--foreground));background:hsl(var(--card) / .7);text-align:left;box-shadow:0 6px 18px hsl(var(--shadow-color) / .045);border-radius:10px;align-items:center;gap:9px;padding:9px 10px;transition:border-color .16s,background .16s,transform .16s;display:flex;position:relative}.agent-office__prompt-card{overflow:hidden}.agent-office__prompt-card.is-active{border-color:hsl(var(--success) / .38);background:linear-gradient(90deg, hsl(var(--success) / .07), transparent 62%), hsl(var(--card) / .78);box-shadow:0 8px 24px hsl(var(--success) / .08)}.agent-office__prompt-card.is-fresh:after{pointer-events:none;content:"";background:linear-gradient(90deg, transparent, hsl(var(--primary) / .14), transparent);width:24%;animation:1.1s ease-out agent-office-brief-arrive;position:absolute;inset:0 auto 0 -30%;transform:skew(-18deg)}.agent-office__prompt-card.is-waiting,.agent-office__todo-board.is-waiting{background:hsl(var(--muted) / .28);border-style:dashed}.agent-office__prompt-card:hover,.agent-office__todo-board:hover{border-color:hsl(var(--primary) / .34);background:hsl(var(--card));transform:translateY(-1px)}.agent-office__briefing-icon{width:34px;height:34px;color:hsl(var(--primary));background:hsl(var(--primary) / .1);border-radius:9px;flex:none;place-items:center;display:grid}.agent-office__briefing-icon svg{width:16px;height:16px}.agent-office__briefing-copy{flex-direction:column;flex:auto;gap:4px;min-width:0;display:flex}.agent-office__briefing-copy>span,.agent-office__todo-heading>span{color:hsl(var(--muted-foreground));font:500 7px / 1 var(--font-mono);letter-spacing:.11em;text-transform:uppercase}.agent-office__briefing-copy strong{font:500 10px / 1.35 var(--font-display);-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.agent-office__prompt-card time{color:hsl(var(--muted-foreground));font:400 7px / 1 var(--font-mono);flex:none;align-self:flex-start}.agent-office__instruction-live{color:hsl(var(--success));background:hsl(var(--success) / .09);font:500 7px / 1 var(--font-mono);letter-spacing:.08em;border-radius:999px;flex:none;align-items:center;gap:4px;padding:3px 5px;display:inline-flex}.agent-office__instruction-live i{width:5px;height:5px;box-shadow:0 0 0 3px hsl(var(--success) / .1);background:currentColor;border-radius:50%;animation:1.6s ease-in-out infinite agent-office-pulse}.agent-office__todo-board{flex-direction:column;align-items:stretch;gap:7px}.agent-office__todo-board.has-active{border-color:hsl(var(--primary) / .26)}.agent-office__todo-board.has-active:after{content:"";background:linear-gradient(90deg, hsl(var(--primary) / .16), hsl(var(--primary)), hsl(var(--primary) / .16));background-size:200% 100%;border-radius:999px;width:38px;height:2px;animation:2.4s linear infinite agent-office-sync-line;position:absolute;bottom:7px;right:8px;overflow:hidden}.agent-office__todo-heading{justify-content:space-between;align-items:center;gap:8px;min-width:0;display:flex}.agent-office__todo-heading>span{align-items:center;gap:5px;display:inline-flex}.agent-office__todo-heading svg{width:12px;height:12px;color:hsl(var(--primary))}.agent-office__todo-heading strong,.agent-office__todo-more{color:hsl(var(--muted-foreground));font:500 7px / 1 var(--font-mono)}.agent-office__todo-preview{flex-direction:column;gap:4px;min-width:0;display:flex}.agent-office__todo-line{min-width:0;font:400 8px / 1.2 var(--font-mono);align-items:center;gap:6px;display:flex}.agent-office__todo-line i{border:1px solid hsl(var(--muted-foreground) / .62);border-radius:50%;flex:none;width:6px;height:6px}.agent-office__todo-line.is-in_progress i{border-color:hsl(var(--success));background:hsl(var(--success));box-shadow:0 0 0 3px hsl(var(--success) / .1);animation:1.6s ease-in-out infinite agent-office-pulse}.agent-office__todo-line>span{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.agent-office__todo-empty{color:hsl(var(--muted-foreground));font:400 8px / 1.2 var(--font-mono);align-items:center;gap:6px;display:flex}.agent-office__todo-empty svg{width:13px;height:13px;color:hsl(var(--success))}.agent-office__todo-empty.is-waiting svg{color:hsl(var(--warning));animation:1.8s ease-in-out infinite agent-office-telemetry-wait}.agent-office__floor{z-index:2;overscroll-behavior:contain;scrollbar-color:hsl(var(--border)) transparent;min-height:0;padding:10px 12px 20px;position:relative;overflow-y:auto}.agent-office__lane{--desk-top:hsl(var(--warning) / .72);--desk-edge:hsl(var(--warning) / .3);--desk-leg:hsl(var(--muted-foreground) / .62);--desk-chair:hsl(var(--muted-foreground) / .28);--desk-screen:hsl(var(--primary));--desk-decor:hsl(var(--warning) / .68);--desk-wall:hsl(var(--info) / .055);--desk-floor:hsl(var(--warning) / .055);--desk-aura:hsl(var(--warning) / .045);border:1px solid var(--office-line);background:var(--office-panel);min-height:172px;box-shadow:0 10px 30px hsl(var(--shadow-color) / .06);border-radius:14px;margin-bottom:9px;transition:border-color .18s,box-shadow .18s,transform .18s;animation:.42s cubic-bezier(.16,.82,.28,1) agent-office-lane-arrive;position:relative;overflow:hidden}.agent-office__lane.is-desk-mint{--desk-top:hsl(var(--success) / .58);--desk-edge:hsl(var(--success) / .22);--desk-leg:hsl(var(--foreground) / .5);--desk-chair:hsl(var(--success) / .2);--desk-screen:hsl(var(--success));--desk-decor:hsl(var(--info) / .7);--desk-wall:hsl(var(--success) / .07);--desk-floor:hsl(var(--info) / .045);--desk-aura:hsl(var(--success) / .055)}.agent-office__lane.is-desk-ocean{--desk-top:hsl(var(--info) / .62);--desk-edge:hsl(var(--info) / .24);--desk-leg:hsl(var(--foreground) / .58);--desk-chair:hsl(var(--info) / .2);--desk-screen:hsl(var(--info));--desk-decor:hsl(var(--primary) / .72);--desk-wall:hsl(var(--info) / .09);--desk-floor:hsl(var(--primary) / .04);--desk-aura:hsl(var(--info) / .052)}.agent-office__lane.is-desk-plum{--desk-top:hsl(var(--primary) / .58);--desk-edge:hsl(var(--primary) / .24);--desk-leg:hsl(var(--foreground) / .54);--desk-chair:hsl(var(--primary) / .2);--desk-screen:hsl(var(--primary));--desk-decor:hsl(var(--warning) / .75);--desk-wall:hsl(var(--primary) / .075);--desk-floor:hsl(var(--warning) / .04);--desk-aura:hsl(var(--primary) / .052)}.agent-office__lane.is-desk-rose{--desk-top:hsl(var(--destructive) / .5);--desk-edge:hsl(var(--destructive) / .2);--desk-leg:hsl(var(--foreground) / .52);--desk-chair:hsl(var(--destructive) / .18);--desk-screen:hsl(var(--destructive));--desk-decor:hsl(var(--warning) / .72);--desk-wall:hsl(var(--destructive) / .06);--desk-floor:hsl(var(--warning) / .04);--desk-aura:hsl(var(--destructive) / .048)}.agent-office__lane.is-desk-graphite{--desk-top:hsl(var(--muted-foreground) / .58);--desk-edge:hsl(var(--foreground) / .18);--desk-leg:hsl(var(--foreground) / .66);--desk-chair:hsl(var(--foreground) / .16);--desk-screen:hsl(var(--success));--desk-decor:hsl(var(--info) / .7);--desk-wall:hsl(var(--muted-foreground) / .055);--desk-floor:hsl(var(--foreground) / .035);--desk-aura:hsl(var(--muted-foreground) / .044)}.agent-office__lane:hover{box-shadow:0 13px 34px hsl(var(--shadow-color) / .1);transform:translateY(-1px)}.agent-office__lane.is-active{border-color:hsl(var(--primary) / .38);box-shadow:0 12px 34px hsl(var(--primary) / .09)}.agent-office__lane.is-failed{border-color:hsl(var(--destructive) / .42)}.agent-office__identity{border-right:1px solid var(--office-line);background:linear-gradient(145deg, var(--desk-aura), transparent 68%);flex-direction:column;justify-content:center;min-width:0;padding:16px;display:flex}.agent-office__identity-line{align-items:center;gap:8px;min-width:0;display:flex}.agent-office__identity-line strong{font:500 13px / 1.25 var(--font-display);text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.agent-office__status-dot{background:hsl(var(--muted-foreground) / .52);border-radius:999px;flex:none;width:7px;height:7px}.agent-office__status-dot.is-active{background:hsl(var(--success));box-shadow:0 0 0 4px hsl(var(--success) / .1)}.agent-office__status-dot.is-failed{background:hsl(var(--destructive));box-shadow:0 0 0 4px hsl(var(--destructive) / .1)}.agent-office__role{color:hsl(var(--primary));font:500 8px / 1 var(--font-mono);letter-spacing:.12em;margin:6px 0 16px 15px}.agent-office__agent-meta{flex-wrap:wrap;gap:5px;display:flex}.agent-office__agent-meta span{max-width:100%;color:hsl(var(--muted-foreground));background:hsl(var(--muted) / .75);font:400 8px / 1.2 var(--font-mono);text-overflow:ellipsis;white-space:nowrap;border-radius:5px;padding:3px 6px;overflow:hidden}.agent-office__agent-task{border:1px solid hsl(var(--primary) / .2);width:100%;min-width:0;color:hsl(var(--foreground));background:hsl(var(--primary) / .055);text-align:left;border-radius:7px;align-items:center;gap:6px;margin-top:8px;padding:5px 6px;display:flex}.agent-office__agent-task:hover{border-color:hsl(var(--primary) / .4);background:hsl(var(--primary) / .09)}.agent-office__agent-task:not(.is-missing){animation:.46s cubic-bezier(.16,.82,.28,1) agent-office-task-assigned}.agent-office__agent-task.is-missing{color:hsl(var(--muted-foreground));background:hsl(var(--muted) / .3);border-style:dashed}.agent-office__agent-task.is-missing>svg{color:hsl(var(--warning));animation:1.8s ease-in-out infinite agent-office-telemetry-wait}.agent-office__agent-task>svg{width:13px;height:13px;color:hsl(var(--primary));flex:none}.agent-office__agent-task>span{flex-direction:column;gap:2px;min-width:0;display:flex}.agent-office__agent-task strong{color:hsl(var(--primary));font:500 6px / 1 var(--font-mono);letter-spacing:.09em}.agent-office__agent-task small{font:400 8px / 1.2 var(--font-mono);text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.agent-office__identity-mail{border:1px solid hsl(var(--info) / .18);width:100%;min-width:0;color:hsl(var(--muted-foreground));background:hsl(var(--info) / .055);text-align:left;border-radius:7px;align-items:center;gap:6px;margin-top:8px;padding:5px 6px;display:flex}.agent-office__identity-mail:hover{border-color:hsl(var(--info) / .34);background:hsl(var(--info) / .09)}.agent-office__identity-mail.is-unread{border-color:hsl(var(--info) / .38);color:hsl(var(--foreground))}.agent-office__identity-mail>svg{width:13px;height:13px;color:hsl(var(--info));flex:none}.agent-office__identity-mail>span{flex-direction:column;gap:2px;min-width:0;display:flex}.agent-office__identity-mail strong{font:500 7px / 1 var(--font-mono);letter-spacing:.08em}.agent-office__identity-mail small{max-width:100%;font:400 8px / 1.15 var(--font-mono);text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.agent-office__scene{background:linear-gradient(to bottom, var(--desk-wall) 0 68%, transparent 68%), linear-gradient(165deg, transparent 0 72%, var(--desk-floor) 72% 100%);min-width:0;position:relative;overflow:hidden}.agent-office__scene:after{pointer-events:none;content:"";border-top:1px solid hsl(var(--border) / .55);background-image:repeating-linear-gradient(90deg, transparent 0 54px, hsl(var(--border) / .26) 54px 55px);transform-origin:bottom;height:29%;position:absolute;bottom:0;left:0;right:0;transform:perspective(170px)rotateX(4deg)}.agent-office__window{border:1px solid hsl(var(--border));background:hsl(var(--card));width:70px;height:37px;box-shadow:inset 0 -10px 18px hsl(var(--info) / .08);border-radius:5px;gap:3px;padding:4px;display:flex;position:absolute;top:14px;left:15px}.agent-office__window span{background:linear-gradient(160deg, color-mix(in srgb, var(--desk-screen) 23%, transparent), hsl(var(--primary) / .04));border-radius:2px;flex:1;animation:8s ease-in-out infinite alternate agent-office-window-glow}.agent-office__window span:nth-child(2){animation-delay:-2.4s}.agent-office__window span:nth-child(3){animation-delay:-4.8s}.agent-office__plant{z-index:3;width:25px;height:41px;position:absolute;bottom:29px;left:9px}.agent-office__plant:after{content:"";background:var(--desk-decor);border-radius:3px 3px 8px 8px;width:18px;height:16px;position:absolute;bottom:0;left:4px}.agent-office__plant span,.agent-office__plant i,.agent-office__plant b{--plant-angle:0deg;--plant-scale:1;background:hsl(var(--success) / .72);width:8px;height:23px;transform:rotate(var(--plant-angle)) scale(var(--plant-scale));transform-origin:bottom;border-radius:100% 0;position:absolute;bottom:14px;left:10px}.agent-office__plant i{--plant-angle:-40deg}.agent-office__plant b{--plant-angle:43deg;--plant-scale:.86}.agent-office__plant span,.agent-office__plant i,.agent-office__plant b{animation:4.8s ease-in-out infinite alternate agent-office-plant-sway}.agent-office__plant i{animation-delay:-1.3s}.agent-office__plant b{animation-delay:-2.6s}.agent-office__desk-zone{z-index:4;width:128px;position:absolute;top:18px;bottom:19px;left:30px}.agent-office__desk{z-index:5;background:var(--desk-top);width:84px;height:9px;box-shadow:0 25px 0 -3px var(--desk-edge);border-radius:3px;position:absolute;bottom:29px;right:0}.agent-office__desk:before,.agent-office__desk:after{content:"";background:var(--desk-leg);width:5px;height:38px;position:absolute;top:7px}.agent-office__desk:before{left:7px}.agent-office__desk:after{right:7px}.agent-office__monitor{z-index:7;border:3px solid hsl(var(--foreground) / .8);width:48px;height:34px;color:var(--desk-screen);background:hsl(var(--background));box-shadow:inset 0 0 12px color-mix(in srgb, var(--desk-screen) 18%, transparent);border-radius:5px;place-items:center;display:grid;position:absolute;bottom:38px;right:22px}.agent-office__lane.is-active .agent-office__monitor:before{pointer-events:none;content:"";opacity:.46;background:linear-gradient(to bottom, transparent 0 42%, color-mix(in srgb, var(--desk-screen) 28%, transparent) 48% 54%, transparent 60% 100%);background-size:100% 220%;border-radius:2px;animation:2.2s linear infinite agent-office-monitor-scan;position:absolute;inset:3px}.agent-office__monitor:after{content:"";background:hsl(var(--foreground) / .72);width:4px;height:8px;position:absolute;bottom:-10px;left:20px}.agent-office__monitor>svg{width:15px;height:15px}.agent-office__monitor .agent-office__tool-glyph{width:23px;height:23px;box-shadow:none;background:0 0;border:0}.agent-office__monitor .agent-office__tool-glyph>svg{width:14px;height:14px}.agent-office__monitor .agent-office__file-underlay{display:none}.agent-office__activity-fx{z-index:9;pointer-events:none;opacity:0;width:58px;height:42px;position:absolute;bottom:35px;right:16px}.agent-office__activity-fx>span,.agent-office__activity-fx>i,.agent-office__activity-fx>b{display:block;position:absolute}.agent-office__scene.is-tool-terminal .agent-office__activity-fx{opacity:.8}.agent-office__scene.is-tool-terminal .agent-office__activity-fx>span,.agent-office__scene.is-tool-terminal .agent-office__activity-fx>i,.agent-office__scene.is-tool-terminal .agent-office__activity-fx>b{background:var(--desk-screen);border-radius:2px;width:2px;height:5px;animation:.85s ease-in-out infinite alternate agent-office-terminal-bars;bottom:10px;left:17px}.agent-office__scene.is-tool-terminal .agent-office__activity-fx>i{height:10px;animation-delay:-.42s;left:25px}.agent-office__scene.is-tool-terminal .agent-office__activity-fx>b{height:7px;animation-delay:-.7s;left:33px}.agent-office__scene.is-tool-web .agent-office__activity-fx{opacity:.7}.agent-office__scene.is-tool-web .agent-office__activity-fx>span,.agent-office__scene.is-tool-web .agent-office__activity-fx>i,.agent-office__scene.is-tool-web .agent-office__activity-fx>b{border:1px solid var(--desk-screen);border-bottom-color:#0000;border-left-color:#0000;border-radius:50%;width:12px;height:12px;animation:1.8s ease-out infinite agent-office-web-signal;top:1px;right:-2px;transform:rotate(-38deg)}.agent-office__scene.is-tool-web .agent-office__activity-fx>i{width:20px;height:20px;animation-delay:-.6s;top:-3px;right:-6px}.agent-office__scene.is-tool-web .agent-office__activity-fx>b{width:28px;height:28px;animation-delay:-1.2s;top:-7px;right:-10px}.agent-office__scene:is(.is-tool-read,.is-tool-search) .agent-office__activity-fx{opacity:.78}.agent-office__scene:is(.is-tool-read,.is-tool-search) .agent-office__activity-fx>span{border:2px solid var(--desk-screen);border-radius:50%;width:14px;height:14px;animation:1.65s ease-in-out infinite alternate agent-office-inspect;top:-3px;left:4px}.agent-office__scene:is(.is-tool-read,.is-tool-search) .agent-office__activity-fx>i{background:var(--desk-screen);border-radius:2px;width:9px;height:2px;animation:1.65s ease-in-out infinite alternate agent-office-inspect-handle;top:10px;left:16px;transform:rotate(42deg)}.agent-office__scene:is(.is-tool-read,.is-tool-search) .agent-office__activity-fx>b{border:1px solid color-mix(in srgb, var(--desk-screen) 58%, transparent);background:repeating-linear-gradient(to bottom, transparent 0 3px, color-mix(in srgb, var(--desk-screen) 32%, transparent) 3px 4px);border-radius:2px;width:12px;height:16px;top:1px;left:31px}.agent-office__scene:is(.is-tool-write,.is-tool-edit) .agent-office__activity-fx{opacity:.78}.agent-office__scene:is(.is-tool-write,.is-tool-edit) .agent-office__activity-fx>span{border-bottom:1px solid color-mix(in srgb, var(--desk-screen) 62%, transparent);background:repeating-linear-gradient(to bottom, transparent 0 3px, color-mix(in srgb, var(--desk-screen) 24%, transparent) 3px 4px);width:22px;height:8px;bottom:-2px;right:5px}.agent-office__scene:is(.is-tool-write,.is-tool-edit) .agent-office__activity-fx>i{background:var(--desk-screen);transform-origin:100%;border-radius:4px 1px 1px 4px;width:17px;height:3px;animation:.72s ease-in-out infinite alternate agent-office-write-stroke;bottom:3px;right:12px;transform:rotate(-27deg)}.agent-office__scene:is(.is-tool-write,.is-tool-edit) .agent-office__activity-fx>b{background:var(--desk-screen);border-radius:50%;width:3px;height:3px;bottom:1px;right:27px}.agent-office__scene:is(.is-tool-memory,.is-tool-other) .agent-office__activity-fx{opacity:.72}.agent-office__scene:is(.is-tool-memory,.is-tool-other) .agent-office__activity-fx>span,.agent-office__scene:is(.is-tool-memory,.is-tool-other) .agent-office__activity-fx>i,.agent-office__scene:is(.is-tool-memory,.is-tool-other) .agent-office__activity-fx>b{border:1px solid var(--desk-screen);background:color-mix(in srgb, var(--desk-screen) 15%, transparent);border-radius:2px;width:6px;height:6px;animation:1.8s ease-in-out infinite agent-office-memory-pulse;top:-1px;right:0}.agent-office__scene:is(.is-tool-memory,.is-tool-other) .agent-office__activity-fx>i{animation-delay:-.6s;top:8px;right:-5px}.agent-office__scene:is(.is-tool-memory,.is-tool-other) .agent-office__activity-fx>b{animation-delay:-1.2s;top:14px;right:4px}.agent-office__desk-lamp{z-index:8;background:var(--desk-leg);transform-origin:bottom;border-radius:3px;width:3px;height:25px;position:absolute;bottom:39px;right:76px;transform:rotate(8deg)}.agent-office__desk-lamp:before{content:"";background:var(--desk-decor);width:16px;height:10px;box-shadow:0 7px 11px color-mix(in srgb, var(--desk-decor) 20%, transparent);border-radius:8px 8px 3px 3px;position:absolute;top:-4px;left:-7px;transform:rotate(-12deg)}.agent-office__desk-lamp:after{content:"";background:var(--desk-leg);border-radius:4px;width:13px;height:3px;position:absolute;bottom:-2px;right:-5px}.agent-office__desk-clutter{z-index:8;background:hsl(var(--card));width:18px;height:7px;box-shadow:0 -3px 0 -1px var(--desk-decor), 0 1px 2px hsl(var(--shadow-color) / .12);border-radius:2px;position:absolute;bottom:39px;right:61px;transform:rotate(-3deg)}.agent-office__desk-clutter>i,.agent-office__desk-clutter>b{background:var(--desk-decor);border-radius:2px;width:2px;height:10px;position:absolute;bottom:8px;right:2px;transform:rotate(12deg)}.agent-office__desk-clutter>b{background:var(--desk-screen);height:8px;right:6px;transform:rotate(-5deg)}.agent-office__desk-charm{z-index:8;width:15px;height:14px;color:var(--desk-decor);display:block;position:absolute;bottom:11px;right:-6px}.agent-office__desk-charm.is-bot{background:color-mix(in srgb, var(--desk-decor) 18%, hsl(var(--card)));border:1px solid;border-radius:4px}.agent-office__desk-charm.is-bot:before,.agent-office__desk-charm.is-bot:after{content:"";background:currentColor;border-radius:50%;width:2px;height:2px;animation:4.1s ease-in-out infinite agent-office-charm-blink;position:absolute;top:4px}.agent-office__desk-charm.is-bot:before{left:3px}.agent-office__desk-charm.is-bot:after{right:3px}.agent-office__desk-charm.is-bot>i{background:currentColor;width:1px;height:5px;position:absolute;top:-5px;left:6px}.agent-office__desk-charm.is-cactus:before{content:"";background:hsl(var(--success) / .74);width:7px;height:12px;box-shadow:-4px 4px 0 -2px hsl(var(--success) / .74);border-radius:6px 6px 2px 2px;position:absolute;bottom:4px;right:4px}.agent-office__desk-charm.is-cactus:after{content:"";background:var(--desk-decor);border-radius:2px 2px 5px 5px;width:13px;height:5px;position:absolute;bottom:0;right:1px}.agent-office__desk-charm.is-duck:before{content:"";background:hsl(var(--warning) / .82);border-radius:65% 48% 48% 55%;width:14px;height:9px;animation:3.6s ease-in-out infinite agent-office-charm-bob;position:absolute;bottom:0;right:0}.agent-office__desk-charm.is-duck:after{content:"";background:hsl(var(--warning) / .82);width:8px;height:8px;box-shadow:-3px 4px 0 -2px hsl(var(--destructive) / .72);border-radius:50%;animation:3.6s ease-in-out infinite agent-office-charm-bob;position:absolute;top:0;left:1px}.agent-office__desk-charm.is-radio{background:hsl(var(--card));box-shadow:inset 5px 0 0 color-mix(in srgb, var(--desk-decor) 18%, transparent);border:1px solid;border-radius:3px}.agent-office__desk-charm.is-radio:before{content:"";border:1px dotted;border-radius:50%;width:5px;height:5px;position:absolute;top:3px;right:2px}.agent-office__desk-charm.is-radio:after{content:"";transform-origin:bottom;background:currentColor;width:1px;height:7px;position:absolute;top:-6px;left:3px;transform:rotate(-20deg)}.agent-office__lane.is-clutter-0 .agent-office__desk-lamp,.agent-office__lane.is-clutter-1 .agent-office__desk-clutter{display:none}.agent-office__lane.is-layout-1 .agent-office__desk-zone{left:39px}.agent-office__lane.is-layout-1 .agent-office__window{border-radius:14px 14px 5px 5px;width:49px}.agent-office__lane.is-layout-1 .agent-office__desk{border-radius:8px 3px 3px 8px;width:91px;transform:rotate(.7deg)}.agent-office__lane.is-layout-2 .agent-office__desk-zone{left:22px}.agent-office__lane.is-layout-2 .agent-office__desk{border-radius:2px 9px 2px 2px;height:11px;bottom:31px}.agent-office__lane.is-layout-2 .agent-office__desk:before{width:3px;left:17px}.agent-office__lane.is-layout-2 .agent-office__desk:after{width:3px;right:16px}.agent-office__lane.is-layout-2 .agent-office__plant{transform-origin:bottom;transform:scale(.78)}.agent-office__lane.is-layout-3 .agent-office__window{border-radius:3px;width:78px;height:29px;transform:rotate(-1deg)}.agent-office__lane.is-layout-3 .agent-office__window span:nth-child(2){flex:1.8}.agent-office__lane.is-layout-3 .agent-office__desk{border-radius:10px 2px 6px;width:78px;height:12px}.agent-office__lane.is-layout-3 .agent-office__plant{left:139px}.agent-office__mug{z-index:8;background:hsl(var(--primary) / .55);border-radius:2px 2px 4px 4px;width:11px;height:13px;position:absolute;bottom:39px;right:4px}.agent-office__mug:after{content:"";border:2px solid hsl(var(--primary) / .55);border-left:0;border-radius:0 5px 5px 0;width:6px;height:7px;position:absolute;top:3px;right:-5px}.agent-office__mug>i,.agent-office__mug>b{content:"";border-left:1px solid hsl(var(--muted-foreground) / .42);opacity:0;border-radius:50%;width:5px;height:8px;animation:3.4s ease-in-out infinite agent-office-mug-steam;position:absolute;top:-9px;left:2px}.agent-office__mug>b{animation-delay:-1.55s;left:6px}.agent-office__mug.is-leader{background:hsl(var(--warning) / .82);width:14px;box-shadow:inset 0 3px 0 hsl(var(--background) / .22)}.agent-office__mug.is-leader:before{content:"";background:hsl(var(--warning));clip-path:polygon(0 100%,0 0,30% 65%,50% 0,70% 65%,100% 0,100% 100%);width:10px;height:5px;position:absolute;top:-5px;left:2px}.agent-office__mug.is-leader:after{border-color:hsl(var(--warning) / .82)}.agent-office__mug.is-builder{background:hsl(var(--success) / .72);border-radius:3px;width:10px;height:18px}.agent-office__mug.is-builder:after{display:none}.agent-office__mug.is-researcher{background:hsl(var(--info) / .66);border-radius:3px 3px 7px 7px;width:15px;height:14px}.agent-office__mug.is-researcher:after{border-color:hsl(var(--info) / .66)}.agent-office__mug.is-reviewer{background:hsl(var(--warning) / .68);border-radius:2px 2px 5px 5px;width:10px;height:8px;bottom:39px;right:7px}.agent-office__mug.is-reviewer:after{border-color:hsl(var(--warning) / .68);width:5px;height:5px;top:1px;right:-4px}.agent-office__mug.is-planner{background:hsl(var(--primary) / .64);box-shadow:-8px -3px 0 -3px hsl(var(--foreground) / .72)}.agent-office__mug.is-operator{background:hsl(var(--muted-foreground) / .62)}.agent-office__mug.is-operator:after{border-color:hsl(var(--muted-foreground) / .62)}.agent-office__avatar{--avatar-shirt:hsl(var(--primary) / .72);--avatar-accent:hsl(var(--primary));--avatar-skin:hsl(var(--warning) / .42);--avatar-skin-shadow:hsl(var(--warning) / .14);--avatar-hair:hsl(var(--foreground) / .78);--avatar-cycle:7.2s;--avatar-delay:-.4s;--avatar-type-speed:.72s;z-index:6;width:58px;height:78px;position:absolute;bottom:25px;left:0}.agent-office__avatar-chair{background:var(--desk-chair);border-radius:15px 15px 8px 8px;width:41px;height:49px;position:absolute;bottom:2px;left:5px;transform:rotate(-3deg)}.agent-office__avatar-body{background:var(--avatar-shirt);border-radius:12px 12px 8px 8px;width:34px;height:35px;position:absolute;bottom:15px;left:14px}.agent-office__avatar-head{background:var(--avatar-skin);width:31px;height:32px;box-shadow:inset 0 -3px 0 var(--avatar-skin-shadow);border-radius:48% 48% 44% 44%;position:absolute;top:4px;left:15px}.agent-office__avatar-hair{background:var(--avatar-hair);border-radius:15px 14px 4px 7px;height:13px;position:absolute;inset:-2px 2px auto 0}.agent-office__avatar.is-avatar-1{--avatar-skin:color-mix(in srgb, hsl(var(--warning)) 72%, hsl(var(--foreground)));--avatar-skin-shadow:color-mix(in srgb, var(--avatar-skin) 72%, transparent);--avatar-hair:hsl(var(--primary) / .76)}.agent-office__avatar.is-avatar-1 .agent-office__avatar-hair{clip-path:polygon(0 0,100% 0,100% 68%,70% 42%,48% 100%,31% 43%,0 72%);border-radius:17px 15px 8px 3px;height:17px;inset:-3px -1px auto}.agent-office__avatar.is-avatar-2{--avatar-skin:color-mix(in srgb, hsl(var(--warning)) 63%, hsl(var(--background)));--avatar-skin-shadow:hsl(var(--warning) / .12);--avatar-hair:hsl(var(--foreground) / .7)}.agent-office__avatar.is-avatar-2 .agent-office__avatar-hair{background:radial-gradient(circle at 15% 58%, var(--avatar-hair) 0 4px, transparent 4.5px), radial-gradient(circle at 38% 34%, var(--avatar-hair) 0 5px, transparent 5.5px), radial-gradient(circle at 64% 38%, var(--avatar-hair) 0 5px, transparent 5.5px), radial-gradient(circle at 87% 62%, var(--avatar-hair) 0 4px, transparent 4.5px);border-radius:11px 13px 4px 7px;width:32px;height:15px;inset:-4px -1px auto}.agent-office__avatar.is-avatar-3{--avatar-skin:color-mix(in srgb, hsl(var(--warning)) 58%, hsl(var(--primary)));--avatar-skin-shadow:hsl(var(--primary) / .13);--avatar-hair:hsl(var(--muted-foreground) / .84)}.agent-office__avatar.is-avatar-3 .agent-office__avatar-hair{border-radius:14px 14px 3px 7px;height:9px;inset:-1px 3px auto 0}.agent-office__avatar.is-avatar-3 .agent-office__avatar-hair:after{content:"";background:var(--avatar-hair);border-radius:50%;width:11px;height:11px;position:absolute;top:-7px;right:-3px}.agent-office__avatar.is-avatar-4{--avatar-skin:color-mix(in srgb, hsl(var(--warning)) 78%, hsl(var(--background)));--avatar-skin-shadow:hsl(var(--warning) / .1);--avatar-hair:hsl(var(--foreground) / .66)}.agent-office__avatar.is-avatar-4 .agent-office__avatar-hair{background:repeating-linear-gradient(90deg, var(--avatar-hair) 0 2px, transparent 2px 4px);border-radius:50% 50% 2px 2px;height:5px;inset:0 2px auto 1px}.agent-office__avatar.is-motion-1{--avatar-cycle:8.6s;--avatar-delay:-3.1s;--avatar-type-speed:.58s}.agent-office__avatar.is-motion-2{--avatar-cycle:6.8s;--avatar-delay:-5.2s;--avatar-type-speed:.84s}.agent-office__avatar.is-motion-3{--avatar-cycle:9.4s;--avatar-delay:-1.7s;--avatar-type-speed:.66s}.agent-office__avatar-face:before,.agent-office__avatar-face:after{content:"";background:hsl(var(--foreground) / .7);width:2px;height:2px;animation:5.2s ease-in-out infinite agent-office-blink;animation-delay:var(--avatar-delay);border-radius:50%;position:absolute;top:17px}.agent-office__avatar-face:before{left:9px}.agent-office__avatar-face:after{right:9px}.agent-office__avatar-mouth{background:hsl(var(--foreground) / .58);transform-origin:50%;border-radius:50%;width:6px;height:2px;position:absolute;bottom:6px;left:13px}.agent-office__avatar-headset{border:2px solid hsl(var(--foreground) / .72);border-bottom:0;border-radius:15px 15px 0 0;height:20px;position:absolute;inset:5px -4px auto}.agent-office__avatar-headset:after{content:"";background:hsl(var(--foreground) / .72);border-radius:3px;width:5px;height:9px;position:absolute;bottom:-3px;right:-3px}.agent-office__avatar-arm{z-index:8;background:var(--avatar-shirt);transform-origin:0;border-radius:8px;width:29px;height:8px;position:absolute;bottom:29px;right:0;transform:rotate(-11deg)}.agent-office__avatar-role-badge{z-index:10;border:2px solid hsl(var(--card));width:18px;height:18px;color:hsl(var(--primary-foreground));background:var(--avatar-accent);box-shadow:0 2px 6px hsl(var(--shadow-color) / .18);border-radius:50%;place-items:center;display:grid;position:absolute;bottom:4px;left:18px}.agent-office__avatar-role-badge svg{width:9px;height:9px}.agent-office__avatar-prop{z-index:11;pointer-events:none;position:absolute}.agent-office__avatar.is-leader{--avatar-shirt:hsl(var(--primary) / .86);--avatar-accent:hsl(var(--warning))}.agent-office__avatar.is-leader .agent-office__avatar-prop{background:hsl(var(--warning));clip-path:polygon(0 100%,0 25%,25% 65%,50% 0,75% 65%,100% 25%,100% 100%);width:23px;height:11px;filter:drop-shadow(0 2px 2px hsl(var(--shadow-color) / .16));top:-3px;left:19px}.agent-office__avatar.is-builder{--avatar-shirt:hsl(var(--success) / .7);--avatar-accent:hsl(var(--success))}.agent-office__avatar.is-builder .agent-office__avatar-body{box-shadow:inset 0 4px 0 hsl(var(--background) / .18);border-radius:16px 16px 7px 7px}.agent-office__avatar.is-builder .agent-office__avatar-prop{background:hsl(var(--warning));border-radius:4px;width:23px;height:4px;bottom:20px;right:0;transform:rotate(-38deg)}.agent-office__avatar.is-researcher{--avatar-shirt:hsl(var(--info) / .68);--avatar-accent:hsl(var(--info))}.agent-office__avatar.is-researcher .agent-office__avatar-prop{border:3px solid hsl(var(--info));border-radius:50%;width:14px;height:14px;top:14px;right:2px}.agent-office__avatar.is-researcher .agent-office__avatar-prop:after{content:"";background:hsl(var(--info));border-radius:3px;width:9px;height:3px;position:absolute;bottom:-5px;right:-7px;transform:rotate(48deg)}.agent-office__avatar.is-reviewer{--avatar-shirt:hsl(var(--warning) / .64);--avatar-accent:hsl(var(--warning))}.agent-office__avatar.is-reviewer .agent-office__avatar-prop{border:2px solid hsl(var(--foreground) / .76);width:11px;height:7px;box-shadow:12px 0 0 -2px hsl(var(--warning) / .35), 12px 0 0 0 hsl(var(--foreground) / .76);border-radius:5px;top:18px;left:17px}.agent-office__avatar.is-planner{--avatar-shirt:hsl(var(--primary) / .56);--avatar-accent:hsl(var(--primary))}.agent-office__avatar.is-planner .agent-office__avatar-hair{border-radius:4px 15px 10px 4px;transform:rotate(-5deg)}.agent-office__avatar.is-planner .agent-office__avatar-prop{border:2px solid hsl(var(--primary));background:hsl(var(--card));width:18px;height:24px;box-shadow:inset 0 5px 0 hsl(var(--primary) / .15);border-radius:3px;bottom:16px;right:-1px;transform:rotate(8deg)}.agent-office__avatar.is-operator{--avatar-shirt:hsl(var(--muted-foreground) / .62);--avatar-accent:hsl(var(--muted-foreground))}.agent-office__avatar.is-active .agent-office__avatar-arm{animation:agent-office-type var(--avatar-type-speed) ease-in-out infinite alternate;animation-delay:var(--avatar-delay)}.agent-office__avatar.is-active .agent-office__avatar-head{animation:2.6s ease-in-out infinite agent-office-nod;animation-delay:var(--avatar-delay)}.agent-office__avatar.is-idle .agent-office__avatar-head{animation:agent-office-yawn-head var(--avatar-cycle) ease-in-out infinite;animation-delay:var(--avatar-delay)}.agent-office__avatar.is-idle .agent-office__avatar-mouth{animation:agent-office-yawn-mouth var(--avatar-cycle) ease-in-out infinite;animation-delay:var(--avatar-delay)}.agent-office__avatar.is-idle .agent-office__avatar-arm{animation:agent-office-idle-stretch var(--avatar-cycle) ease-in-out infinite;animation-delay:var(--avatar-delay)}.agent-office__avatar.is-failed .agent-office__avatar-body{background:hsl(var(--destructive) / .72)}.agent-office__conveyor{z-index:5;place-items:center;min-width:0;display:grid;position:absolute;inset:24px 16px 22px 168px}.agent-office__belt{border:1px solid hsl(var(--border));background:repeating-linear-gradient(115deg, hsl(var(--muted)) 0 18px, hsl(var(--surface-3) / .62) 18px 35px);height:30px;box-shadow:inset 0 4px 8px hsl(var(--shadow-color) / .06);border-radius:8px;justify-content:space-around;align-items:center;display:flex;position:absolute;bottom:15px;left:0;right:0;overflow:hidden}.agent-office__belt span{border:3px solid hsl(var(--muted-foreground) / .3);background:hsl(var(--card));border-radius:50%;flex:none;width:18px;height:18px}.agent-office__conveyor.is-moving .agent-office__belt{animation:1.8s linear infinite agent-office-belt}.agent-office__current-action{z-index:3;width:min(340px,90%);margin-bottom:25px;position:relative}.agent-office__current-action>.agent-office__parcel{animation:.52s cubic-bezier(.2,.8,.2,1) agent-office-arrive}.agent-office__parcel{border:1px solid hsl(var(--border));width:100%;min-width:0;color:hsl(var(--foreground));text-align:left;background:hsl(var(--card));box-shadow:0 9px 22px hsl(var(--shadow-color) / .12);cursor:pointer;border-radius:10px;align-items:center;gap:10px;padding:10px;transition:transform .15s,border-color .15s,box-shadow .15s;display:flex;position:relative}button.agent-office__parcel:hover{border-color:hsl(var(--primary) / .45);box-shadow:0 12px 26px hsl(var(--shadow-color) / .16);transform:translateY(-2px)}.agent-office__parcel.is-running{border-color:hsl(var(--primary) / .52);box-shadow:0 10px 26px hsl(var(--primary) / .14)}.agent-office__parcel.is-failed{border-color:hsl(var(--destructive) / .48)}.agent-office__parcel.is-compact{min-height:38px;box-shadow:none;border-radius:7px;gap:7px;padding:6px 7px}.agent-office__parcel--empty{cursor:default;color:hsl(var(--muted-foreground));background:hsl(var(--card) / .65);box-shadow:none;border-style:dashed}.agent-office__mail-parcel{border:1px solid hsl(var(--info) / .34);width:100%;min-width:0;color:hsl(var(--foreground));text-align:left;background:hsl(var(--card));box-shadow:0 8px 22px hsl(var(--info) / .12);cursor:pointer;border-radius:8px;align-items:center;gap:8px;padding:7px 8px;display:flex;position:relative}.agent-office__mail-parcel:hover{border-color:hsl(var(--info) / .58)}.agent-office__mail-parcel.is-outgoing{border-color:hsl(var(--success) / .36)}.agent-office__mail-parcel.is-unread:after{content:"";background:hsl(var(--info));width:5px;height:5px;box-shadow:0 0 0 3px hsl(var(--info) / .12);border-radius:50%;position:absolute;top:5px;right:5px}.agent-office__mail-parcel>svg{width:12px;height:12px;color:hsl(var(--info));flex:none}.agent-office__mail-icon{width:27px;height:27px;color:hsl(var(--info));background:hsl(var(--info) / .1);border-radius:6px;flex:none;place-items:center;display:grid}.agent-office__mail-icon svg{width:13px;height:13px}.agent-office__mail-parcel.is-outgoing .agent-office__mail-icon{color:hsl(var(--success));background:hsl(var(--success) / .1)}.agent-office__mail-flyby{z-index:12;width:min(190px,42%);position:absolute;top:8px;right:9px}.agent-office__mail-flyby.is-incoming{animation:.65s cubic-bezier(.16,.82,.28,1) agent-office-mail-in}.agent-office__mail-flyby.is-outgoing{animation:.65s cubic-bezier(.16,.82,.28,1) agent-office-mail-out}.agent-office__tool-glyph{border:1px solid hsl(var(--border));width:36px;height:36px;color:hsl(var(--muted-foreground));background:hsl(var(--muted));border-radius:9px;flex:none;place-items:center;display:grid;position:relative}.agent-office__tool-glyph>svg{z-index:2;width:17px;height:17px;position:relative}.agent-office__tool-glyph.is-read{color:hsl(var(--info));background:hsl(var(--info) / .1);border-color:hsl(var(--info) / .25)}.agent-office__tool-glyph.is-read>svg:not(.agent-office__file-underlay){width:13px;height:13px;transform:translate(5px,5px)}.agent-office__tool-glyph>.agent-office__file-underlay{z-index:1;opacity:.72;width:18px;height:18px;position:absolute;transform:translate(-3px,-3px)}.agent-office__tool-glyph.is-write,.agent-office__tool-glyph.is-edit{color:hsl(var(--warning));background:hsl(var(--warning) / .1);border-color:hsl(var(--warning) / .25)}.agent-office__tool-glyph.is-terminal{color:hsl(var(--success));background:hsl(var(--success) / .1);border-color:hsl(var(--success) / .25)}.agent-office__tool-glyph.is-web{color:hsl(var(--info));background:hsl(var(--info) / .1);border-color:hsl(var(--info) / .25)}.agent-office__tool-glyph.is-search,.agent-office__tool-glyph.is-memory{color:hsl(var(--primary));background:hsl(var(--primary) / .09);border-color:hsl(var(--primary) / .24)}.agent-office__tool-glyph.is-active:after{z-index:0;content:"";opacity:.25;border:1px solid;border-radius:11px;animation:1.3s ease-out infinite agent-office-ring;position:absolute;inset:-4px}.agent-office__parcel.is-compact .agent-office__tool-glyph{border-radius:6px;width:27px;height:27px}.agent-office__parcel.is-compact .agent-office__tool-glyph>svg{width:13px;height:13px}.agent-office__parcel-copy{flex-direction:column;flex:auto;gap:2px;min-width:0;display:flex}.agent-office__parcel-topline{align-items:center;gap:6px;min-width:0;display:flex}.agent-office__parcel-copy strong{font:500 10px / 1.2 var(--font-mono);text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.agent-office__parcel-target{color:hsl(var(--muted-foreground));font:400 9px / 1.25 var(--font-mono);text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.agent-office__parcel-summary{color:hsl(var(--foreground) / .82);text-overflow:ellipsis;white-space:nowrap;font-size:10px;overflow:hidden}.agent-office__parcel.is-compact .agent-office__parcel-target,.agent-office__parcel.is-compact .agent-office__line-chip{display:none}.agent-office__parcel.is-compact .agent-office__parcel-summary{color:hsl(var(--muted-foreground));font-size:9px}.agent-office__line-chip{color:hsl(var(--info));background:hsl(var(--info) / .09);font:500 8px / 1 var(--font-mono);border-radius:4px;flex:none;padding:2px 4px}.agent-office__parcel-state{width:18px;height:18px;color:hsl(var(--success));flex:none;place-items:center;display:grid}.agent-office__parcel-state>svg{width:12px;height:12px}.agent-office__parcel-state .agent-office__pulse-dot{color:hsl(var(--primary));background:hsl(var(--primary));box-shadow:0 0 0 4px hsl(var(--primary) / .12)}.agent-office__parcel.is-failed .agent-office__parcel-state{color:hsl(var(--destructive))}.agent-office__history{border-left:1px solid var(--office-line);background:hsl(var(--background) / .24);min-width:0;padding:11px 12px}.agent-office__history-heading{color:hsl(var(--muted-foreground));font:500 8px / 1 var(--font-mono);letter-spacing:.1em;justify-content:space-between;align-items:center;margin-bottom:7px;display:flex}.agent-office__history-heading span:last-child{letter-spacing:0}.agent-office__history-list{scrollbar-color:hsl(var(--border)) transparent;scrollbar-width:thin;flex-direction:column;gap:5px;max-height:146px;padding-right:3px;display:flex;overflow-y:auto}.agent-office__history-empty{min-height:88px;color:hsl(var(--muted-foreground));place-items:center;font-size:10px;font-style:italic;display:grid}.agent-office__footer{z-index:4;border-top:1px solid var(--office-line);min-height:31px;color:hsl(var(--muted-foreground));background:hsl(var(--card) / .9);font:400 9px / 1 var(--font-mono);align-items:center;gap:18px;padding:5px 15px;display:flex;position:relative}.agent-office__footer>span{align-items:center;gap:6px;display:flex}.agent-office__footer svg{width:12px;height:12px}.agent-office__empty-state{text-align:center;place-content:center;justify-items:center;min-height:360px;display:grid}.agent-office__empty-state>span{border:1px dashed hsl(var(--border));width:64px;height:64px;color:hsl(var(--primary));background:hsl(var(--primary) / .06);border-radius:18px;place-items:center;margin-bottom:15px;display:grid}.agent-office__empty-state h2{font:500 16px / 1.3 var(--font-display);margin:0 0 5px}.agent-office__empty-state p{color:hsl(var(--muted-foreground));margin:0;font-size:11px}.agent-office__detail-backdrop{z-index:39;background:hsl(var(--background) / .44);-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);cursor:default;border:0;position:absolute;inset:0}.agent-office__detail{z-index:40;border-left:1px solid hsl(var(--border));width:min(410px,94%);color:hsl(var(--foreground));background:hsl(var(--background));box-shadow:-20px 0 55px hsl(var(--shadow-color) / .24);animation:.22s ease-out agent-office-drawer;position:absolute;top:0;bottom:0;right:0;overflow-y:auto}.agent-office__detail-header{z-index:2;border-bottom:1px solid hsl(var(--border));background:hsl(var(--card) / .95);-webkit-backdrop-filter:blur(18px);backdrop-filter:blur(18px);align-items:center;gap:10px;padding:14px;display:flex;position:sticky;top:0}.agent-office__detail-header h2{font:500 15px / 1.2 var(--font-display);margin:3px 0 0}.agent-office__detail-header>button{border:1px solid hsl(var(--border));width:30px;height:30px;color:hsl(var(--muted-foreground));background:hsl(var(--background));cursor:pointer;border-radius:7px;place-items:center;margin-left:auto;display:grid}.agent-office__detail-header>button:hover{color:hsl(var(--foreground));background:hsl(var(--accent))}.agent-office__detail-header>button svg{width:14px;height:14px}.agent-office__detail-icon{width:38px;height:38px;color:hsl(var(--primary));background:hsl(var(--primary) / .1);border-radius:10px;place-items:center;display:grid}.agent-office__detail-icon.is-terminal{color:hsl(var(--success));background:hsl(var(--success) / .1)}.agent-office__detail-icon.is-read,.agent-office__detail-icon.is-web{color:hsl(var(--info));background:hsl(var(--info) / .1)}.agent-office__detail-icon.is-edit,.agent-office__detail-icon.is-write{color:hsl(var(--warning));background:hsl(var(--warning) / .1)}.agent-office__detail-icon.is-mail{color:hsl(var(--info));background:hsl(var(--info) / .1)}.agent-office__detail-icon.is-task,.agent-office__detail-icon.is-briefing{color:hsl(var(--primary));background:hsl(var(--primary) / .1)}.agent-office__detail-icon svg{width:18px;height:18px}.agent-office__detail-status{border:1px solid hsl(var(--border));background:hsl(var(--card));border-radius:9px;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:9px;margin:14px;padding:11px;display:grid}.agent-office__detail-status strong{text-overflow:ellipsis;white-space:nowrap;font-size:11px;overflow:hidden}.agent-office__detail-status>span:last-child{color:hsl(var(--muted-foreground));background:hsl(var(--muted));font:500 8px / 1 var(--font-mono);text-transform:uppercase;border-radius:4px;padding:3px 5px}.agent-office__detail-section{border-top:1px solid hsl(var(--border) / .72);padding:12px 14px}.agent-office__detail-section h3{color:hsl(var(--muted-foreground));font:500 9px / 1 var(--font-mono);letter-spacing:.11em;text-transform:uppercase;margin:0 0 9px}.agent-office__detail-row{justify-content:space-between;align-items:baseline;gap:14px;padding:4px 0;font-size:10px;display:flex}.agent-office__detail-row>span{color:hsl(var(--muted-foreground))}.agent-office__detail-row>strong{min-width:0;font:500 10px / 1.3 var(--font-mono);text-align:right;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.agent-office__target-code{overflow-wrap:anywhere;color:hsl(var(--foreground));background:hsl(var(--muted) / .7);font:400 10px / 1.45 var(--font-mono);border-radius:7px;padding:9px;display:block}.agent-office__file-target{border:1px solid hsl(var(--border) / .68);border-radius:6px;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:7px;margin-top:6px;padding:7px;display:grid}.agent-office__file-target svg{width:13px;height:13px;color:hsl(var(--info))}.agent-office__file-target span{font:400 9px / 1.2 var(--font-mono);text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.agent-office__file-target strong{color:hsl(var(--info));font:500 8px / 1 var(--font-mono)}.agent-office__metric-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;display:grid}.agent-office__metric-grid>div{background:hsl(var(--muted) / .62);border-radius:7px;flex-direction:column;min-width:0;padding:9px;display:flex}.agent-office__metric-grid strong{font:500 12px / 1.2 var(--font-mono);text-overflow:ellipsis;overflow:hidden}.agent-office__metric-grid span{color:hsl(var(--muted-foreground));margin-top:3px;font-size:8px}.agent-office__detail-section pre{border:1px solid hsl(var(--border));max-height:260px;color:hsl(var(--foreground) / .9);background:hsl(var(--popover));font:400 9px / 1.55 var(--font-mono);white-space:pre-wrap;overflow-wrap:anywhere;border-radius:7px;margin:0;padding:10px;overflow:auto}.agent-office__mail-body{border:1px solid hsl(var(--border));color:hsl(var(--foreground) / .88);background:hsl(var(--muted) / .45);font:400 11px / 1.55 var(--font-sans);white-space:pre-wrap;border-radius:8px;padding:10px}.agent-office__task-body{border:1px solid hsl(var(--border));color:hsl(var(--foreground) / .9);background:hsl(var(--muted) / .42);font:400 11px / 1.55 var(--font-sans);white-space:pre-wrap;border-radius:8px;padding:10px}.agent-office__todo-detail-list{flex-direction:column;gap:6px;display:flex}.agent-office__todo-detail{border:1px solid hsl(var(--border));background:hsl(var(--muted) / .3);border-radius:8px;align-items:flex-start;gap:8px;padding:7px 8px;display:flex}.agent-office__todo-detail>span{border:1px solid hsl(var(--muted-foreground));border-radius:50%;flex:none;width:7px;height:7px;margin-top:3px}.agent-office__todo-detail.is-in_progress>span{border-color:hsl(var(--success));background:hsl(var(--success));box-shadow:0 0 0 3px hsl(var(--success) / .1)}.agent-office__todo-detail.is-completed{opacity:.68}.agent-office__todo-detail.is-completed>span{border-color:hsl(var(--success));background:hsl(var(--success))}.agent-office__todo-detail>div{flex-direction:column;gap:3px;min-width:0;display:flex}.agent-office__todo-detail strong{font:500 10px / 1.35 var(--font-sans)}.agent-office__todo-detail small{color:hsl(var(--muted-foreground));font:400 7px / 1 var(--font-mono);text-transform:uppercase}@keyframes agent-office-arrive{0%{opacity:.4;transform:translate(42px)rotate(1deg)}to{opacity:1;transform:translate(0)rotate(0)}}@keyframes agent-office-mail-in{0%{opacity:0;transform:translate(72px)rotate(4deg)}to{opacity:1;transform:translate(0)rotate(0)}}@keyframes agent-office-mail-out{0%{opacity:0;transform:translate(-42px)rotate(-3deg)}to{opacity:1;transform:translate(0)rotate(0)}}@keyframes agent-office-belt{to{background-position:70px 0}}@keyframes agent-office-brief-arrive{0%{left:-30%}to{left:118%}}@keyframes agent-office-sync-line{to{background-position:-200% 0}}@keyframes agent-office-telemetry-wait{0%,to{opacity:.42}50%{opacity:1}}@keyframes agent-office-task-assigned{0%{opacity:0;transform:translate(-12px)rotate(-1deg)}to{opacity:1;transform:translate(0)rotate(0)}}@keyframes agent-office-window-glow{0%{opacity:.58}to{opacity:1;box-shadow:inset 0 0 8px hsl(var(--info) / .14)}}@keyframes agent-office-plant-sway{0%{transform:rotate(calc(var(--plant-angle) - 3deg)) scale(var(--plant-scale))}to{transform:rotate(calc(var(--plant-angle) + 3deg)) scale(var(--plant-scale))}}@keyframes agent-office-monitor-scan{0%{background-position:0 -110%}to{background-position:0 110%}}@keyframes agent-office-mug-steam{0%,18%{opacity:0;transform:translateY(3px)translate(0)}42%{opacity:.55}78%,to{opacity:0;transform:translateY(-6px)translate(2px)}}@keyframes agent-office-blink{0%,44%,48%,to{transform:scaleY(1)}46%{transform:scaleY(.12)}}@keyframes agent-office-terminal-bars{0%{opacity:.42;transform:scaleY(.45)}to{opacity:1;transform:scaleY(1.15)}}@keyframes agent-office-lane-arrive{0%{opacity:0;transform:translateY(8px)scale(.992)}to{opacity:1;transform:translateY(0)scale(1)}}@keyframes agent-office-memory-pulse{0%,to{opacity:.35;transform:scale(.72)rotate(0)}50%{opacity:1;transform:scale(1.08)rotate(8deg)}}@keyframes agent-office-web-signal{0%{opacity:0;transform:rotate(-38deg)scale(.72)}45%{opacity:.82}to{opacity:0;transform:rotate(-38deg)scale(1.08)}}@keyframes agent-office-inspect{0%{transform:translate(0)rotate(-4deg)}to{transform:translate(13px,3px)rotate(5deg)}}@keyframes agent-office-inspect-handle{0%{transform:translate(0)rotate(42deg)}to{transform:translate(13px,3px)rotate(51deg)}}@keyframes agent-office-write-stroke{0%{transform:translate(-4px)rotate(-27deg)}to{transform:translate(5px)rotate(-18deg)}}@keyframes agent-office-charm-blink{0%,45%,49%,to{transform:scaleY(1)}47%{transform:scaleY(.12)}}@keyframes agent-office-charm-bob{0%,76%,to{transform:translateY(0)rotate(0)}84%,91%{transform:translateY(-2px)rotate(-5deg)}}@keyframes agent-office-yawn-head{0%,72%,to{transform:translateY(0)rotate(0)}78%,90%{transform:translateY(-2px)rotate(-7deg)}}@keyframes agent-office-yawn-mouth{0%,72%,to{height:2px;transform:scale(1)}80%,88%{height:7px;transform:scale(1.15)}}@keyframes agent-office-idle-stretch{0%,72%,to{transform:rotate(-11deg)}80%,90%{transform:translate(2px,-7px)rotate(-34deg)}}@keyframes agent-office-type{to{transform:rotate(-4deg)translateY(2px)}}@keyframes agent-office-nod{0%,70%,to{transform:rotate(0)}82%{transform:rotate(3deg)}}@keyframes agent-office-ring{0%{opacity:.42;transform:scale(.82)}to{opacity:0;transform:scale(1.18)}}@keyframes agent-office-pulse{0%,to{opacity:.55;transform:scale(.8)}50%{opacity:1;transform:scale(1)}}@keyframes agent-office-drawer{0%{opacity:.5;transform:translate(35px)}to{opacity:1;transform:translate(0)}}@media (width<=1040px){.agent-office__briefing{grid-template-columns:1fr}.agent-office__client-header{flex-wrap:wrap}.agent-office__client-stats{justify-content:flex-start;width:100%}.agent-office__column-headings,.agent-office__lane{grid-template-columns:150px minmax(390px,1fr) 230px}.agent-office__summary>div{min-width:72px}.agent-office__summary span{display:none}.agent-office__title{min-width:185px}.agent-office__title h1{max-width:200px}}@media (width<=820px){.agent-office__header{flex-wrap:wrap;gap:8px}.agent-office__summary{order:3;justify-content:flex-start;width:100%}.agent-office__summary>div{padding-block:3px}.agent-office__live-pill{margin-left:auto}.agent-office__column-headings{display:none}.agent-office__lane{grid-template-columns:132px minmax(380px,1fr)}.agent-office__history{display:none}.agent-office__floor{overflow-x:auto}}@media (prefers-reduced-motion:reduce){.agent-office *,.agent-office :before,.agent-office :after{scroll-behavior:auto;transition-duration:.001ms;animation-duration:.001ms;animation-iteration-count:1}}