@wrongstack/webui 0.297.0 → 0.298.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (546) hide show
  1. package/dist/assets/AgentRosterView-C26RCdot.js +11 -0
  2. package/dist/assets/{AnalyticsDashboard-CkceglT6.js → AnalyticsDashboard-CEjjV3bX.js} +1 -1
  3. package/dist/assets/AudienceMemoryPanel-CnfZC8x0.js +3 -0
  4. package/dist/assets/{ChangesView-DouwIaDk.js → ChangesView-D0BiTbs8.js} +1 -1
  5. package/dist/assets/ChronicleDashboard-BZ4XOcvf.js +1 -0
  6. package/dist/assets/CodeEditor-BlqaT56D.js +1 -0
  7. package/dist/assets/CodeMap-Bj5tjjW5.js +1 -0
  8. package/dist/assets/{CronJobsPanel-CAImDL8t.js → CronJobsPanel-F6nhZtfg.js} +1 -1
  9. package/dist/assets/DeadCodeScanPanel-C9sLNUUc.js +2 -0
  10. package/dist/assets/{DebugDashboard-DLNPZIEI.js → DebugDashboard-D8BLcLjI.js} +1 -1
  11. package/dist/assets/{DesignGalleryView-D0azMq2e.js → DesignGalleryView-B8mE5nGy.js} +1 -1
  12. package/dist/assets/GoalView-DIx7Zr4a.js +1 -0
  13. package/dist/assets/KanbanView-DshzDwq1.js +3 -0
  14. package/dist/assets/MailboxDetailView-BJXpXjtm.js +1 -0
  15. package/dist/assets/MemoryManager-B-S5oREO.js +1 -0
  16. package/dist/assets/{ModelPicker-CN-UD3lc.js → ModelPicker-CNHhT2SO.js} +1 -1
  17. package/dist/assets/OfficeMapPanel-CBN9uG80.js +4 -0
  18. package/dist/assets/{ProcessMonitor-ButM8C0T.js → ProcessMonitor-Cc8LsfTh.js} +1 -1
  19. package/dist/assets/QueuePanel-B0NXFwEt.js +1 -0
  20. package/dist/assets/{RefreshDebugView-DVvWsh9A.js → RefreshDebugView-DLst_piS.js} +1 -1
  21. package/dist/assets/SageTabs-NwMcr4Pq.js +2 -0
  22. package/dist/assets/SddHub-CpRHXmjm.js +2 -0
  23. package/dist/assets/SessionsDashboard-C5dXb0iJ.js +1 -0
  24. package/dist/assets/SetupScreen-B81fcNgP.js +1 -0
  25. package/dist/assets/SkillDetailView-BTvgE_MD.js +3 -0
  26. package/dist/assets/{SpecsView-BJs_okSx.js → SpecsView-DhuaZcOl.js} +1 -1
  27. package/dist/assets/TechStackView-BXmfl2qY.js +1 -0
  28. package/dist/assets/{TerminalPanel-W2V0X7b9.js → TerminalPanel-DjruTcb6.js} +1 -1
  29. package/dist/assets/{Toaster-CbcX_Cou.js → Toaster-BmyghnqJ.js} +1 -1
  30. package/dist/assets/{activity-CbbZyUMG.js → activity-Bo6DncWg.js} +1 -1
  31. package/dist/assets/{activity-C4z6-WoZ.js → activity-C34aPcFU.js} +1 -1
  32. package/dist/assets/{activity-B4Ngvkan.js → activity-CBdzUJQ_.js} +1 -1
  33. package/dist/assets/{activity-B8uejnae.js → activity-CLYyxeC6.js} +1 -1
  34. package/dist/assets/{activity-qoJ3grs0.js → activity-Cv_EIWjY.js} +1 -1
  35. package/dist/assets/{activity-B5MvPWYV.js → activity-Wr0_Gb8A.js} +1 -1
  36. package/dist/assets/{activity-D57y5l1T.js → activity-kCY0dGRC.js} +1 -1
  37. package/dist/assets/{button-uGqXvobk.js → button-BMECp1cg.js} +1 -1
  38. package/dist/assets/{chat-Du7n7HZ7.js → chat-CRmMDzCb.js} +1 -1
  39. package/dist/assets/{chat-VkTBQmmx.js → chat-CwnuX7tG.js} +1 -1
  40. package/dist/assets/{chat-BJzPxfyr.js → chat-DLn1hY01.js} +1 -1
  41. package/dist/assets/{chat-IRKmQ6we.js → chat-DSEq1Bdz.js} +1 -1
  42. package/dist/assets/{chat-C7ybebfi.js → chat-DxLD17ER.js} +1 -1
  43. package/dist/assets/{chat-BRBVFl4h.js → chat-DzPxYALH.js} +1 -1
  44. package/dist/assets/{chat-Bkom8vQo.js → chat-OunddzYy.js} +1 -1
  45. package/dist/assets/chat-store-B2CjP2Zl.js +17 -0
  46. package/dist/assets/{codemap-activity-store-DP3mCZu1.js → codemap-activity-store-Cz0_AHqt.js} +1 -1
  47. package/dist/assets/codemap-index-store-B-XLZpJu.js +1 -0
  48. package/dist/assets/common-BfVFjVhf.js +1 -0
  49. package/dist/assets/common-C5hY-d_0.js +1 -0
  50. package/dist/assets/{dialog-CT1PTjzK.js → dialog-BJef9ZZo.js} +1 -1
  51. package/dist/assets/{empty-state-CdyXy96A.js → empty-state-BGzRrNXI.js} +1 -1
  52. package/dist/assets/{i18n-1BkaqMgr.js → i18n-2wGPPdl_.js} +2 -2
  53. package/dist/assets/index-DeA8UyiB.css +1 -0
  54. package/dist/assets/index-x6-rLl5H.js +132 -0
  55. package/dist/assets/{input-B-VCX2sG.js → input-Bd10nfMj.js} +1 -1
  56. package/dist/assets/{mailbox-store-DVoNbOZr.js → mailbox-store-D3omLzBk.js} +1 -1
  57. package/dist/assets/markdown-sSmz-Ua_.js +44 -0
  58. package/dist/assets/progress-ring-BEULkQ1r.js +1 -0
  59. package/dist/assets/{roster-ws-DXm0krqH.js → roster-ws-BmV_3U6w.js} +1 -1
  60. package/dist/assets/session-store-ZMNU48xK.js +1 -0
  61. package/dist/assets/settings-BF0lRxlj.js +1 -0
  62. package/dist/assets/settings-CP6cwqHD.js +1 -0
  63. package/dist/assets/settings-D0rWEhMg.js +1 -0
  64. package/dist/assets/settings-DFCaP02p.js +1 -0
  65. package/dist/assets/settings-DHix1ZPL.js +1 -0
  66. package/dist/assets/{settings-DEmKlLmn.js → settings-eEzjNzsC.js} +1 -1
  67. package/dist/assets/settings-kp_aIgcX.js +1 -0
  68. package/dist/assets/{shared-jvJxtKc5.js → shared-CrX8iE-U.js} +1 -1
  69. package/dist/assets/stores-DyQOSkkD.js +7 -0
  70. package/dist/assets/ui-store-di6oY7cy.js +1 -0
  71. package/dist/assets/useWebSocket-BVFPigcY.js +28 -0
  72. package/dist/assets/{utils-CN2sfDVP.js → utils-CwJvjOcH.js} +1 -1
  73. package/dist/assets/{vendor-2VBBgNb5.js → vendor-BTTkQ9Tn.js} +28 -28
  74. package/dist/assets/{view-navigation-Cgy5xh9q.js → view-navigation-BMRzqGbq.js} +1 -1
  75. package/dist/assets/ws-client-B0-KwuTK.js +1 -0
  76. package/dist/components/ChatInput/refine-panel-host.d.ts +9 -1
  77. package/dist/components/DeadCodeScanPanel/DeadCodeScanPanel.d.ts +1 -3
  78. package/dist/components/MemoryManager/MemoryInjectorPanel.d.ts +19 -0
  79. package/dist/components/PanelSuspense.d.ts +8 -0
  80. package/dist/components/SettingsPanel/DisplaySection.d.ts +20 -0
  81. package/dist/components/SettingsPanel/PluginToggleList.d.ts +11 -1
  82. package/dist/components/ViewRouter.d.ts +12 -0
  83. package/dist/components/WorkbenchTopbar.d.ts +53 -0
  84. package/dist/components/codemap-model.d.ts +2 -0
  85. package/dist/hooks/useViewport.d.ts +38 -0
  86. package/dist/hooks/useWebSocket.d.ts +1 -0
  87. package/dist/hooks/ws-handlers/misc-handlers.d.ts +1 -0
  88. package/dist/index.html +25 -26
  89. package/dist/index.js +58857 -57378
  90. package/dist/lib/sage-block.d.ts +18 -23
  91. package/dist/lib/view-navigation.d.ts +1 -1
  92. package/dist/lib/ws-client.d.ts +16 -8
  93. package/dist/providers.json +10 -0
  94. package/dist/stores/chat-store.d.ts +36 -3
  95. package/dist/stores/config-store.d.ts +0 -2
  96. package/dist/stores/local-prefs.d.ts +22 -2
  97. package/dist/stores/session-store.d.ts +3 -0
  98. package/dist/stores/types.d.ts +2 -1
  99. package/dist/stores/ui-store.d.ts +8 -1
  100. package/dist/types/client-message.d.ts +1 -0
  101. package/dist/types/connections.d.ts +7 -1
  102. package/dist/types/server-message.d.ts +11 -0
  103. package/dist/types/system.d.ts +4 -0
  104. package/package.json +11 -9
  105. package/dist/App.d.ts.map +0 -1
  106. package/dist/assets/AgentRosterView-Cje2NBtU.js +0 -11
  107. package/dist/assets/AudienceMemoryPanel-DB-8ISNP.js +0 -3
  108. package/dist/assets/ChronicleDashboard-B4Khm6hu.js +0 -1
  109. package/dist/assets/CodeEditor-CrKbA5s8.js +0 -1
  110. package/dist/assets/CodeMap-Dz8yNlUe.js +0 -1
  111. package/dist/assets/DeadCodeScanPanel-C5ehBTQF.js +0 -2
  112. package/dist/assets/GoalView-gtQRK78W.js +0 -1
  113. package/dist/assets/KanbanView-BXKe19EI.js +0 -3
  114. package/dist/assets/LazyMarkdown-BGwFjYKr.js +0 -3
  115. package/dist/assets/MailboxDetailView-D4fXipos.js +0 -1
  116. package/dist/assets/MemoryManager-D_rquas9.js +0 -1
  117. package/dist/assets/OfficeMapPanel-CJFrTNmg.js +0 -4
  118. package/dist/assets/QueuePanel-C5oihwYM.js +0 -1
  119. package/dist/assets/SageTabs-C9vAgvCD.js +0 -2
  120. package/dist/assets/SddHub-D_nsWjuM.js +0 -2
  121. package/dist/assets/SessionsDashboard-DdwU3Ma5.js +0 -1
  122. package/dist/assets/SetupScreen-CQCfLdPI.js +0 -1
  123. package/dist/assets/SkillDetailView-mVxi-9jo.js +0 -3
  124. package/dist/assets/TechStackView-BZ4M7TYc.js +0 -1
  125. package/dist/assets/chat-store-CM1dMeuY.js +0 -17
  126. package/dist/assets/codemap-index-store-DyAe3ZYJ.js +0 -1
  127. package/dist/assets/common-D8_r1x8x.js +0 -1
  128. package/dist/assets/common-suUxW9sA.js +0 -1
  129. package/dist/assets/index-BPfIz78e.js +0 -131
  130. package/dist/assets/index-BlceaIyu.css +0 -1
  131. package/dist/assets/markdown-L6DLSM7f.js +0 -44
  132. package/dist/assets/progress-ring-CFOvGxw7.js +0 -1
  133. package/dist/assets/session-store-BsNYnfOc.js +0 -1
  134. package/dist/assets/settings-C5F2tQ7C.js +0 -1
  135. package/dist/assets/settings-Cdk8i_p6.js +0 -1
  136. package/dist/assets/settings-D6wFOw5n.js +0 -1
  137. package/dist/assets/settings-DCEOkxYE.js +0 -1
  138. package/dist/assets/settings-DsflqNn0.js +0 -1
  139. package/dist/assets/settings-skShEZ2B.js +0 -1
  140. package/dist/assets/stores-mpa0202y.js +0 -6
  141. package/dist/assets/ui-store-CS-njcmT.js +0 -1
  142. package/dist/assets/useWebSocket-Dh3aAFDE.js +0 -28
  143. package/dist/assets/ws-client-WVGn8ORh.js +0 -1
  144. package/dist/components/AgentOfficeDetails.d.ts.map +0 -1
  145. package/dist/components/AgentOfficeView/model.d.ts.map +0 -1
  146. package/dist/components/AgentOfficeView.d.ts.map +0 -1
  147. package/dist/components/AgentRosterCatalogTab.d.ts.map +0 -1
  148. package/dist/components/AgentRosterChrome.d.ts.map +0 -1
  149. package/dist/components/AgentRosterLiveTab.d.ts.map +0 -1
  150. package/dist/components/AgentRosterSelfLearningTab.d.ts.map +0 -1
  151. package/dist/components/AgentRosterView.d.ts.map +0 -1
  152. package/dist/components/AgentRuntimePolicyEditor.d.ts.map +0 -1
  153. package/dist/components/AgentTranscript.d.ts.map +0 -1
  154. package/dist/components/AgentsMonitor.d.ts.map +0 -1
  155. package/dist/components/AgentsPage/format.d.ts.map +0 -1
  156. package/dist/components/AgentsPage.d.ts.map +0 -1
  157. package/dist/components/AnalyticsDashboard.d.ts.map +0 -1
  158. package/dist/components/AudienceMemoryPanel.d.ts.map +0 -1
  159. package/dist/components/AutonomyPicker.d.ts.map +0 -1
  160. package/dist/components/AvailabilityCalendarEditor.d.ts.map +0 -1
  161. package/dist/components/BoardView.d.ts.map +0 -1
  162. package/dist/components/ChangesView.d.ts.map +0 -1
  163. package/dist/components/ChatInput/code-detect.d.ts.map +0 -1
  164. package/dist/components/ChatInput/draft-token-counter.d.ts.map +0 -1
  165. package/dist/components/ChatInput/file-mention-picker.d.ts.map +0 -1
  166. package/dist/components/ChatInput/image-attach-control.d.ts.map +0 -1
  167. package/dist/components/ChatInput/image-attachments.d.ts.map +0 -1
  168. package/dist/components/ChatInput/queued-messages.d.ts.map +0 -1
  169. package/dist/components/ChatInput/refine-panel-host.d.ts.map +0 -1
  170. package/dist/components/ChatInput/slash-commands.d.ts.map +0 -1
  171. package/dist/components/ChatInput/slash-popup.d.ts.map +0 -1
  172. package/dist/components/ChatInput/slash-routing.d.ts.map +0 -1
  173. package/dist/components/ChatInput/stop-controls.d.ts.map +0 -1
  174. package/dist/components/ChatInput/use-paste-drop.d.ts.map +0 -1
  175. package/dist/components/ChatInput.d.ts.map +0 -1
  176. package/dist/components/ChatView/ThinkingBubble.d.ts.map +0 -1
  177. package/dist/components/ChatView/index.d.ts.map +0 -1
  178. package/dist/components/ChatView/utils.d.ts.map +0 -1
  179. package/dist/components/ChatView.d.ts.map +0 -1
  180. package/dist/components/CheckpointTimeline.d.ts.map +0 -1
  181. package/dist/components/ChipMultiSelect.d.ts.map +0 -1
  182. package/dist/components/ChronicleDashboard.d.ts.map +0 -1
  183. package/dist/components/ChroniclePipelineStrip.d.ts.map +0 -1
  184. package/dist/components/CodeEditor.d.ts.map +0 -1
  185. package/dist/components/CodeMap.d.ts.map +0 -1
  186. package/dist/components/CodeMapActivityDrawer.d.ts.map +0 -1
  187. package/dist/components/CodeMapActivityHelpers.d.ts.map +0 -1
  188. package/dist/components/CodeMapActivityStreamPanel.d.ts.map +0 -1
  189. package/dist/components/CodeMapCanvasSurface.d.ts.map +0 -1
  190. package/dist/components/CodeMapCanvasToolbar.d.ts.map +0 -1
  191. package/dist/components/CodeMapConfig.d.ts.map +0 -1
  192. package/dist/components/CodeMapDirectoryTree.d.ts.map +0 -1
  193. package/dist/components/CodeMapFlowState.d.ts.map +0 -1
  194. package/dist/components/CodeMapHeader.d.ts.map +0 -1
  195. package/dist/components/CodeMapLiveOverlay.d.ts.map +0 -1
  196. package/dist/components/CodeMapRelationInspector.d.ts.map +0 -1
  197. package/dist/components/CodeMapRelations.d.ts.map +0 -1
  198. package/dist/components/CodeMapSearchResults.d.ts.map +0 -1
  199. package/dist/components/CodeMapSelectedNodeSummary.d.ts.map +0 -1
  200. package/dist/components/CodeMapTreeSidebar.d.ts.map +0 -1
  201. package/dist/components/CodeMapVisuals.d.ts.map +0 -1
  202. package/dist/components/CollabPanel.d.ts.map +0 -1
  203. package/dist/components/CommandPalette/export-utils.d.ts.map +0 -1
  204. package/dist/components/CommandPalette/index.d.ts.map +0 -1
  205. package/dist/components/CommandPalette.d.ts.map +0 -1
  206. package/dist/components/ConfirmDialog.d.ts.map +0 -1
  207. package/dist/components/ConfirmModal.d.ts.map +0 -1
  208. package/dist/components/ConnectionBanner.d.ts.map +0 -1
  209. package/dist/components/ContextBar.d.ts.map +0 -1
  210. package/dist/components/ContextBreakdownModal.d.ts.map +0 -1
  211. package/dist/components/ContextDashboard.d.ts.map +0 -1
  212. package/dist/components/ContextMemoryMonitor.d.ts.map +0 -1
  213. package/dist/components/ContextModePicker.d.ts.map +0 -1
  214. package/dist/components/CostChip.d.ts.map +0 -1
  215. package/dist/components/CronJobsPanel.d.ts.map +0 -1
  216. package/dist/components/CronTrigger.d.ts.map +0 -1
  217. package/dist/components/CustomRosterPanel.d.ts.map +0 -1
  218. package/dist/components/DeadCodeScanPanel/DeadCodeScanPanel.d.ts.map +0 -1
  219. package/dist/components/DebugDashboard.d.ts.map +0 -1
  220. package/dist/components/DependencyGraph.d.ts.map +0 -1
  221. package/dist/components/DesignGalleryView.d.ts.map +0 -1
  222. package/dist/components/DiffView.d.ts.map +0 -1
  223. package/dist/components/ErrorBoundary.d.ts.map +0 -1
  224. package/dist/components/FallbackEditor.d.ts.map +0 -1
  225. package/dist/components/FileActivityDrawer.d.ts.map +0 -1
  226. package/dist/components/FileExplorer.d.ts.map +0 -1
  227. package/dist/components/FilePicker.d.ts.map +0 -1
  228. package/dist/components/FileReferenceChip.d.ts.map +0 -1
  229. package/dist/components/FleetMonitor.d.ts.map +0 -1
  230. package/dist/components/FleetPanel.d.ts.map +0 -1
  231. package/dist/components/GoalPanel.d.ts.map +0 -1
  232. package/dist/components/GoalView.d.ts.map +0 -1
  233. package/dist/components/InspectorPanel.d.ts.map +0 -1
  234. package/dist/components/KanbanAgentRunPanel.d.ts.map +0 -1
  235. package/dist/components/KanbanBoardChrome.d.ts.map +0 -1
  236. package/dist/components/KanbanBoardSidebar.d.ts.map +0 -1
  237. package/dist/components/KanbanBoardState.d.ts.map +0 -1
  238. package/dist/components/KanbanBoundaryEditor.d.ts.map +0 -1
  239. package/dist/components/KanbanCleanerAlert.d.ts.map +0 -1
  240. package/dist/components/KanbanColumnView.d.ts.map +0 -1
  241. package/dist/components/KanbanDecompositionPanel.d.ts.map +0 -1
  242. package/dist/components/KanbanQueueHealthBar.d.ts.map +0 -1
  243. package/dist/components/KanbanRunControls.d.ts.map +0 -1
  244. package/dist/components/KanbanTaskActivityRecorder.d.ts.map +0 -1
  245. package/dist/components/KanbanTaskCompletionChecks.d.ts.map +0 -1
  246. package/dist/components/KanbanTaskFields.d.ts.map +0 -1
  247. package/dist/components/KanbanTaskInspector.d.ts.map +0 -1
  248. package/dist/components/KanbanTaskOptions.d.ts.map +0 -1
  249. package/dist/components/KanbanTaskTree.d.ts.map +0 -1
  250. package/dist/components/KanbanVerificationDashboard.d.ts.map +0 -1
  251. package/dist/components/KanbanView.d.ts.map +0 -1
  252. package/dist/components/KanbanViewModeTabs.d.ts.map +0 -1
  253. package/dist/components/MailboxDetailView.d.ts.map +0 -1
  254. package/dist/components/MailboxPanel.d.ts.map +0 -1
  255. package/dist/components/MemoryManager/DeleteMemoryDialog.d.ts.map +0 -1
  256. package/dist/components/MemoryManager/MemoryDetail.d.ts.map +0 -1
  257. package/dist/components/MemoryManager/MemoryDrawer.d.ts.map +0 -1
  258. package/dist/components/MemoryManager/MemoryEditor.d.ts.map +0 -1
  259. package/dist/components/MemoryManager/MemoryFilters.d.ts.map +0 -1
  260. package/dist/components/MemoryManager/MemoryGraph.d.ts.map +0 -1
  261. package/dist/components/MemoryManager/MemoryInjectorTrace.d.ts +0 -3
  262. package/dist/components/MemoryManager/MemoryInjectorTrace.d.ts.map +0 -1
  263. package/dist/components/MemoryManager/MemoryLifecycleTrace.d.ts.map +0 -1
  264. package/dist/components/MemoryManager/MemoryList.d.ts.map +0 -1
  265. package/dist/components/MemoryManager/MemoryManagerEmpty.d.ts.map +0 -1
  266. package/dist/components/MemoryManager/SageTabs.d.ts.map +0 -1
  267. package/dist/components/MemoryManager/index.d.ts.map +0 -1
  268. package/dist/components/MemoryManager/selectors.d.ts.map +0 -1
  269. package/dist/components/MemoryManager/shared.d.ts.map +0 -1
  270. package/dist/components/MessageBubble/AttachmentGallery.d.ts.map +0 -1
  271. package/dist/components/MessageBubble/CopyButton.d.ts.map +0 -1
  272. package/dist/components/MessageBubble/ErrorBody.d.ts.map +0 -1
  273. package/dist/components/MessageBubble/LazyMarkdown.d.ts.map +0 -1
  274. package/dist/components/MessageBubble/StreamingMarkdown.d.ts.map +0 -1
  275. package/dist/components/MessageBubble/ToolInputView.d.ts.map +0 -1
  276. package/dist/components/MessageBubble/ToolLedgerCard.d.ts.map +0 -1
  277. package/dist/components/MessageBubble/index.d.ts.map +0 -1
  278. package/dist/components/MessageBubble/utils.d.ts.map +0 -1
  279. package/dist/components/MessageBubble.d.ts.map +0 -1
  280. package/dist/components/ModePicker.d.ts.map +0 -1
  281. package/dist/components/ModelPickDialog.d.ts.map +0 -1
  282. package/dist/components/ModelPicker.d.ts.map +0 -1
  283. package/dist/components/ModelSelectDialog.d.ts.map +0 -1
  284. package/dist/components/MonacoDiffView.d.ts.map +0 -1
  285. package/dist/components/NextStepsBar.d.ts.map +0 -1
  286. package/dist/components/OfficeMapCanvas/CanvasPanels.d.ts.map +0 -1
  287. package/dist/components/OfficeMapCanvas/Hud.d.ts.map +0 -1
  288. package/dist/components/OfficeMapCanvas/Overlays.d.ts.map +0 -1
  289. package/dist/components/OfficeMapCanvas/SelectedNodeDetailPanel.d.ts.map +0 -1
  290. package/dist/components/OfficeMapCanvas/edges.d.ts.map +0 -1
  291. package/dist/components/OfficeMapCanvas/nodes.d.ts.map +0 -1
  292. package/dist/components/OfficeMapCanvas/resolve.d.ts.map +0 -1
  293. package/dist/components/OfficeMapCanvas/use-recently-finished.d.ts.map +0 -1
  294. package/dist/components/OfficeMapCanvas/utils.d.ts.map +0 -1
  295. package/dist/components/OfficeMapCanvas.d.ts.map +0 -1
  296. package/dist/components/OfficeMapPanel.d.ts.map +0 -1
  297. package/dist/components/OfficeMapSettingsPanel.d.ts.map +0 -1
  298. package/dist/components/PhasePanel.d.ts.map +0 -1
  299. package/dist/components/PlanPanel.d.ts.map +0 -1
  300. package/dist/components/ProcessMonitor.d.ts.map +0 -1
  301. package/dist/components/PromptLibraryModal.d.ts.map +0 -1
  302. package/dist/components/ProviderWaitingRoom.d.ts.map +0 -1
  303. package/dist/components/QueuePanel.d.ts.map +0 -1
  304. package/dist/components/QuickModelSwitcher.d.ts.map +0 -1
  305. package/dist/components/QuickModelSwitcher.filter.d.ts.map +0 -1
  306. package/dist/components/RefinePanel.d.ts.map +0 -1
  307. package/dist/components/RefreshDebugView.d.ts.map +0 -1
  308. package/dist/components/SageMemoryCard.d.ts +0 -19
  309. package/dist/components/SageMemoryCard.d.ts.map +0 -1
  310. package/dist/components/SddActivityFeed.d.ts.map +0 -1
  311. package/dist/components/SddBoardView.d.ts.map +0 -1
  312. package/dist/components/SddDestroyDialog.d.ts.map +0 -1
  313. package/dist/components/SddFlowGraph.d.ts.map +0 -1
  314. package/dist/components/SddHub.d.ts.map +0 -1
  315. package/dist/components/SddKanbanView.d.ts.map +0 -1
  316. package/dist/components/SddTaskDrawer.d.ts.map +0 -1
  317. package/dist/components/SddWizard.d.ts.map +0 -1
  318. package/dist/components/SearchOverlay.d.ts.map +0 -1
  319. package/dist/components/SendButton.d.ts.map +0 -1
  320. package/dist/components/SessionWatchPanel.d.ts.map +0 -1
  321. package/dist/components/SessionsDashboard.d.ts.map +0 -1
  322. package/dist/components/SettingsPanel/BasicSettingsTabs.d.ts.map +0 -1
  323. package/dist/components/SettingsPanel/BrainSection.d.ts.map +0 -1
  324. package/dist/components/SettingsPanel/ChimeraSettingsPanel.d.ts.map +0 -1
  325. package/dist/components/SettingsPanel/ClearAllowlistDialog.d.ts.map +0 -1
  326. package/dist/components/SettingsPanel/ConnectionsHealthSection.d.ts.map +0 -1
  327. package/dist/components/SettingsPanel/FallbacksSection.d.ts.map +0 -1
  328. package/dist/components/SettingsPanel/FleetSection.d.ts.map +0 -1
  329. package/dist/components/SettingsPanel/IntegrationsSection.d.ts.map +0 -1
  330. package/dist/components/SettingsPanel/MCPSection.d.ts.map +0 -1
  331. package/dist/components/SettingsPanel/ModelSection.d.ts.map +0 -1
  332. package/dist/components/SettingsPanel/OAuthLoginSection.d.ts.map +0 -1
  333. package/dist/components/SettingsPanel/PluginToggleList.d.ts.map +0 -1
  334. package/dist/components/SettingsPanel/PreferenceControls.d.ts.map +0 -1
  335. package/dist/components/SettingsPanel/PreferenceToggle.d.ts.map +0 -1
  336. package/dist/components/SettingsPanel/ProviderModelsPanel.d.ts.map +0 -1
  337. package/dist/components/SettingsPanel/ProviderModelsPanel.filter.d.ts.map +0 -1
  338. package/dist/components/SettingsPanel/ProviderSection.d.ts.map +0 -1
  339. package/dist/components/SettingsPanel/RoutingSection.d.ts.map +0 -1
  340. package/dist/components/SettingsPanel/SecuritySection.d.ts.map +0 -1
  341. package/dist/components/SettingsPanel/ShadowSection.d.ts.map +0 -1
  342. package/dist/components/SettingsPanel/ToolsSection.d.ts.map +0 -1
  343. package/dist/components/SettingsPanel/brain-section-options.d.ts.map +0 -1
  344. package/dist/components/SettingsPanel/index.d.ts.map +0 -1
  345. package/dist/components/SettingsPanel/local-presets.d.ts.map +0 -1
  346. package/dist/components/SettingsPanel/official-servers.d.ts.map +0 -1
  347. package/dist/components/SettingsPanel/settings-panel-reducers.d.ts.map +0 -1
  348. package/dist/components/SettingsPanel/undo-send-decision.d.ts.map +0 -1
  349. package/dist/components/SettingsPanel.d.ts.map +0 -1
  350. package/dist/components/SetupScreen/CustomProviderSection.d.ts.map +0 -1
  351. package/dist/components/SetupScreen/ModelEditor.d.ts.map +0 -1
  352. package/dist/components/SetupScreen/ProviderKeyCard.d.ts.map +0 -1
  353. package/dist/components/SetupScreen/key-operation.d.ts.map +0 -1
  354. package/dist/components/SetupScreen/popular-providers.d.ts.map +0 -1
  355. package/dist/components/SetupScreen/relative-time.d.ts.map +0 -1
  356. package/dist/components/SetupScreen/types.d.ts.map +0 -1
  357. package/dist/components/SetupScreen.d.ts.map +0 -1
  358. package/dist/components/ShortcutsOverlay.d.ts.map +0 -1
  359. package/dist/components/SideEffectTimeline.d.ts.map +0 -1
  360. package/dist/components/SidePanel/AgentsPanel.d.ts.map +0 -1
  361. package/dist/components/SidePanel/ChangesPanel.d.ts.map +0 -1
  362. package/dist/components/SidePanel/DesignStudioPanel.d.ts.map +0 -1
  363. package/dist/components/SidePanel/SessionList.d.ts.map +0 -1
  364. package/dist/components/SidePanel/SessionPanel.d.ts.map +0 -1
  365. package/dist/components/SidePanel/SkillsList.d.ts.map +0 -1
  366. package/dist/components/SidePanel/WorktreesPanel.d.ts.map +0 -1
  367. package/dist/components/SidePanel/index.d.ts.map +0 -1
  368. package/dist/components/SkillDetailView.d.ts.map +0 -1
  369. package/dist/components/SpecsView.d.ts.map +0 -1
  370. package/dist/components/TaskActivityTimeline.d.ts.map +0 -1
  371. package/dist/components/TaskBoard.d.ts.map +0 -1
  372. package/dist/components/TaskCard.d.ts.map +0 -1
  373. package/dist/components/TaskExecutionAttempts.d.ts.map +0 -1
  374. package/dist/components/TaskIntelligencePanel.d.ts.map +0 -1
  375. package/dist/components/TaskRiskPanel.d.ts.map +0 -1
  376. package/dist/components/TaskVerificationSection.d.ts.map +0 -1
  377. package/dist/components/TasksPanel.d.ts.map +0 -1
  378. package/dist/components/TechStackView/DependencyDetail.d.ts.map +0 -1
  379. package/dist/components/TechStackView/DependencyTable.d.ts.map +0 -1
  380. package/dist/components/TechStackView/FindingsPanel.d.ts.map +0 -1
  381. package/dist/components/TechStackView/TechStackToolbar.d.ts.map +0 -1
  382. package/dist/components/TechStackView/index.d.ts.map +0 -1
  383. package/dist/components/TechStackView/shared.d.ts.map +0 -1
  384. package/dist/components/TerminalPanel.d.ts.map +0 -1
  385. package/dist/components/ThemeProvider.d.ts.map +0 -1
  386. package/dist/components/Toaster.d.ts.map +0 -1
  387. package/dist/components/TodosPanel.d.ts.map +0 -1
  388. package/dist/components/ToolGroup.d.ts.map +0 -1
  389. package/dist/components/ToolResult.d.ts.map +0 -1
  390. package/dist/components/UpdateBanner.d.ts.map +0 -1
  391. package/dist/components/VerificationReportPanel.d.ts.map +0 -1
  392. package/dist/components/WatchMessageBubble.d.ts.map +0 -1
  393. package/dist/components/WelcomeScreen.d.ts.map +0 -1
  394. package/dist/components/WorkDashboard.d.ts.map +0 -1
  395. package/dist/components/WorkspaceDock.d.ts.map +0 -1
  396. package/dist/components/WorktreeGraph.d.ts.map +0 -1
  397. package/dist/components/WorktreeLanes.d.ts.map +0 -1
  398. package/dist/components/WorktreeOrphans.d.ts.map +0 -1
  399. package/dist/components/activity-bar/index.d.ts.map +0 -1
  400. package/dist/components/activity-bar/nav.d.ts.map +0 -1
  401. package/dist/components/agent-roster-data.d.ts.map +0 -1
  402. package/dist/components/agents/AgentDetailSection.d.ts.map +0 -1
  403. package/dist/components/agents/AgentRosterCard.d.ts.map +0 -1
  404. package/dist/components/agents/FleetSummaryBar.d.ts.map +0 -1
  405. package/dist/components/codemap-model.d.ts.map +0 -1
  406. package/dist/components/context-editor/ContextWindowEditor.d.ts.map +0 -1
  407. package/dist/components/dashboard-primitives.d.ts.map +0 -1
  408. package/dist/components/index.d.ts.map +0 -1
  409. package/dist/components/monaco-theme.d.ts.map +0 -1
  410. package/dist/components/toaster-helpers.d.ts.map +0 -1
  411. package/dist/components/ui/PickerCardList.d.ts.map +0 -1
  412. package/dist/components/ui/api-key-display.d.ts.map +0 -1
  413. package/dist/components/ui/badge.d.ts.map +0 -1
  414. package/dist/components/ui/button.d.ts.map +0 -1
  415. package/dist/components/ui/concurrency-gauge.d.ts.map +0 -1
  416. package/dist/components/ui/dialog.d.ts.map +0 -1
  417. package/dist/components/ui/dropdown-menu.d.ts.map +0 -1
  418. package/dist/components/ui/empty-state.d.ts.map +0 -1
  419. package/dist/components/ui/event-timeline.d.ts.map +0 -1
  420. package/dist/components/ui/fleet-agent-row.d.ts.map +0 -1
  421. package/dist/components/ui/index.d.ts.map +0 -1
  422. package/dist/components/ui/input.d.ts.map +0 -1
  423. package/dist/components/ui/pagination.d.ts.map +0 -1
  424. package/dist/components/ui/progress-ring.d.ts.map +0 -1
  425. package/dist/components/ui/scroll-area.d.ts.map +0 -1
  426. package/dist/components/ui/sheet.d.ts.map +0 -1
  427. package/dist/components/ui/sparkline.d.ts.map +0 -1
  428. package/dist/components/ui/tabs.d.ts.map +0 -1
  429. package/dist/components/useAgentRosterData.d.ts.map +0 -1
  430. package/dist/components/useKanbanRegistrySessionIds.d.ts.map +0 -1
  431. package/dist/hooks/index.d.ts.map +0 -1
  432. package/dist/hooks/use-ws-handlers.d.ts.map +0 -1
  433. package/dist/hooks/useDesktopBridge.d.ts.map +0 -1
  434. package/dist/hooks/useF5Resilience.d.ts.map +0 -1
  435. package/dist/hooks/useFieldKeyboardNav.d.ts.map +0 -1
  436. package/dist/hooks/useFleetPolling.d.ts.map +0 -1
  437. package/dist/hooks/useGitInfo.d.ts.map +0 -1
  438. package/dist/hooks/useGlobalKeyboardShortcuts.d.ts.map +0 -1
  439. package/dist/hooks/useHorizontalScroll.d.ts.map +0 -1
  440. package/dist/hooks/useKanbanMeta.d.ts.map +0 -1
  441. package/dist/hooks/useMemoryForFile.d.ts.map +0 -1
  442. package/dist/hooks/usePagination.d.ts.map +0 -1
  443. package/dist/hooks/useProviderModels.d.ts.map +0 -1
  444. package/dist/hooks/useScrollPosition.d.ts.map +0 -1
  445. package/dist/hooks/useWebSocket.d.ts.map +0 -1
  446. package/dist/hooks/ws-handlers/chat-handlers.d.ts.map +0 -1
  447. package/dist/hooks/ws-handlers/coordinator-handlers.d.ts.map +0 -1
  448. package/dist/hooks/ws-handlers/files-mailbox-handlers.d.ts.map +0 -1
  449. package/dist/hooks/ws-handlers/fleet-handlers.d.ts.map +0 -1
  450. package/dist/hooks/ws-handlers/misc-handlers.d.ts.map +0 -1
  451. package/dist/hooks/ws-handlers/session-handlers.d.ts.map +0 -1
  452. package/dist/hooks/ws-handlers/techstack-handlers.d.ts.map +0 -1
  453. package/dist/hooks/ws-handlers.d.ts.map +0 -1
  454. package/dist/i18n/index.d.ts.map +0 -1
  455. package/dist/i18n/languages.d.ts.map +0 -1
  456. package/dist/index.css.map +0 -7
  457. package/dist/index.js.map +0 -7
  458. package/dist/lib/accent-colors.d.ts.map +0 -1
  459. package/dist/lib/agent-office.d.ts.map +0 -1
  460. package/dist/lib/agent-status.d.ts.map +0 -1
  461. package/dist/lib/chime.d.ts.map +0 -1
  462. package/dist/lib/color.d.ts.map +0 -1
  463. package/dist/lib/completion.d.ts.map +0 -1
  464. package/dist/lib/core-browser-shim.d.ts.map +0 -1
  465. package/dist/lib/default-prompt-pools.d.ts.map +0 -1
  466. package/dist/lib/desktop-host.d.ts.map +0 -1
  467. package/dist/lib/desktop-shell.d.ts.map +0 -1
  468. package/dist/lib/fallback-ref.d.ts.map +0 -1
  469. package/dist/lib/favicon.d.ts.map +0 -1
  470. package/dist/lib/file-icons.d.ts.map +0 -1
  471. package/dist/lib/goal.d.ts.map +0 -1
  472. package/dist/lib/index.d.ts.map +0 -1
  473. package/dist/lib/kanban-cleaner.d.ts.map +0 -1
  474. package/dist/lib/kanban-metadata.d.ts.map +0 -1
  475. package/dist/lib/kanban-verification.d.ts.map +0 -1
  476. package/dist/lib/model-calendar.d.ts.map +0 -1
  477. package/dist/lib/model-matrix-routes.d.ts.map +0 -1
  478. package/dist/lib/notify.d.ts.map +0 -1
  479. package/dist/lib/plugin-enablement.d.ts.map +0 -1
  480. package/dist/lib/roster-ws.d.ts.map +0 -1
  481. package/dist/lib/sage-block.d.ts.map +0 -1
  482. package/dist/lib/sdd-theme.d.ts.map +0 -1
  483. package/dist/lib/stream-coalescer.d.ts.map +0 -1
  484. package/dist/lib/terminal-dock.d.ts.map +0 -1
  485. package/dist/lib/tool-icon.d.ts.map +0 -1
  486. package/dist/lib/tool-summary.d.ts.map +0 -1
  487. package/dist/lib/utils.d.ts.map +0 -1
  488. package/dist/lib/view-navigation.d.ts.map +0 -1
  489. package/dist/lib/ws-client-actions.d.ts.map +0 -1
  490. package/dist/lib/ws-client-contracts.d.ts.map +0 -1
  491. package/dist/lib/ws-client-helpers.d.ts.map +0 -1
  492. package/dist/lib/ws-client-utils.d.ts.map +0 -1
  493. package/dist/lib/ws-client.d.ts.map +0 -1
  494. package/dist/main.d.ts.map +0 -1
  495. package/dist/protocol-compatibility.d.ts.map +0 -1
  496. package/dist/stores/auto-submit-streak.d.ts.map +0 -1
  497. package/dist/stores/chat-store.d.ts.map +0 -1
  498. package/dist/stores/codemap-activity-store.d.ts.map +0 -1
  499. package/dist/stores/codemap-index-store.d.ts.map +0 -1
  500. package/dist/stores/config-store.d.ts.map +0 -1
  501. package/dist/stores/context-editor-store.d.ts.map +0 -1
  502. package/dist/stores/coordinator-monitor-store.d.ts.map +0 -1
  503. package/dist/stores/cron-store.d.ts.map +0 -1
  504. package/dist/stores/file-reference-store.d.ts.map +0 -1
  505. package/dist/stores/file-store.d.ts.map +0 -1
  506. package/dist/stores/fleet-store.d.ts.map +0 -1
  507. package/dist/stores/git-changes-store.d.ts.map +0 -1
  508. package/dist/stores/git-info-store.d.ts.map +0 -1
  509. package/dist/stores/goal-assess-store.d.ts.map +0 -1
  510. package/dist/stores/goal-run-store.d.ts.map +0 -1
  511. package/dist/stores/goal-state-store.d.ts.map +0 -1
  512. package/dist/stores/goal-store.d.ts.map +0 -1
  513. package/dist/stores/history-store.d.ts.map +0 -1
  514. package/dist/stores/index.d.ts.map +0 -1
  515. package/dist/stores/kanban-store.d.ts.map +0 -1
  516. package/dist/stores/local-prefs.d.ts.map +0 -1
  517. package/dist/stores/mailbox-store.d.ts.map +0 -1
  518. package/dist/stores/memory-injector-store.d.ts.map +0 -1
  519. package/dist/stores/memory-lifecycle-store.d.ts.map +0 -1
  520. package/dist/stores/monitor-store.d.ts.map +0 -1
  521. package/dist/stores/office-map-store.d.ts.map +0 -1
  522. package/dist/stores/provider-status-store.d.ts.map +0 -1
  523. package/dist/stores/sdd-board-store.d.ts.map +0 -1
  524. package/dist/stores/sdd-wizard-store.d.ts.map +0 -1
  525. package/dist/stores/session-store.d.ts.map +0 -1
  526. package/dist/stores/side-effect-store.d.ts.map +0 -1
  527. package/dist/stores/specs-store.d.ts.map +0 -1
  528. package/dist/stores/techstack-store.d.ts.map +0 -1
  529. package/dist/stores/types.d.ts.map +0 -1
  530. package/dist/stores/ui-store.d.ts.map +0 -1
  531. package/dist/stores/viz-store.d.ts.map +0 -1
  532. package/dist/stores/worktree-store.d.ts.map +0 -1
  533. package/dist/types/brain.d.ts.map +0 -1
  534. package/dist/types/chronicle.d.ts.map +0 -1
  535. package/dist/types/client-message.d.ts.map +0 -1
  536. package/dist/types/collab.d.ts.map +0 -1
  537. package/dist/types/connections.d.ts.map +0 -1
  538. package/dist/types/goal-kanban-worktree.d.ts.map +0 -1
  539. package/dist/types/protocol-core.d.ts.map +0 -1
  540. package/dist/types/runtime.d.ts.map +0 -1
  541. package/dist/types/sage.d.ts.map +0 -1
  542. package/dist/types/server-message.d.ts.map +0 -1
  543. package/dist/types/skills-design.d.ts.map +0 -1
  544. package/dist/types/system.d.ts.map +0 -1
  545. package/dist/types.d.ts.map +0 -1
  546. package/dist/types.js.map +0 -7
@@ -1,42 +1,37 @@
1
1
  /**
2
- * sage-block — Split the SAGE memory-injection suffix from a tool result.
2
+ * sage-block — WebUI view over the canonical SAGE suffix splitter.
3
3
  *
4
4
  * The SAGE Memory Injector middleware (`packages/sage/src/middleware/tool-call-memory.ts`)
5
5
  * appends a `--- SAGE: ... ---` block to `payload.result.content` after the
6
- * normal tool output for triggers including `read`, `tree`, `grep`, `glob`,
7
- * `codebase_search`, `write`, `edit`, `replace`, and `patch`. The WebUI
8
- * `ToolResult` renderer wants to surface that block as a separate bordered
9
- * card instead of letting it leak into the body — this helper does the split.
6
+ * normal tool output. The WebUI `ToolResult` renderer surfaces that block as a
7
+ * separate bordered card instead of letting it leak into the body.
10
8
  *
11
- * The exact headings and memory-line regex mirror the TUI's
12
- * `packages/tui/src/components/history/sage-output-format.ts` so both
13
- * surfaces agree on what counts as a SAGE suffix and what to leave
14
- * untouched.
9
+ * ALL parsing logic (headings, memory-line regexes, block walk, truncation
10
+ * recovery) lives in ONE place: `@wrongstack/core/utils/sage-output-block`
11
+ * (`packages/core/src/utils/sage-output-block.ts`). This module is a thin
12
+ * adapter that keeps the historical `SageSplit` / `extractSageBlock` surface
13
+ * (with `cleanOutput`) so existing WebUI consumers don't churn. The TUI
14
+ * (`packages/tui/src/components/history/sage-output-format.ts`) delegates to
15
+ * the same canonical module — see `verify-sage-all-tools.test.ts` and
16
+ * `tests/lib/sage-block.test.ts` for the behavioral lock.
15
17
  */
18
+ import { SAGE_INJECTOR_HEADINGS, type SageOutputSplit } from '@wrongstack/core/utils/sage-output-block';
19
+ export { SAGE_INJECTOR_HEADINGS };
16
20
  export interface SageSplit {
17
21
  /** Tool result text with the SAGE block removed (trailing whitespace trimmed). */
18
22
  cleanOutput: string;
19
23
  /**
20
24
  * Extracted SAGE block lines including the `--- SAGE:` header. Empty when
21
- * the input contains no terminal SAGE suffix. Trailing blank/whitespace
22
- * lines are excluded so the rendered card doesn't show empty rows.
25
+ * the input contains no terminal SAGE suffix.
23
26
  */
24
27
  sageLines: string[];
25
28
  }
26
29
  /**
27
30
  * Find the last SAGE-injector suffix in `output` and split it away from the
28
- * normal tool text. Behaviour mirrors the TUI's `extractSageBlock`:
29
- *
30
- * - Scans from the end so a stray `--- SAGE:` inside the tool body never
31
- * accidentally steals the real trailing block.
32
- * - Every non-blank line after the header must match the memory-line regex;
33
- * otherwise the candidate is rejected (defensive against tools that emit
34
- * a `--- SAGE: ...` shaped header as legitimate output).
35
- * - Trailing blank/whitespace-only lines after the memory block are tolerated
36
- * (the injector + downstream serializers sometimes append them) but
37
- * excluded from `sageLines`.
38
- * - Real (non-blank) content after the SAGE block disqualifies the candidate
39
- * — the SAGE header is then treated as ordinary tool output.
31
+ * normal tool text. Behaviour is the canonical `splitSageOutputBlock` from
32
+ * `@wrongstack/core/utils/sage-output-block` (property names preserved for
33
+ * WebUI callers).
40
34
  */
41
35
  export declare function extractSageBlock(output: string): SageSplit;
36
+ export type { SageOutputSplit };
42
37
  //# sourceMappingURL=sage-block.d.ts.map
@@ -1,6 +1,6 @@
1
1
  import { type Activity } from '@/stores/ui-store';
2
2
  export type PanelMainView = 'chat' | 'files' | 'skill' | 'officemap' | 'changes' | 'mailbox' | 'design-gallery';
3
- export type MainView = 'goal' | 'kanban' | 'sddhub' | 'settings' | 'memory' | 'roster' | 'codemap' | 'techstack' | 'deadcode' | 'chronicle';
3
+ export type MainView = 'goal' | 'kanban' | 'sddhub' | 'settings' | 'memory' | 'roster' | 'codemap' | 'techstack' | 'chronicle';
4
4
  export type AppView = PanelMainView | MainView | 'sessions' | 'setup' | 'debug' | 'refresh-debug' | 'analytics';
5
5
  export declare const PANEL_VIEW_BY_ACTIVITY: Record<Activity, PanelMainView>;
6
6
  export declare const VIEW_ACTIVITY: Partial<Record<AppView, Activity>>;
@@ -5,6 +5,17 @@ import type { WSSendOptions } from './ws-client-contracts';
5
5
  import { type EventHandler, type WsStatus } from './ws-client-utils';
6
6
  export type { WSSendOptions } from './ws-client-contracts';
7
7
  export type { WsStatus };
8
+ /** Options for `sendMailboxMessage` — a mailbox message of a given intent
9
+ * type (btw, steer, note, …) routed to a target agent/role. Shared by the
10
+ * ws-client method, the `useWebSocket` wrapper, and UI prop contracts. */
11
+ export type WSMailboxSendOptions = {
12
+ type: 'note' | 'ask' | 'assign' | 'steer' | 'btw' | 'broadcast' | 'status' | 'result' | 'review';
13
+ to: string;
14
+ subject: string;
15
+ body: string;
16
+ priority?: 'low' | 'normal' | 'high' | undefined;
17
+ audience?: 'all' | 'leaders' | undefined;
18
+ };
8
19
  declare class WrongStackWebSocketClientBase {
9
20
  private ws;
10
21
  private url;
@@ -19,8 +30,12 @@ declare class WrongStackWebSocketClientBase {
19
30
  * late). */
20
31
  private socketGeneration;
21
32
  private messageQueue;
33
+ private messageQueueChars;
34
+ private readonly messageQueueWeights;
22
35
  private connectionState;
23
36
  private static readonly MAX_QUEUED_MESSAGES;
37
+ /** Count-only limits are ineffective for image/base64 payloads. */
38
+ private static readonly MAX_QUEUED_CHARS;
24
39
  private pendingConfirms;
25
40
  private sessionId;
26
41
  private sessionSwapPending;
@@ -83,14 +98,7 @@ declare class WrongStackWebSocketClientBase {
83
98
  sendMessage(content: string, images?: WSUserMessageImage[]): string;
84
99
  /** Send a mailbox message of the given type (btw, steer, note, etc.)
85
100
  * to a target agent/role. Returns the requestId for response tracking. */
86
- sendMailboxMessage(opts: {
87
- type: 'note' | 'ask' | 'assign' | 'steer' | 'btw' | 'broadcast' | 'status' | 'result' | 'review';
88
- to: string;
89
- subject: string;
90
- body: string;
91
- priority?: 'low' | 'normal' | 'high' | undefined;
92
- audience?: 'all' | 'leaders' | undefined;
93
- }): string;
101
+ sendMailboxMessage(opts: WSMailboxSendOptions): string;
94
102
  sendAbort(): void;
95
103
  getGitInfo(): void;
96
104
  /** Request the working-tree change set (file list for the Changes panel). */
@@ -44,6 +44,16 @@
44
44
  "url": "https://opencode.ai/go?ref=6VZAER87H4"
45
45
  }
46
46
  },
47
+ {
48
+ "id": "zyloo",
49
+ "name": "Zyloo",
50
+ "family": "openai-compatible",
51
+ "description": "Zyloo API — OpenAI-compatible with a 128-tool limit per request",
52
+ "icon": "🚀",
53
+ "color": "from-accent/12 to-accent/5 border-accent/30 hover:border-accent/50",
54
+ "keyPlaceholder": "zy-...",
55
+ "docsUrl": "https://docs.zyloo.io/"
56
+ },
47
57
  {
48
58
  "id": "openrouter",
49
59
  "name": "OpenRouter (Metered)",
@@ -1,5 +1,14 @@
1
1
  import type { ChatMessage } from './types.js';
2
2
  export declare const MAX_CHAT_RETAINED_BYTES: number;
3
+ /**
4
+ * How long a `btw` chip stays visible after entering the "SENT" state
5
+ * (i.e. after the wire-send succeeded at submit time). The chip is removed
6
+ * from the queue automatically after this delay so the user sees the
7
+ * queue → SENT → leave-screen transition instead of the chip getting
8
+ * stuck until the next `run.result` lands. UX spec (2026-08): "shortly
9
+ * after it is processed, the message should leave my screen".
10
+ */
11
+ export declare const BTW_DISPATCH_GRACE_MS = 1800;
3
12
  export declare const MAX_CHAT_FIELD_CHARS: number;
4
13
  interface ChatRetentionBudget {
5
14
  maxMessages?: number;
@@ -14,11 +23,33 @@ export declare function retainWebChatMessages(messages: readonly ChatMessage[],
14
23
  * interrupting (`btw`), or is held for after the run completes (`queue`). */
15
24
  export type QueueMode = 'btw' | 'steer' | 'queue';
16
25
  /** One entry in the message queue — the text plus how it was added.
17
- * `addedAt` powers the optional sort-by-newest toggle. */
26
+ * `addedAt` powers the optional sort-by-newest toggle.
27
+ * `itemId` is a monotonic per-store counter stamped by `enqueue`;
28
+ * the dispatched-chip grace-timer map and queue-filter operations
29
+ * key on it instead of `addedAt` so two enqueues sharing the same
30
+ * millisecond cannot cross-cancel each other. */
18
31
  export interface QueuedItem {
19
32
  text: string;
20
33
  mode: QueueMode;
21
34
  addedAt: number;
35
+ itemId: number;
36
+ /** True once a `btw` item has already been wire-sent via the mailbox
37
+ * (immediate mid-run dispatch). The run.result drain must skip re-sending
38
+ * these — they remain in the queue only as a visible "dispatched" chip. */
39
+ alreadyDispatched?: boolean | undefined;
40
+ /** Idempotency latch for the drain path. Set by
41
+ * `addBubbleFor` in chat-handlers.handleRunResult (drain emits
42
+ * a bubble for the popped front chip) and by `dequeueDrainable`
43
+ * (drain emits bubbles for every leading dispatched chip it skips
44
+ * past). The grace timer callback in `enqueue` *reads* this flag
45
+ * to gate bubble emission (`target.bubbleAdded !== true`) — without
46
+ * this gate, a second `run.result` landing inside the grace window
47
+ * would call `addBubbleFor(front)` a second time and emit a duplicate
48
+ * user bubble for the same chip. Reset implicitly on a fresh
49
+ * `enqueue` (the chip is constructed with `bubbleAdded` undefined).
50
+ * The flag is the idempotency latch for the drain path; the timer
51
+ * path reads it but does not write it. */
52
+ bubbleAdded?: boolean | undefined;
22
53
  /** Image attachments riding with the queued message. Kept as full data
23
54
  * URLs so the drain path can rebuild the wire payload + local bubble. */
24
55
  images?: Array<{
@@ -64,6 +95,7 @@ interface ChatState {
64
95
  data: string;
65
96
  mime: string;
66
97
  }>;
98
+ mode: QueueMode;
67
99
  } | null;
68
100
  /** Transient extended-thinking buffer. Populated by provider.thinking_delta
69
101
  * events and shown as a soft, ephemeral bubble below the chat tail while
@@ -117,15 +149,16 @@ interface ChatState {
117
149
  truncateAfter: (id: string) => void;
118
150
  addExecution: (exec: ToolExecution) => void;
119
151
  updateExecution: (id: string, updates: Partial<ToolExecution>) => void;
120
- enqueue: (text: string, mode?: QueueMode, images?: QueuedItem['images']) => void;
152
+ enqueue: (text: string, mode?: QueueMode, images?: QueuedItem['images'], alreadyDispatched?: boolean) => void;
121
153
  dequeue: () => QueuedItem | null;
154
+ dequeueDrainable: () => QueuedItem | null;
122
155
  removeQueued: (idx: number) => void;
123
156
  clearQueue: () => void;
124
157
  setRefining: (v: boolean) => void;
125
158
  setPendingRefinement: (text: string | null, images?: Array<{
126
159
  data: string;
127
160
  mime: string;
128
- }>) => void;
161
+ }>, mode?: QueueMode) => void;
129
162
  removeMessage: (id: string) => void;
130
163
  updateLastUserMessage: (text: string) => void;
131
164
  setRunStart: (s: {
@@ -43,7 +43,6 @@ export declare const useConfigStore: import("zustand").UseBoundStore<Omit<import
43
43
  provider: string;
44
44
  model: string;
45
45
  baseUrl: string | undefined;
46
- apiKey: string | undefined;
47
46
  theme: "dark" | "light" | "system";
48
47
  autoConnect: boolean;
49
48
  soundOnComplete: boolean;
@@ -57,7 +56,6 @@ export declare const useConfigStore: import("zustand").UseBoundStore<Omit<import
57
56
  provider: string;
58
57
  model: string;
59
58
  baseUrl: string | undefined;
60
- apiKey: string | undefined;
61
59
  theme: "dark" | "light" | "system";
62
60
  autoConnect: boolean;
63
61
  soundOnComplete: boolean;
@@ -98,8 +98,8 @@ export interface LocalPrefs {
98
98
  groupToolCalls: boolean;
99
99
  /** Show model reasoning/thinking blocks inline in the chat */
100
100
  showModelReasoning: boolean;
101
- /** Show the persistent agent-swarm fleet panel */
102
- showAgentSwarmPanel: boolean;
101
+ /** Agent swarm panel placement: bottom, sidebar, or off */
102
+ showAgentSwarmPanel: 'bottom' | 'sidebar' | 'off';
103
103
  /** Allow tools to access paths outside the project root (inverse of fsAccess). */
104
104
  allowOutsideProjectRoot: boolean;
105
105
  reasoningMode: 'auto' | 'on' | 'off';
@@ -133,6 +133,26 @@ export interface LocalPrefs {
133
133
  uiLocale: string;
134
134
  /** How Chimera review findings are handled. */
135
135
  chimeraAutoFix: 'off' | 'ask' | 'auto';
136
+ /** When true, the read tool includes codebase-index symbols in its output.
137
+ * Mirrors TUI field 42 (`readSymbols`) persisted as
138
+ * `autonomy.readAdvancedMode`. */
139
+ readSymbols: boolean;
140
+ /** When true, SAGE memory-inject blocks are surfaced in tool results.
141
+ * Mirrors TUI field 43 (`showSageMemoryInject`). */
142
+ showSageMemoryInject: boolean;
143
+ /** Minimum relation strength for SAGE memory injection. Mirrors TUI field
144
+ * 44 (`sageMemoryInjectThreshold`) persisted as
145
+ * `Sage.inject.relationFloor`. */
146
+ sageMemoryInjectThreshold: number;
147
+ /** Pre-refine grace countdown in SECONDS (TUI field 41). 0 = skip the
148
+ * countdown and run the refiner immediately. Presets:
149
+ * 0, 2, 3, 5, 8, 10. Distinct from `enhanceCountdownMs` (a TUI-internal
150
+ * ms value used by the simpleui RefinePanel animation). */
151
+ preRefineSeconds: number;
152
+ /** Minimum number of files before the multi-file diff summary footer
153
+ * renders above the per-file blocks. 0 disables the footer. Mirrors TUI
154
+ * field 21 (`multiDiffSummaryThreshold`). */
155
+ multiDiffSummaryThreshold: number;
136
156
  /** Master enable for `wstack-chimera`. Defaults to true (matches plugin: `cfg.enabled !== false`). */
137
157
  chimeraEnabled: boolean;
138
158
  /** Override provider id for the review subagent. Empty = use session provider. */
@@ -69,6 +69,8 @@ interface SessionState {
69
69
  latestVersion: string;
70
70
  /** True when a newer published version exists than appVersion. */
71
71
  updateAvailable: boolean;
72
+ /** Number of tools dropped from provider requests due to maxTools limit (0 = no limit or within limit). */
73
+ droppedTools: number;
72
74
  setSession: (session: SessionInfo | null) => void;
73
75
  updateUsage: (usage: Usage) => void;
74
76
  addCost: (cost: number) => void;
@@ -102,6 +104,7 @@ interface SessionState {
102
104
  latestVersion: string;
103
105
  updateAvailable: boolean;
104
106
  }) => void;
107
+ setDroppedTools: (count: number) => void;
105
108
  }
106
109
  export declare const useSessionStore: import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<SessionState>, "persist" | "setState"> & {
107
110
  setState(partial: Partial<SessionState> | SessionState | ((state: SessionState) => Partial<SessionState> | SessionState), replace?: false | undefined): unknown;
@@ -37,7 +37,8 @@ export interface ChatMessage {
37
37
  /**
38
38
  * SAGE Memory Injector block for this tool call — header line plus one line
39
39
  * per injected memory — delivered as a dedicated `tool.executed.sage` field
40
- * instead of being buried in `toolResult`. Rendered by `SageMemoryCard`.
40
+ * instead of being buried in `toolResult`. Rendered as a compact badge by
41
+ * `ToolResult`; full details in the `MemoryInjectorPanel` side drawer.
41
42
  *
42
43
  * Absent on replayed messages, where the block is still inline in the
43
44
  * persisted tool_result content; `extractSageBlock` recovers it there.
@@ -1,9 +1,10 @@
1
+ import type { QueuedItem, QueueMode } from './chat-store';
1
2
  import type { MailboxMessage } from './mailbox-store';
2
3
  export type Activity = 'chat' | 'agents' | 'files' | 'changes' | 'mailbox' | 'skills' | 'design' | 'worktrees' | 'officemap';
3
4
  /** Map any persisted (possibly legacy) activity value onto the current set. */
4
5
  export declare function coerceActivity(value: unknown): Activity;
5
6
  /** All valid currentView values. Kept in sync with the union on UIState. */
6
- declare const VIEWS: readonly ['chat', 'settings', 'memory', 'roster', 'context', 'goal', 'kanban', 'sddhub', 'files', 'changes', 'sessions', 'setup', 'skill', 'officemap', 'mailbox', 'debug', 'design-gallery', 'refresh-debug', 'analytics', 'codemap', 'techstack', 'deadcode', 'chronicle'];
7
+ declare const VIEWS: readonly ['chat', 'settings', 'memory', 'roster', 'context', 'goal', 'kanban', 'sddhub', 'files', 'changes', 'sessions', 'setup', 'skill', 'officemap', 'mailbox', 'debug', 'design-gallery', 'refresh-debug', 'analytics', 'codemap', 'techstack', 'chronicle', 'deadcode'];
7
8
  type View = (typeof VIEWS)[number];
8
9
  /** Coerce an arbitrary value onto the current view union. Used by migrate
9
10
  * when reading from localStorage so a stale value (e.g. 'context', a view
@@ -172,6 +173,12 @@ interface UIState {
172
173
  provider?: string | undefined;
173
174
  /** Model name running the refinement (e.g. "gpt-4o"). */
174
175
  model?: string | undefined;
176
+ /** Submit behavior to preserve across the refinement approval round-trip. */
177
+ mode?: QueueMode | undefined;
178
+ /** Image attachments from the original submit, preserved so the approval
179
+ * enqueue path can forward them (mirrors the error/no-op paths in
180
+ * misc-handlers that pass refImages to enqueue). */
181
+ images?: QueuedItem['images'];
175
182
  } | null;
176
183
  /** Prompt library modal (browse/search/insert prompts) open state. */
177
184
  promptLibraryOpen: boolean;
@@ -580,6 +580,7 @@ export type WSClientMessageCore = WSUserMessage | WSToolConfirmResult | {
580
580
  type: 'memory.sage.delete';
581
581
  payload: {
582
582
  id: string;
583
+ force?: boolean | undefined;
583
584
  reason?: string | undefined;
584
585
  neverInject?: boolean | undefined;
585
586
  };
@@ -1,6 +1,6 @@
1
1
  export type ConnectionHealthStatus = 'healthy' | 'degraded' | 'offline' | 'unavailable' | 'error';
2
2
  export interface ConnectionHealthService {
3
- id: 'webui' | 'chronicle' | 'codebase-index' | 'sage' | 'kanban' | 'mailbox';
3
+ id: 'webui' | 'chronicle' | 'codebase-index' | 'sage' | 'kanban' | 'mailbox' | 'governance';
4
4
  label: string;
5
5
  status: ConnectionHealthStatus;
6
6
  required: boolean;
@@ -19,6 +19,12 @@ export interface ConnectionHealthService {
19
19
  watchedFiles?: number | undefined;
20
20
  } | undefined;
21
21
  lastError?: string | undefined;
22
+ control?: 'shutdown' | 'none' | undefined;
23
+ advisory?: {
24
+ code: string;
25
+ operatorAction: 'none' | 'observe' | 'investigate';
26
+ executionDisposition: 'continue';
27
+ } | undefined;
22
28
  }
23
29
  export interface ConnectionsHealthReport {
24
30
  checkedAt: number;
@@ -224,6 +224,17 @@ export type WSServerMessage = WSSessionStart | WSSessionEnd | WSTextDelta | WSTh
224
224
  payload: {
225
225
  sessions: unknown[];
226
226
  };
227
+ } | {
228
+ type: 'chimera.report_available';
229
+ payload: {
230
+ reportId: string;
231
+ sessionId: string;
232
+ message: string;
233
+ fileCount: number;
234
+ findingCount: number;
235
+ hasActionableFindings: boolean;
236
+ messageId?: string | undefined;
237
+ };
227
238
  } | {
228
239
  type: 'mailbox.event';
229
240
  payload: Record<string, unknown> & {
@@ -10,6 +10,10 @@ export interface WSDiagGet {
10
10
  count: number;
11
11
  names: string[];
12
12
  };
13
+ /** Provider maxTools limit (0 = no limit). */
14
+ maxTools: number;
15
+ /** Tools dropped from requests because they exceed maxTools. */
16
+ droppedTools: number;
13
17
  features: {
14
18
  memory: boolean;
15
19
  skills: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wrongstack/webui",
3
- "version": "0.297.0",
3
+ "version": "0.298.1",
4
4
  "license": "MIT",
5
5
  "description": "Browser-based WebUI for WrongStack — React + Vite frontend. The WebSocket backend lives in the separate @wrongstack/webui-server package (extracted in PR #018b to remove the CLI -> @wrongstack/webui/server cross-package edge).",
6
6
  "keywords": [
@@ -24,6 +24,7 @@
24
24
  "type": "module",
25
25
  "files": [
26
26
  "dist",
27
+ "!dist/**/*.map",
27
28
  "README.md",
28
29
  "LICENSE"
29
30
  ],
@@ -75,21 +76,22 @@
75
76
  "tailwind-merge": "^3.6.0",
76
77
  "virtua": "^0.49.3",
77
78
  "zustand": "^5.0.14",
78
- "@wrongstack/webui-server": "0.297.0",
79
- "@wrongstack/providers": "0.297.0",
80
- "@wrongstack/kanban": "0.297.0",
81
- "@wrongstack/tools": "0.297.0",
82
- "@wrongstack/core": "0.297.0"
79
+ "@wrongstack/kanban": "0.298.1",
80
+ "@wrongstack/core": "0.298.1",
81
+ "@wrongstack/webui-server": "0.298.1",
82
+ "@wrongstack/tools": "0.298.1",
83
+ "@wrongstack/plugins": "0.298.1",
84
+ "@wrongstack/providers": "0.298.1"
83
85
  },
84
86
  "optionalDependencies": {
85
87
  "node-pty": "1.2.0-beta.14"
86
88
  },
87
89
  "devDependencies": {
88
- "@playwright/test": "^1.62.0",
90
+ "@playwright/test": "^1.62.1",
89
91
  "@tailwindcss/vite": "^4.3.3",
90
92
  "@testing-library/dom": "^10.4.1",
91
93
  "@testing-library/react": "^16.3.2",
92
- "@types/node": "^26.1.1",
94
+ "@types/node": "^26.1.2",
93
95
  "@types/qrcode": "^1.5.6",
94
96
  "@types/react": "^19.2.17",
95
97
  "@types/react-dom": "^19.2.3",
@@ -101,7 +103,7 @@
101
103
  "typescript": "^7.0.2",
102
104
  "vite": "^8.1.5",
103
105
  "vitest": "^4.1.10",
104
- "@wrongstack/sdd": "0.297.0"
106
+ "@wrongstack/sdd": "0.298.1"
105
107
  },
106
108
  "scripts": {
107
109
  "dev": "vite",
package/dist/App.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../src/App.tsx"],"names":[],"mappings":"AA66BA,wBAAgB,GAAG,gCAQlB"}
@@ -1,11 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./chat-store-CM1dMeuY.js";import{Ai as n,Ct as r,Ir as i,It as a,Kn as o,Ri as s,Sa as c,Si as l,Ut as u,Xi as d,Yi as f,Zi as p,Zt as m,ai as h,at as g,bt as _,cn as v,et as y,gi as b,ii as x,it as S,ma as C,ot as w,qt as T,rr as E,tr as D}from"./vendor-2VBBgNb5.js";import{n as O}from"./ui-store-CS-njcmT.js";import{t as k}from"./ws-client-WVGn8ORh.js";import{t as A}from"./utils-CN2sfDVP.js";import{x as j}from"./stores-mpa0202y.js";import{n as M}from"./Toaster-CbcX_Cou.js";import{n as N,t as P}from"./ModelPicker-CN-UD3lc.js";import{u as F}from"./index-BPfIz78e.js";import{t as I}from"./roster-ws-DXm0krqH.js";var L=e(c(),1),R=y(),z=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],B=[[`timeoutMs`,`Total timeout (ms)`],[`idleTimeoutMs`,`Idle timeout (ms)`],[`maxIterations`,`Max iterations`],[`maxToolCalls`,`Max tool calls`],[`maxTokens`,`Max tokens`],[`maxCostUsd`,`Max cost (USD)`]];function V(e){return`${e.provider}/${e.model}`}function H(e){let t=e.indexOf(`/`);return t<0?{provider:``,model:e}:{provider:e.slice(0,t),model:e.slice(t+1)}}function U(e){return Array.isArray(e)?e.join(`, `):``}function W(e){return[...new Set(e.split(/[\n,]+/).map(e=>e.trim()).filter(Boolean))]}function G({initialConfig:e,systemProtected:t,saving:n,onSave:r,onCancel:i}){let[a,o]=(0,L.useState)(()=>structuredClone(e)),s=N(!0),c=a.modelPolicy,l=(0,L.useMemo)(()=>(c?.allowed??[]).map(V),[c?.allowed]),d=(0,L.useMemo)(()=>(c?.fallbacks??[]).map(V),[c?.fallbacks]),f=e=>o(t=>({...t,...e})),p=(e,t)=>{let n=W(t);o(t=>{let r={...t};return n.length?r[e]=n:delete r[e],r})},m=(e,t)=>{o(n=>{let r={...n.budget??{}};t===``?delete r[e]:r[e]=Number(t);let i={...n};return Object.keys(r).length?i.budget=r:delete i.budget,i})},h=e=>{let t=e.map(H),n=new Set(e);o(e=>({...e,modelPolicy:{allowed:t,fallbacks:(e.modelPolicy?.fallbacks??[]).filter(e=>n.has(V(e))),strict:e.modelPolicy?.strict??!0}}))};return(0,R.jsxs)(`div`,{className:`space-y-4 rounded-lg border border-border bg-card/40 p-4`,children:[t&&(0,R.jsxs)(`div`,{className:`flex gap-2 rounded-md border border-amber-500/30 bg-amber-500/5 p-2 text-[11px] text-muted-foreground`,children:[(0,R.jsx)(u,{className:`mt-0.5 h-4 w-4 shrink-0 text-amber-500`}),(0,R.jsx)(`span`,{children:`Protected system agent: required tools and capabilities are retained, minimum budgets are enforced, working hours remain advisory, and emergency model recovery stays enabled so core operations cannot be disabled.`})]}),(0,R.jsxs)(`section`,{className:`space-y-2`,children:[(0,R.jsx)(`h4`,{className:`text-xs font-semibold`,children:`Provider and model policy`}),(0,R.jsx)(P,{candidates:s,provider:a.provider,value:a.model,placeholder:`Use project default model`,resetLabel:`Use project default`,onReset:()=>{o(e=>{let t={...e};return delete t.provider,delete t.model,t})},onPick:(e,t)=>{let n=`${t}/${e}`;f({provider:t,model:e}),c&&!l.includes(n)&&h([...l,n])}}),(0,R.jsxs)(`label`,{className:`flex items-center gap-2 text-[11px]`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:!!c,onChange:e=>{if(e.target.checked){let e=a.provider&&a.model?[{provider:a.provider,model:a.model}]:s[0]?[{provider:s[0].provider,model:s[0].model}]:[];e.length&&f({modelPolicy:{allowed:e,strict:!0}})}else o(e=>{let t={...e};return delete t.modelPolicy,t})}}),`Restrict this agent to an explicit model allowlist`]}),c&&(0,R.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,R.jsxs)(`div`,{className:`space-y-1`,children:[(0,R.jsx)(`span`,{className:`text-[10px] font-medium`,children:`Allowed models`}),(0,R.jsx)(F,{value:l,candidates:s,onChange:h,placeholder:`Add allowed model`,emptyHint:`At least one model is required`})]}),(0,R.jsxs)(`div`,{className:`space-y-1`,children:[(0,R.jsx)(`span`,{className:`text-[10px] font-medium`,children:`Ordered fallback chain`}),(0,R.jsx)(F,{value:d,candidates:s,onChange:e=>{let t=[...new Set([...l,...e])];o(n=>({...n,modelPolicy:{allowed:t.map(H),fallbacks:e.map(H),strict:n.modelPolicy?.strict??!0}}))},placeholder:`Add fallback model`,emptyHint:`No fallback; primary failure stops the task`})]})]})]}),(0,R.jsx)(`section`,{className:`grid gap-3 sm:grid-cols-3`,children:[[`tools`,`Tools`,`read_file, search, bash`],[`skillNames`,`Skills`,`security-check, browser`],[`allowedCapabilities`,`Capabilities`,`fs.read, fs.write`]].map(([e,t,n])=>(0,R.jsxs)(`label`,{className:`space-y-1 text-[10px]`,children:[(0,R.jsx)(`span`,{className:`font-medium`,children:t}),(0,R.jsx)(`textarea`,{value:U(a[e]),onChange:t=>p(e,t.target.value),placeholder:n,className:`h-20 w-full resize-y rounded border border-border bg-background p-2 font-mono`})]},e))}),(0,R.jsxs)(`section`,{className:`space-y-2`,children:[(0,R.jsx)(`h4`,{className:`text-xs font-semibold`,children:`Workspace and isolation`}),(0,R.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,R.jsxs)(`label`,{className:`space-y-1 text-[10px]`,children:[(0,R.jsx)(`span`,{children:`Project-relative working directory`}),(0,R.jsx)(`input`,{value:a.cwd??``,onChange:e=>f({cwd:e.target.value||void 0}),placeholder:`packages/webui`,className:`h-8 w-full rounded border border-border bg-background px-2 font-mono`})]}),(0,R.jsxs)(`label`,{className:`space-y-1 text-[10px]`,children:[(0,R.jsx)(`span`,{children:`Git worktree isolation`}),(0,R.jsxs)(`select`,{value:String(a.worktree??`auto`),onChange:e=>f({worktree:e.target.value}),className:`h-8 w-full rounded border border-border bg-background px-2`,children:[(0,R.jsx)(`option`,{value:`auto`,children:`Automatic`}),(0,R.jsx)(`option`,{value:`required`,children:`Required`}),(0,R.jsx)(`option`,{value:`off`,children:`Off`})]})]})]})]}),(0,R.jsxs)(`section`,{className:`space-y-2`,children:[(0,R.jsx)(`h4`,{className:`text-xs font-semibold`,children:`Limits`}),(0,R.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-3`,children:B.map(([e,t])=>(0,R.jsxs)(`label`,{className:`space-y-1 text-[10px]`,children:[(0,R.jsx)(`span`,{children:t}),(0,R.jsx)(`input`,{type:`number`,min:`0`,step:e===`maxCostUsd`?`0.01`:`1`,value:a.budget?.[e]??``,onChange:t=>m(e,t.target.value),className:`h-8 w-full rounded border border-border bg-background px-2`})]},e))})]}),(0,R.jsxs)(`section`,{className:`space-y-2`,children:[(0,R.jsxs)(`label`,{className:`flex items-center gap-2 text-xs font-semibold`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:!!a.availability,onChange:e=>{e.target.checked?f({availability:{timezone:Intl.DateTimeFormat().resolvedOptions().timeZone||`UTC`,days:[1,2,3,4,5],start:`09:00`,end:`18:00`,mode:t?`advisory`:`enforce`}}):o(e=>{let t={...e};return delete t.availability,t})}}),`Working hours`]}),a.availability&&(0,R.jsxs)(`div`,{className:`space-y-2 rounded border border-border p-2`,children:[(0,R.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:z.map((e,t)=>(0,R.jsxs)(`label`,{className:`flex items-center gap-1 text-[10px]`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:a.availability?.days.includes(t)??!1,onChange:e=>{let n=a.availability;if(!n)return;let r=e.target.checked?[...new Set([...n.days,t])].sort():n.days.filter(e=>e!==t);f({availability:{...n,days:r}})}}),e]},e))}),(0,R.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-4`,children:[(0,R.jsx)(`input`,{value:a.availability.timezone,onChange:e=>f({availability:{...a.availability,timezone:e.target.value}}),placeholder:`Europe/Kiev`,className:`h-8 rounded border border-border bg-background px-2 text-[10px]`}),(0,R.jsx)(`input`,{type:`time`,value:a.availability.start,onChange:e=>f({availability:{...a.availability,start:e.target.value}}),className:`h-8 rounded border border-border bg-background px-2 text-[10px]`}),(0,R.jsx)(`input`,{type:`time`,value:a.availability.end,onChange:e=>f({availability:{...a.availability,end:e.target.value}}),className:`h-8 rounded border border-border bg-background px-2 text-[10px]`}),(0,R.jsxs)(`select`,{value:t?`advisory`:a.availability.mode??`enforce`,disabled:t,onChange:e=>f({availability:{...a.availability,mode:e.target.value}}),className:`h-8 rounded border border-border bg-background px-2 text-[10px]`,children:[(0,R.jsx)(`option`,{value:`enforce`,children:`Enforce`}),(0,R.jsx)(`option`,{value:`advisory`,children:`Advisory`})]})]})]})]}),(0,R.jsxs)(`div`,{className:`flex gap-2`,children:[(0,R.jsx)(`button`,{type:`button`,disabled:n||!!(c&&c.allowed.length===0),onClick:()=>r(a),className:`rounded bg-primary px-3 py-1.5 text-xs text-primary-foreground disabled:opacity-50`,children:n?`Saving…`:`Save runtime policy`}),(0,R.jsx)(`button`,{type:`button`,onClick:i,className:`rounded border border-border px-3 py-1.5 text-xs hover:bg-accent`,children:`Cancel`})]})]})}var K=[{id:`live`,icon:(0,R.jsx)(C,{className:`h-4 w-4`}),label:`Live Fleet`},{id:`catalog`,icon:(0,R.jsx)(d,{className:`h-4 w-4`}),label:`Roster Catalog`},{id:`learning`,icon:(0,R.jsx)(p,{className:`h-4 w-4`}),label:`Self-Learning`},{id:`customize`,icon:(0,R.jsx)(T,{className:`h-4 w-4`}),label:`Customization`}],q=[{role:`generic`,name:`Generic Project Agent`,summary:`Flexible template that can be cloned into independently learning project roles.`,tools:0,budget:{maxIterations:2500,maxToolCalls:7500}},{role:`audit-log`,name:`Audit Log`,summary:`Analyzes session logs, event streams, and system traces.`,tools:12,budget:{timeoutMs:108e5,maxIterations:2500,maxToolCalls:7500}},{role:`bug-hunter`,name:`Bug Hunter`,summary:`Scans code for bugs, code smells, and anti-patterns.`,tools:15,budget:{timeoutMs:18e6,maxIterations:4e3,maxToolCalls:1e4}},{role:`refactor-planner`,name:`Refactor Planner`,summary:`Analyzes code structure and produces phased refactoring plans.`,tools:14,budget:{timeoutMs:144e5,maxIterations:3e3,maxToolCalls:9e3}},{role:`security-scanner`,name:`Security Scanner`,summary:`Scans code, configs, and dependencies for security issues.`,tools:18,budget:{timeoutMs:18e6,maxIterations:4e3,maxToolCalls:1e4}},{role:`critic`,name:`Critic`,summary:`Evaluates decisions, plans, and implementations.`,tools:10,budget:{timeoutMs:108e5,maxIterations:2e3,maxToolCalls:5e3}},{role:`shadow-agent`,name:`Shadow Agent`,summary:`Background monitoring agent that watches fleet health.`,tools:8,budget:{timeoutMs:36e6,maxIterations:500,maxToolCalls:2e3}},{role:`executor`,name:`Executor`,summary:`General-purpose task executor for delegated work.`,tools:20,budget:{timeoutMs:72e5,maxIterations:1500,maxToolCalls:4e3}},{role:`chimera`,name:`Chimera`,summary:`Post-session code quality review of changed files.`,tools:10,budget:{timeoutMs:72e5,maxIterations:1e3,maxToolCalls:3e3}},{role:`researcher`,name:`Researcher`,summary:`Web research and data gathering specialist.`,tools:8,budget:{timeoutMs:72e5,maxIterations:1e3,maxToolCalls:3e3}},{role:`tech-stack`,name:`Tech Stack Validator`,summary:`Validates package/library/framework choices.`,tools:9,budget:{timeoutMs:72e5,maxIterations:1e3,maxToolCalls:3e3}},{role:`orchestrator`,name:`Orchestrator`,summary:`Coordinates multi-agent task execution.`,tools:12,budget:{timeoutMs:144e5,maxIterations:3e3,maxToolCalls:8e3}},{role:`supervisor`,name:`Supervisor`,summary:`Oversees subagent execution and handles escalations.`,tools:10,budget:{timeoutMs:144e5,maxIterations:2e3,maxToolCalls:6e3}},{role:`quality-gate`,name:`Quality Gate`,summary:`Enforces quality gates on implementations.`,tools:8,budget:{timeoutMs:72e5,maxIterations:1e3,maxToolCalls:3e3}},{role:`architect`,name:`Architect`,summary:`Makes design and architecture decisions.`,tools:14,budget:{timeoutMs:144e5,maxIterations:3e3,maxToolCalls:8e3}},{role:`prompt-engineer`,name:`Prompt Engineer`,summary:`Designs and optimizes system prompts.`,tools:8,budget:{timeoutMs:72e5,maxIterations:1e3,maxToolCalls:3e3}},{role:`mnemosyne`,name:`Mnemosyne`,summary:`Memory curator — reviews and maintains SAGE integrity.`,tools:6,budget:{timeoutMs:72e5,maxIterations:500,maxToolCalls:2e3}},{role:`autophase`,name:`AutoPhase`,summary:`Manages multi-phase autonomous task execution.`,tools:10,budget:{timeoutMs:144e5,maxIterations:2e3,maxToolCalls:6e3}}];function J({customStats:e,rosterLoading:t,onRefresh:n}){return(0,R.jsx)(`div`,{className:`shrink-0 border-b border-border/70 bg-card/80 px-4 py-2.5`,children:(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-2 flex-nowrap min-w-0`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0 overflow-hidden`,children:[(0,R.jsx)(`div`,{className:`flex items-center justify-center w-8 h-8 shrink-0 rounded-lg bg-primary/10`,children:(0,R.jsx)(D,{className:`h-4 w-4 text-primary`})}),(0,R.jsxs)(`div`,{className:`min-w-0 overflow-hidden`,children:[(0,R.jsx)(`h1`,{className:`text-sm font-semibold truncate`,children:`Agent Roster`}),(0,R.jsxs)(`p`,{className:`text-[10px] text-muted-foreground truncate`,children:[e.filter(e=>e.exists||e.hasIdentity||e.hasConfig||e.hasKnowledge).length,` `,`customized · `,e.reduce((e,t)=>e+t.entryCount,0),` learned entries`]})]})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[t&&(0,R.jsx)(o,{className:`h-4 w-4 animate-spin text-muted-foreground shrink-0`}),(0,R.jsxs)(`button`,{type:`button`,onClick:n,className:`inline-flex items-center gap-1 rounded border border-border/50 px-2 py-1 text-[10px] hover:bg-accent transition-colors shrink-0 whitespace-nowrap`,title:`Refresh roster data`,children:[(0,R.jsx)(v,{className:`h-3 w-3`}),` Refresh`]})]})]})})}function Y({activeTab:e,onTabChange:t}){return(0,R.jsx)(`div`,{className:`shrink-0 border-b border-border/50 bg-muted/20 px-3 flex gap-0`,children:K.map(n=>(0,R.jsxs)(`button`,{type:`button`,onClick:()=>t(n.id),className:A(`flex items-center gap-1.5 px-3 py-2 text-[10px] font-medium border-b-2 transition-colors`,e===n.id?`border-primary text-primary`:`border-transparent text-muted-foreground hover:text-foreground hover:border-muted-foreground/30`),children:[n.icon,n.label]},n.id))})}function X({customStats:e,onRefresh:r}){let[i,s]=(0,L.useState)(null),[c,l]=(0,L.useState)(null),[u,f]=(0,L.useState)({}),[m,h]=(0,L.useState)(``),[g,v]=(0,L.useState)(null),[y,b]=(0,L.useState)(!1),[C,w]=(0,L.useState)(!1),[T,E]=(0,L.useState)(null),[D,j]=(0,L.useState)(!1),[N,P]=(0,L.useState)(!1),F=(0,L.useMemo)(()=>[...e].sort((e,t)=>e.role.localeCompare(t.role)),[e]),z=(0,L.useMemo)(()=>i?F.find(e=>e.role===i):null,[i,F]),B=(0,L.useCallback)(async e=>{w(!0),l(null);try{let t=await I(`agent-roster.read-learned`,{role:e});l(t.entries??[]),f({})}catch{}w(!1)},[]),V=(0,L.useCallback)(async()=>{if(!i||!c)return;b(!0);let e=c.filter((e,t)=>u[t]!==`drop`).join(`
2
-
3
- ---
4
-
5
- `);try{await I(`agent-roster.update-learned`,{role:i,content:e}),l(null),f({})}catch{}b(!1)},[i,c,u]),H=(0,L.useCallback)(async()=>{if(!(!i||!m.trim())){v(null),b(!0);try{let e=`> Taught ${new Date().toISOString().slice(0,10)}\n\n${m.trim()}`;(await I(`agent-roster.append-learned`,{role:i,content:e})).success?(v({ok:!0,msg:`Saved to learned.md`}),h(``),r()):v({ok:!1,msg:`Save failed`})}catch(e){v({ok:!1,msg:e instanceof Error?e.message:`Failed`})}b(!1)}},[r,i,m]),U=(0,L.useCallback)(async(e,t)=>{b(!0),v(null);try{let n=await I(`agent-roster.update-learning`,{role:e,enabled:t});if(n.error)throw Error(n.error);v({ok:!0,msg:t?`Automatic learning resumed`:`Automatic learning paused`}),r()}catch(e){v({ok:!1,msg:e instanceof Error?e.message:`Policy update failed`})}finally{b(!1)}},[r]),W=(0,L.useCallback)(async e=>{try{let t=await I(`agent-roster.read-consolidated`,{role:e});E(t.isConsolidated?t.content:null)}catch{E(null)}},[]),G=(0,L.useCallback)(async e=>{j(!0),v(null);try{let n=await I(`agent-roster.consolidate`,{role:e});if(n.error)throw Error(n.error);if(n.rawEntryCount===0){v({ok:!1,msg:`No raw entries to optimize yet.`});return}if(n.consolidated){await r(),await W(e),v({ok:!0,msg:`Optimized. Consolidated knowledge updated.`}),M.success(n.model?`Learnings consolidated with ${n.model}.`:`Learnings consolidated.`);return}if(n.emptySynthesis){v({ok:!1,msg:`The model returned an empty result. Nothing was changed — try again.`}),M.error(`Optimization produced an empty result. Try again.`);return}let i=n.instruction;if(!i)throw Error(`No consolidation instruction generated`);let a=t.getState();a.addMessage({role:`user`,content:i}),a.setLoading(!0),k().sendMessage(i);let o=O.getState();o.setSidebarOpen(!1),o.setCurrentView(`chat`),v({ok:!0,msg:`No active model on server — optimization sent to chat agent instead.`}),M.info(`No active model on server. Optimization sent to the chat agent.`)}catch(e){v({ok:!1,msg:e instanceof Error?e.message:`Optimization failed`}),M.error(e instanceof Error?e.message:`Optimization failed`)}finally{j(!1)}},[r,W]),K=(0,L.useCallback)(async e=>{if(e.length!==0){P(!0),v(null);try{let n=[],r=0,a=0,o=``,s=[];for(let t of e)try{let e=await I(`agent-roster.consolidate`,{role:t});e.error?(a++,o=e.error):e.consolidated?n.push(t):e.rawEntryCount===0?r++:e.emptySynthesis?(a++,o=`Model returned an empty result`):e.instruction?s.push({role:t,instruction:e.instruction}):(a++,o=`No consolidation produced`)}catch(e){a++,o=e instanceof Error?e.message:String(e)}if(i&&n.includes(i)&&await W(i),s.length>0){let e=`Optimize the learned data for ${s.length} agent${s.length>1?`s`:``}. For each agent below, read its raw learned entries, synthesize them into a single narrowly-scoped document preserving every fact, and save the result to its consolidated.md file.\n\n`+s.map(e=>`## Agent: ${e.role}\n\n${e.instruction}`).join(`
6
-
7
- ---
8
-
9
- `),n=t.getState();n.addMessage({role:`user`,content:e}),n.setLoading(!0),k().sendMessage(e);let r=O.getState();r.setSidebarOpen(!1),r.setCurrentView(`chat`)}if(n.length===0&&s.length===0){if(a>0){let t=r>0?` ${r} skipped.`:``,n=`Bulk consolidate failed for ${a} of ${e.length} agent${e.length>1?`s`:``}.${o?` Last error: ${o}`:``}${t}`;v({ok:!1,msg:n});return}let t=r>0?`Bulk optimize: ${r} skipped (no entries to optimize).`:`No agents had optimizable entries.`;v({ok:!0,msg:t}),M.info(t,6e3);return}let c=[];n.length>0&&c.push(`${n.length} consolidated`),s.length>0&&c.push(`${s.length} sent to chat`),r>0&&c.push(`${r} skipped`),a>0&&c.push(`${a} failed`);let l=`Bulk optimize: ${c.join(`, `)}.`;v({ok:a===0,msg:l}),n.length>0&&s.length===0?M.success(l,6e3):M.info(l,6e3)}catch(e){v({ok:!1,msg:e instanceof Error?e.message:`Bulk optimization failed`}),M.error(e instanceof Error?e.message:`Bulk optimization failed`)}finally{P(!1)}}},[i,W]);return F.length===0?(0,R.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-muted-foreground`,children:(0,R.jsxs)(`div`,{className:`text-center space-y-3`,children:[(0,R.jsx)(x,{className:`h-10 w-10 mx-auto opacity-30`}),(0,R.jsx)(`p`,{className:`text-sm`,children:`No self-learning data yet`}),(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground/70`,children:`Learning entries appear when agents capture output`})]})}):(0,R.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:[(0,R.jsxs)(`div`,{className:A(`flex flex-col min-h-0 min-w-0 overflow-hidden border-r border-border/50`,i?`w-80 shrink-0`:`flex-1`),children:[(0,R.jsxs)(`div`,{className:`shrink-0 px-3 py-2 border-b border-border/50`,children:[(0,R.jsxs)(`h3`,{className:`text-xs font-semibold flex items-center gap-1.5`,children:[(0,R.jsx)(x,{className:`h-3.5 w-3.5 text-brand-2`}),`All Roster Agents`]}),(()=>{let e=F.filter(e=>e.needsSummarization);return e.length===0?null:(0,R.jsxs)(`div`,{className:`mt-2 flex flex-col gap-1.5 rounded border border-warning/40 bg-warning/10 px-2 py-1.5`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(S,{className:`h-3 w-3 text-warning shrink-0`}),(0,R.jsxs)(`span`,{className:`text-[10px] text-warning leading-tight`,children:[e.length,` agent`,e.length>1?`s`:``,` need`,e.length===1?`s`:``,` optimization`]}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>{let t=e[0];t&&(s(t.role),l(null),E(null))},className:`ml-auto text-[9px] text-warning underline hover:text-warning/80 shrink-0`,children:`review →`})]}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>K(e.map(e=>e.role)),disabled:N,className:`flex items-center justify-center gap-1 rounded bg-warning/20 border border-warning/40 px-2 py-1 text-[10px] font-medium text-warning hover:bg-warning/30 transition-colors disabled:opacity-50`,children:[N?(0,R.jsx)(o,{className:`h-3 w-3 animate-spin`}):(0,R.jsx)(S,{className:`h-3 w-3`}),N?`Optimizing…`:`Optimize All (${e.length})`]})]})})()]}),(0,R.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-2 space-y-1`,children:F.map(e=>(0,R.jsxs)(`button`,{type:`button`,onClick:()=>{s(e.role),l(null),E(null)},className:A(`w-full text-left rounded-lg border px-3 py-2 transition-colors`,i===e.role?`border-primary/50 bg-primary/[0.06]`:`border-border/60 hover:border-primary/30`,e.needsSummarization&&i!==e.role&&`border-warning/40`),children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,R.jsx)(`span`,{className:`text-xs font-semibold`,children:e.role}),(0,R.jsx)(`span`,{className:A(`text-[9px] tabular-nums`,e.learningEnabled?`text-success`:`text-muted-foreground`),children:e.learningEnabled?`learning`:`paused`})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2 mt-1 text-[9px] text-muted-foreground`,children:[(0,R.jsxs)(`span`,{className:`tabular-nums`,children:[e.entryCount,` entries`]}),e.sessionCaptureCount>0&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{className:`text-muted-foreground/50`,children:`·`}),(0,R.jsxs)(`span`,{className:`text-success tabular-nums`,children:[`+`,e.sessionCaptureCount]})]}),e.lastCapture&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{className:`text-muted-foreground/50`,children:`·`}),(0,R.jsx)(`span`,{children:new Date(e.lastCapture).toLocaleDateString()})]}),e.needsSummarization&&(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 text-warning font-medium`,children:[(0,R.jsx)(S,{className:`h-2.5 w-2.5`}),`optimize`]})]})]},e.role))})]}),(0,R.jsxs)(`div`,{className:`flex-1 min-w-0 overflow-y-auto p-4`,children:[!i&&(0,R.jsx)(`div`,{className:`flex items-center justify-center h-full text-muted-foreground`,children:`Select an agent to view learning details`}),i&&z&&(0,R.jsxs)(`div`,{className:`space-y-4`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,R.jsx)(`h3`,{className:`text-base font-semibold`,children:i}),(0,R.jsx)(`div`,{className:`flex gap-1`,children:(0,R.jsxs)(`button`,{type:`button`,onClick:()=>U(i,!z.learningEnabled),disabled:y,className:A(`inline-flex items-center gap-1 rounded border px-2 py-1 text-[10px] transition-colors disabled:opacity-50`,z.learningEnabled?`border-success/40 text-success hover:bg-success/10`:`border-border/50 text-muted-foreground hover:bg-accent`),children:[(0,R.jsx)(x,{className:`h-3 w-3`}),` `,z.learningEnabled?`Learning on`:`Learning paused`]})})]}),(0,R.jsxs)(`div`,{className:`grid grid-cols-4 gap-2`,children:[(0,R.jsxs)(`div`,{className:`rounded-lg border bg-card p-2`,children:[(0,R.jsx)(`span`,{className:`text-[9px] text-muted-foreground uppercase tracking-wider`,children:`Entries`}),(0,R.jsx)(`div`,{className:`text-lg font-mono font-semibold mt-0.5`,children:z.entryCount})]}),(0,R.jsxs)(`div`,{className:`rounded-lg border bg-card p-2`,children:[(0,R.jsx)(`span`,{className:`text-[9px] text-muted-foreground uppercase tracking-wider`,children:`Size`}),(0,R.jsxs)(`div`,{className:`text-lg font-mono font-semibold mt-0.5`,children:[z.totalBytes,`B`]})]}),(0,R.jsxs)(`div`,{className:`rounded-lg border bg-card p-2`,children:[(0,R.jsx)(`span`,{className:`text-[9px] text-muted-foreground uppercase tracking-wider`,children:`Last Capture`}),(0,R.jsx)(`div`,{className:`text-lg font-mono font-semibold mt-0.5`,children:z.lastCapture?new Date(z.lastCapture).toLocaleDateString():`—`})]}),(0,R.jsxs)(`div`,{className:`rounded-lg border bg-card p-2`,children:[(0,R.jsx)(`span`,{className:`text-[9px] text-muted-foreground uppercase tracking-wider`,children:`Lifetime Captures`}),(0,R.jsx)(`div`,{className:`text-lg font-mono font-semibold mt-0.5`,children:z.lifetimeCaptureCount})]})]}),z.needsSummarization&&(0,R.jsxs)(`div`,{className:`flex items-center gap-3 text-xs text-warning bg-warning/10 rounded-lg px-3 py-2.5`,children:[(0,R.jsx)(_,{className:`h-4 w-4 shrink-0`}),(0,R.jsxs)(`span`,{className:`flex-1`,children:[`Learned data exceeds soft limit (`,z.totalBytes.toLocaleString(),`B / 8,192B). Optimize to synthesize raw entries into a consolidated document and reduce context volume.`]}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>G(i),disabled:D,className:`inline-flex items-center gap-1 rounded bg-warning/20 text-warning border border-warning/40 px-2.5 py-1 text-[10px] font-medium hover:bg-warning/30 transition-colors disabled:opacity-50 shrink-0`,children:[D?(0,R.jsx)(o,{className:`h-3 w-3 animate-spin`}):(0,R.jsx)(S,{className:`h-3 w-3`}),D?`Optimizing…`:`Optimize Now`]})]}),(0,R.jsxs)(`div`,{className:`space-y-2 border border-border rounded-lg p-3 bg-card`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,R.jsx)(a,{className:`h-4 w-4 text-primary`}),(0,R.jsx)(`span`,{className:`text-xs font-semibold`,children:`Optimize Learnings`})]}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>G(i),disabled:D||z.entryCount===0,className:`inline-flex items-center gap-1 rounded bg-primary px-3 py-1.5 text-xs text-primary-foreground hover:bg-primary/90 transition-colors disabled:opacity-50`,title:z.entryCount===0?`No raw entries to optimize`:`Synthesize raw entries into a consolidated, narrowly-scoped document`,children:[D?(0,R.jsx)(o,{className:`h-3.5 w-3.5 animate-spin`}):(0,R.jsx)(S,{className:`h-3.5 w-3.5`}),D?`Optimizing…`:`Optimize`]})]}),(0,R.jsxs)(`p`,{className:`text-[10px] text-muted-foreground leading-relaxed`,children:[`Synthesizes all `,z.entryCount,` raw entries into a single reviewed document — narrowly scoped to this agent's skills, preserving every fact but reducing context volume. The result replaces raw entries in the agent's prompt.`]}),z.isConsolidated&&z.consolidation&&(0,R.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] text-muted-foreground pt-1 border-t border-border/50`,children:[(0,R.jsx)(n,{className:`h-3 w-3 text-success`}),(0,R.jsxs)(`span`,{children:[`Consolidated`,` `,new Date(z.consolidation.consolidatedAt).toLocaleDateString(),` ·`,` `,z.consolidation.sourceBytes,`B →`,` `,z.consolidation.consolidatedBytes,`B`,z.consolidation.sourceEntryCount<z.entryCount&&(0,R.jsxs)(`span`,{className:`text-warning ml-1`,children:[`· `,z.entryCount-z.consolidation.sourceEntryCount,` `,`new pending`]})]}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>{T===null?W(i):E(null)},className:`ml-auto underline text-primary hover:text-primary/80`,children:T===null?`View`:`Hide`})]}),T!==null&&(0,R.jsxs)(`div`,{className:`mt-2 max-h-72 overflow-y-auto rounded border border-border/50 bg-background/50 p-2`,children:[(0,R.jsxs)(`div`,{className:`text-[10px] text-muted-foreground mb-1 font-medium`,children:[`Consolidated knowledge for `,i]}),(0,R.jsx)(`pre`,{className:`text-[10px] whitespace-pre-wrap font-sans leading-relaxed`,children:T||`(empty)`})]})]}),z.entryCount>0&&(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,R.jsxs)(`button`,{type:`button`,onClick:()=>B(i),disabled:C,className:`inline-flex items-center gap-1 rounded border border-border/50 px-3 py-1.5 text-xs hover:bg-accent transition-colors`,children:[C?(0,R.jsx)(o,{className:`h-3 w-3 animate-spin`}):(0,R.jsx)(d,{className:`h-3 w-3`}),`Review Learned Entries (`,z.entryCount,`)`]})}),c&&(0,R.jsxs)(`div`,{className:`space-y-2 border border-border rounded-lg p-3 bg-card`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,R.jsxs)(`span`,{className:`text-xs font-medium`,children:[c.filter((e,t)=>u[t]!==`drop`).length,`/`,c.length,` kept`]}),(0,R.jsxs)(`div`,{className:`flex gap-2`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:V,disabled:y,className:`inline-flex items-center gap-1 rounded bg-primary px-2 py-1 text-[10px] text-primary-foreground hover:bg-primary/90 transition-colors`,children:y?`Applying…`:`Apply Selection`}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>{l(null),f({})},className:`inline-flex items-center gap-1 rounded border border-border/50 px-2 py-1 text-[10px] hover:bg-accent transition-colors`,children:`Cancel`})]})]}),(0,R.jsx)(`div`,{className:`max-h-72 overflow-y-auto space-y-2`,children:c.map((e,t)=>{let n=u[t]??`keep`,r=e.length>200?e.slice(0,200)+`…`:e;return(0,R.jsx)(`div`,{className:A(`rounded-lg border p-2 transition-colors`,n===`drop`?`border-destructive/40 bg-destructive/5 opacity-60`:`border-border`),children:(0,R.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,R.jsx)(`pre`,{className:`text-[10px] whitespace-pre-wrap flex-1 leading-relaxed font-sans`,children:r}),(0,R.jsxs)(`div`,{className:`flex gap-1 shrink-0`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:()=>f(e=>({...e,[t]:`keep`})),className:A(`px-2 py-1 text-[9px] rounded`,n===`keep`?`bg-success/20 text-success`:`bg-muted text-muted-foreground`),children:`Keep`}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>f(e=>({...e,[t]:`drop`})),className:A(`px-2 py-1 text-[9px] rounded`,n===`drop`?`bg-destructive/20 text-destructive`:`bg-muted text-muted-foreground`),children:`Drop`})]})]})},t)})})]})]}),(0,R.jsxs)(`div`,{className:`space-y-2 pt-4 border-t border-border`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-1 text-sm font-medium`,children:[(0,R.jsx)(p,{className:`h-4 w-4 text-brand-2`}),` Teach this agent`]}),(0,R.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`Describe a command, pattern, or behavior you want this agent to remember.`}),(0,R.jsx)(`textarea`,{className:`w-full h-20 text-xs p-2 bg-card border border-border rounded resize-y`,value:m,onChange:e=>h(e.target.value),placeholder:`e.g. Always use pnpm for this project`}),(0,R.jsxs)(`div`,{className:`flex justify-between items-center`,children:[(0,R.jsxs)(`button`,{type:`button`,onClick:H,disabled:!m.trim()||y,className:`inline-flex items-center gap-1 rounded bg-primary px-3 py-1.5 text-xs text-primary-foreground hover:bg-primary/90 transition-colors disabled:opacity-50`,children:[(0,R.jsx)(p,{className:`h-3.5 w-3.5`}),` Teach`]}),g&&(0,R.jsx)(`span`,{className:A(`text-xs`,g.ok?`text-success`:`text-destructive`),children:g.msg})]})]})]})]})]})}function ee({customStats:e,catalog:t}){let[n,r]=(0,L.useState)(``),[a,o]=(0,L.useState)(null),c=(0,L.useMemo)(()=>new Set(e.filter(e=>e.exists||e.hasIdentity||e.hasConfig||e.hasKnowledge).map(e=>e.role)),[e]),l=(0,L.useMemo)(()=>{if(!n.trim())return t;let e=n.toLowerCase();return t.filter(t=>t.role.includes(e)||t.name.toLowerCase().includes(e)||t.summary.toLowerCase().includes(e))},[t,n]),u=(0,L.useCallback)(t=>e.find(e=>e.role===t),[e]),d=l;return(0,R.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[(0,R.jsx)(`div`,{className:`shrink-0 px-3 py-2 border-b border-border/50`,children:(0,R.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-border/60 bg-background px-3 py-1.5`,children:[(0,R.jsx)(m,{className:`h-3.5 w-3.5 text-muted-foreground`}),(0,R.jsx)(`input`,{type:`text`,value:n,onChange:e=>r(e.target.value),placeholder:`Search agents by name, role, or description…`,className:`flex-1 bg-transparent text-xs outline-none placeholder:text-muted-foreground/50`}),n&&(0,R.jsx)(`button`,{type:`button`,onClick:()=>r(``),className:`text-muted-foreground hover:text-foreground`,children:(0,R.jsx)(g,{className:`h-3 w-3`})})]})}),(0,R.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-3`,children:[(0,R.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-2`,children:d.map(e=>{let t=u(e.role),n=c.has(e.role),r=a===e.role;return(0,R.jsxs)(`div`,{className:A(`rounded-lg border bg-card transition-colors`,r?`border-primary/40 ring-1 ring-primary/20`:`border-border/60 hover:border-primary/30`),children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>o(r?null:e.role),className:`w-full text-left p-3`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,R.jsx)(f,{className:`h-4 w-4 shrink-0 text-primary`}),(0,R.jsx)(`span`,{className:`text-sm font-semibold truncate`,children:e.name}),(0,R.jsxs)(`code`,{className:`text-[9px] text-muted-foreground font-mono shrink-0`,children:[`@`,e.role]})]}),(0,R.jsx)(s,{className:A(`h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform`,r&&`rotate-180`)})]}),(0,R.jsx)(`p`,{className:`text-[10px] text-muted-foreground mt-1 leading-relaxed line-clamp-2`,children:e.summary}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2 mt-1.5`,children:[(0,R.jsxs)(`span`,{className:`text-[9px] text-muted-foreground tabular-nums`,children:[e.tools,` tools`]}),e.budget.maxIterations&&(0,R.jsxs)(`span`,{className:`text-[9px] text-muted-foreground tabular-nums`,children:[e.budget.maxIterations.toLocaleString(),` max it`]}),n&&(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 rounded bg-brand-2/10 px-1 py-0.5 text-[8px] text-brand-2 font-medium`,children:[(0,R.jsx)(i,{className:`h-2.5 w-2.5`}),` Customized`]}),t?.needsSummarization&&(0,R.jsx)(`span`,{className:`text-[9px] text-warning`,children:`⚠ Needs summary`})]})]}),r&&(0,R.jsxs)(`div`,{className:`border-t border-border/50 px-3 py-2 space-y-2`,children:[(0,R.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,R.jsxs)(`div`,{className:`rounded bg-muted/30 p-1.5`,children:[(0,R.jsx)(`span`,{className:`text-[8px] text-muted-foreground uppercase tracking-wider`,children:`Max Iterations`}),(0,R.jsx)(`div`,{className:`text-xs font-mono mt-0.5`,children:e.budget.maxIterations?.toLocaleString()??`—`})]}),(0,R.jsxs)(`div`,{className:`rounded bg-muted/30 p-1.5`,children:[(0,R.jsx)(`span`,{className:`text-[8px] text-muted-foreground uppercase tracking-wider`,children:`Timeout`}),(0,R.jsx)(`div`,{className:`text-xs font-mono mt-0.5`,children:e.budget.timeoutMs?`${Math.round(e.budget.timeoutMs/6e4)}m`:`—`})]}),(0,R.jsxs)(`div`,{className:`rounded bg-muted/30 p-1.5`,children:[(0,R.jsx)(`span`,{className:`text-[8px] text-muted-foreground uppercase tracking-wider`,children:`Max Tool Calls`}),(0,R.jsx)(`div`,{className:`text-xs font-mono mt-0.5`,children:e.budget.maxToolCalls?.toLocaleString()??`—`})]}),(0,R.jsxs)(`div`,{className:`rounded bg-muted/30 p-1.5`,children:[(0,R.jsx)(`span`,{className:`text-[8px] text-muted-foreground uppercase tracking-wider`,children:`Customized`}),(0,R.jsx)(`div`,{className:`text-xs font-mono mt-0.5`,children:n?`Yes`:`No`})]})]}),n&&t&&(0,R.jsxs)(`div`,{className:`rounded bg-accent/30 p-2 space-y-1`,children:[(0,R.jsx)(`span`,{className:`text-[9px] font-medium text-muted-foreground`,children:`Project Customizations`}),(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-[9px]`,children:[t.hasIdentity&&(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,R.jsx)(i,{className:`h-2.5 w-2.5 text-primary`}),` identity.md`]}),t.entryCount>0&&(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,R.jsx)(x,{className:`h-2.5 w-2.5 text-brand-2`}),` `,t.entryCount,` `,`learned entries`]}),t.hasConfig&&(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,R.jsx)(T,{className:`h-2.5 w-2.5 text-muted-foreground`}),` config.json`]}),t.sessionCaptureCount>0&&(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,R.jsx)(C,{className:`h-2.5 w-2.5 text-success`}),` `,t.sessionCaptureCount,` session captures`]})]})]})]})]},e.role)})}),d.length===0&&(0,R.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-40 text-muted-foreground`,children:[(0,R.jsx)(m,{className:`h-8 w-8 mb-2 opacity-30`}),(0,R.jsxs)(`p`,{className:`text-sm`,children:[`No agents match "`,n,`"`]})]})]}),(0,R.jsxs)(`div`,{className:`shrink-0 border-t border-border/50 px-3 py-2 text-[10px] text-muted-foreground flex items-center gap-2`,children:[(0,R.jsxs)(`span`,{children:[(0,R.jsx)(`strong`,{children:t.length}),` roster roles`]}),(0,R.jsx)(`span`,{className:`text-muted-foreground/50`,children:`·`}),(0,R.jsxs)(`span`,{className:`text-brand-2`,children:[(0,R.jsx)(`strong`,{children:c.size}),` customized`]}),(0,R.jsx)(`span`,{className:`text-muted-foreground/50`,children:`·`}),(0,R.jsxs)(`span`,{children:[(0,R.jsx)(`strong`,{children:e.reduce((e,t)=>e+t.entryCount,0)}),` total learned entries`]})]})]})}var Z={running:{led:`bg-success`,badge:`bg-success/12 text-success`,icon:(0,R.jsx)(`span`,{className:`led text-success led-pulse`}),color:`text-success`},completed:{led:`bg-success`,badge:`bg-success/12 text-success`,icon:(0,R.jsx)(n,{className:`h-3.5 w-3.5`}),color:`text-success`},failed:{led:`bg-destructive`,badge:`bg-destructive/15 text-destructive`,icon:(0,R.jsx)(l,{className:`h-3.5 w-3.5`}),color:`text-destructive`},timeout:{led:`bg-warning`,badge:`bg-muted text-muted-foreground`,icon:(0,R.jsx)(b,{className:`h-3.5 w-3.5`}),color:`text-warning`},stopped:{led:`bg-muted-foreground`,badge:`bg-muted text-muted-foreground`,icon:(0,R.jsx)(`span`,{className:`led text-muted-foreground`}),color:`text-muted-foreground`},idle:{led:`bg-muted-foreground`,badge:`bg-muted text-muted-foreground`,icon:(0,R.jsx)(`span`,{className:`led text-muted-foreground`}),color:`text-muted-foreground`}};function Q(e){let t=Math.floor(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60);if(n<60)return`${n}m ${t%60}s`;let r=Math.floor(n/60);return r<24?`${r}h ${n%60}m`:`${Math.floor(r/24)}d`}function $(e){if(e==null||!Number.isFinite(e)||e<=0)return`$0`;if(e<.01){let t=e.toFixed(5);return t===`0.00000`?`$0`:`$`+t.replace(/(\d)0+$/,`$1`).replace(/\.$/,``)}return`$`+e.toFixed(3)}function te({nowTick:e}){let t=j(e=>e.agents),n=j(e=>e.leaderId),[i,a]=(0,L.useState)(null),[o,s]=(0,L.useState)(`all`),c=(0,L.useMemo)(()=>{let e=Array.from(t.values());return e.sort((e,t)=>{let n=e.status===`running`?0:1,r=t.status===`running`?0:1;return n===r?t.startedAt-e.startedAt:n-r}),o===`all`?e:o===`running`?e.filter(e=>e.status===`running`):o===`done`?e.filter(e=>e.status===`completed`):o===`failed`?e.filter(e=>e.status===`failed`||e.status===`timeout`):e},[t,o]),l=(0,L.useMemo)(()=>{let e=0,n=0,r=0;for(let i of t.values())i.status===`running`?e++:i.status===`completed`?n++:(i.status===`failed`||i.status===`timeout`)&&r++;return{running:e,completed:n,failed:r,total:t.size}},[t]),u=j(e=>e.clearFinishedAgents),d=i?c.find(e=>e.id===i):null,p=(0,L.useCallback)(e=>{let t=O.getState();e?(t.setInspectorFocusedAgentId(e),t.setInspectorTab(`agents`)):t.setInspectorTab(`fleet`),t.setInspectorOpen(!0)},[]);return c.length===0?(0,R.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-muted-foreground`,children:(0,R.jsxs)(`div`,{className:`text-center space-y-3`,children:[(0,R.jsx)(f,{className:`h-10 w-10 mx-auto opacity-30`}),(0,R.jsx)(`p`,{className:`text-sm`,children:`No active fleet agents`}),(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground/70`,children:`Agents appear here when subagents spawn`})]})}):(0,R.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:[(0,R.jsxs)(`div`,{className:A(`flex flex-col min-h-0 min-w-0 overflow-hidden`,d?`w-80 shrink-0 border-r border-border/50`:`flex-1`),children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0 px-3 py-2 border-b border-border/50`,children:[[`all`,`running`,`done`,`failed`].map(e=>(0,R.jsxs)(`button`,{type:`button`,onClick:()=>s(e),className:A(`rounded px-2 py-0.5 text-[10px] font-medium transition-colors`,o===e?`bg-primary/10 text-primary`:`text-muted-foreground hover:text-foreground hover:bg-muted/50`),children:[e===`all`&&`All (${l.total})`,e===`running`&&`Running (${l.running})`,e===`done`&&`Done (${l.completed})`,e===`failed`&&`Failed (${l.failed})`]},e)),(0,R.jsx)(`span`,{className:`flex-1`}),l.completed+l.failed>0&&(0,R.jsxs)(`button`,{type:`button`,onClick:u,className:`inline-flex items-center gap-0.5 rounded px-1.5 py-0.5 text-[10px] text-muted-foreground hover:text-destructive hover:bg-destructive/10 transition-colors`,children:[(0,R.jsx)(r,{className:`h-2.5 w-2.5`}),` Clear`]})]}),(0,R.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-2 space-y-1`,children:c.map(e=>(0,R.jsxs)(`button`,{type:`button`,onClick:()=>a(i===e.id?null:e.id),className:A(`w-full text-left rounded-lg border px-3 py-2 transition-colors flex items-center gap-2`,i===e.id?`border-primary/50 bg-primary/[0.06]`:`border-border/60 hover:border-primary/30 hover:bg-primary/[0.03]`),children:[(0,R.jsx)(`span`,{className:A(`led shrink-0`,Z[e.status]?.led??`bg-muted-foreground`,e.status===`running`&&`led-pulse`)}),(0,R.jsx)(`span`,{className:`text-xs font-semibold min-w-0 truncate max-w-[7rem]`,children:e.name}),e.id===n&&(0,R.jsx)(h,{className:`h-3 w-3 shrink-0 text-warning`}),e.model&&(0,R.jsx)(`span`,{className:`text-[9px] text-muted-foreground font-mono truncate max-w-[6rem] shrink-0`,children:e.model}),(0,R.jsxs)(`span`,{className:`text-[9px] text-muted-foreground tabular-nums shrink-0`,children:[e.iteration,`it · `,e.toolCalls,`t`]}),e.status===`running`&&(0,R.jsx)(`span`,{className:`text-[9px] text-primary tabular-nums shrink-0 ml-auto`,children:Q(Date.now()-e.startedAt)}),e.status!==`running`&&(0,R.jsx)(`span`,{className:A(`text-[9px] tabular-nums shrink-0 ml-auto`,Z[e.status]?.color??`text-muted-foreground`),children:e.status}),e.costUsd>0&&(0,R.jsx)(`span`,{className:`text-[9px] text-success tabular-nums font-medium shrink-0`,children:$(e.costUsd)}),e.status===`running`&&e.currentTool&&(0,R.jsxs)(`span`,{className:`text-[9px] text-primary font-mono truncate max-w-[6rem] shrink-0`,children:[`→ `,e.currentTool]})]},e.id))}),(0,R.jsxs)(`div`,{className:`shrink-0 border-t border-border/50 px-3 py-2 flex items-center gap-2 text-[10px] text-muted-foreground`,children:[(0,R.jsx)(`span`,{className:`font-medium tabular-nums`,children:l.total}),` agents total`,(0,R.jsx)(`span`,{className:`text-muted-foreground/50`,children:`·`}),(0,R.jsx)(`span`,{className:`text-success tabular-nums`,children:l.running}),` running`,(0,R.jsx)(`span`,{className:`text-muted-foreground/50`,children:`·`}),(0,R.jsx)(`span`,{className:`tabular-nums`,children:l.completed}),` done`,l.failed>0&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{className:`text-muted-foreground/50`,children:`·`}),(0,R.jsx)(`span`,{className:`text-destructive tabular-nums`,children:l.failed}),` failed`]}),(0,R.jsx)(`span`,{className:`flex-1`}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>p(),className:`inline-flex items-center gap-1 rounded border border-border/50 px-2 py-1 hover:bg-accent transition-colors`,children:[(0,R.jsx)(E,{className:`h-3 w-3`}),`Fleet Inspector`]})]})]}),d&&(0,R.jsx)(`div`,{className:`flex-1 min-w-0 overflow-y-auto p-4`,children:(0,R.jsx)(ne,{agent:d,nowTick:e})})]})}function ne({agent:e,nowTick:t}){let n=e.status===`running`?Q(t-e.startedAt):e.completedAt?Q(e.completedAt-e.startedAt):`-`,r=Math.min(100,Math.max(0,e.ctxPct)),i=e.currentTool||e.lastTool,a=j(e=>e.leaderId);return(0,R.jsxs)(`div`,{className:`space-y-4`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,R.jsx)(`div`,{className:`flex items-center justify-center w-10 h-10 rounded-lg bg-primary/10`,children:(0,R.jsx)(f,{className:`h-5 w-5 text-primary`})}),(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`span`,{className:`text-base font-semibold`,children:e.name}),e.id===a&&(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded border border-warning/30 bg-warning/10 px-1.5 py-0.5 text-[9px] font-medium text-warning`,children:[(0,R.jsx)(h,{className:`h-2.5 w-2.5`}),` Leader`]})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] text-muted-foreground`,children:[(0,R.jsx)(`span`,{className:A(`led`,Z[e.status]?.led,e.status===`running`&&`led-pulse`)}),(0,R.jsx)(`span`,{children:e.status}),e.model&&(0,R.jsxs)(`span`,{children:[`· `,e.provider,`/`,e.model]}),(0,R.jsxs)(`span`,{children:[`· `,n]})]})]})]}),(0,R.jsxs)(`div`,{className:`grid grid-cols-4 gap-2`,children:[(0,R.jsxs)(`div`,{className:`rounded-lg border bg-card p-2`,children:[(0,R.jsx)(`span`,{className:`text-[9px] text-muted-foreground uppercase tracking-wider`,children:`Iterations`}),(0,R.jsx)(`div`,{className:`text-lg font-mono font-semibold mt-0.5`,children:e.iteration})]}),(0,R.jsxs)(`div`,{className:`rounded-lg border bg-card p-2`,children:[(0,R.jsx)(`span`,{className:`text-[9px] text-muted-foreground uppercase tracking-wider`,children:`Tool Calls`}),(0,R.jsx)(`div`,{className:`text-lg font-mono font-semibold mt-0.5`,children:e.toolCalls})]}),(0,R.jsxs)(`div`,{className:`rounded-lg border bg-card p-2`,children:[(0,R.jsx)(`span`,{className:`text-[9px] text-muted-foreground uppercase tracking-wider`,children:`Cost`}),(0,R.jsx)(`div`,{className:`text-lg font-mono font-semibold mt-0.5 text-success`,children:$(e.costUsd)})]}),(0,R.jsxs)(`div`,{className:`rounded-lg border bg-card p-2`,children:[(0,R.jsx)(`span`,{className:`text-[9px] text-muted-foreground uppercase tracking-wider`,children:`Context`}),(0,R.jsxs)(`div`,{className:`text-lg font-mono font-semibold mt-0.5`,children:[r,`%`]})]})]}),e.maxContext>0&&(0,R.jsxs)(`div`,{className:`space-y-1`,children:[(0,R.jsxs)(`div`,{className:`flex justify-between text-[10px]`,children:[(0,R.jsx)(`span`,{className:`text-muted-foreground`,children:`Context Window`}),(0,R.jsxs)(`span`,{className:A(`tabular font-medium`,r>=85?`text-destructive`:r>=70?`text-warning`:`text-success`),children:[e.ctxTokens.toLocaleString(),` / `,e.maxContext.toLocaleString(),` tokens`]})]}),(0,R.jsx)(`div`,{className:`h-2 w-full overflow-hidden rounded-full bg-muted`,children:(0,R.jsx)(`div`,{className:A(`h-full rounded-full transition-all`,r>=85?`bg-destructive`:r>=70?`bg-warning`:`bg-primary`),style:{width:`${Math.max(2,r)}%`}})})]}),i&&(0,R.jsxs)(`div`,{className:A(`flex items-center gap-2 rounded-lg border px-3 py-2`,e.status===`running`?`border-primary/30 bg-primary/[0.04]`:`border-border bg-muted/30`),children:[(0,R.jsx)(w,{className:A(`h-4 w-4`,e.status===`running`?`text-primary animate-pulse`:`text-muted-foreground`)}),(0,R.jsx)(`span`,{className:`text-sm font-mono`,children:e.currentTool??e.lastTool}),(0,R.jsx)(`span`,{className:`text-[10px] text-muted-foreground ml-auto`,children:e.currentTool?`Running`:`Last tool`})]}),e.error&&(0,R.jsxs)(`div`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 p-3`,children:[(0,R.jsx)(`span`,{className:`text-[10px] font-semibold text-destructive uppercase tracking-wider`,children:`Error`}),(0,R.jsx)(`p`,{className:`text-xs text-destructive/90 mt-1`,children:e.error.message})]}),e.toolLog.length>0&&(0,R.jsxs)(`div`,{className:`space-y-1`,children:[(0,R.jsxs)(`span`,{className:`text-[10px] font-semibold text-muted-foreground uppercase tracking-wider`,children:[`Tool Log (`,e.toolLog.length,`)`]}),(0,R.jsx)(`div`,{className:`space-y-0.5`,children:e.toolLog.slice(0,10).map((e,t)=>(0,R.jsxs)(`div`,{className:A(`flex items-center gap-2 rounded px-2 py-1 text-[10px] font-mono`,e.ok?`bg-muted/30`:`bg-destructive/5 border border-destructive/20`),children:[(0,R.jsx)(`span`,{className:A(`led shrink-0`,e.ok?`text-success`:`text-destructive`)}),(0,R.jsx)(`span`,{className:`truncate flex-1`,children:e.name}),(0,R.jsxs)(`span`,{className:`tabular text-muted-foreground`,children:[e.durationMs,`ms`]}),!e.ok&&(0,R.jsx)(`span`,{className:`text-destructive`,children:`✗`})]},`${e.name}-${t}`))})]}),e.budgetWarning&&(0,R.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 rounded-lg bg-warning/10 border border-warning/25 text-xs`,children:[(0,R.jsx)(S,{className:`h-3.5 w-3.5 text-warning shrink-0`}),(0,R.jsxs)(`span`,{className:`text-warning`,children:[`Budget: `,e.budgetWarning.kind,` limit (`,e.budgetWarning.used,`/`,e.budgetWarning.limit,`)`]})]})]})}function re(){let[e,t]=(0,L.useState)([]),[n,r]=(0,L.useState)(q),[i,a]=(0,L.useState)(!1),[o,s]=(0,L.useState)(null),c=(0,L.useCallback)(async()=>{a(!0),s(null);try{let e=await I(`agent-roster.list`,{});e.stats&&t(e.stats),e.catalog?.length&&r(e.catalog)}catch(e){s(e instanceof Error?e.message:`Failed to load roster`)}a(!1)},[]);return(0,L.useEffect)(()=>{c()},[c]),(0,L.useEffect)(()=>{let e=null,t=k().on(`agent-roster.updated`,()=>{e&&clearTimeout(e),e=setTimeout(()=>{e=null,c()},300)});return()=>{e&&clearTimeout(e),t()}},[c]),{customStats:e,catalog:n,rosterLoading:i,rosterError:o,loadRoster:c}}function ie({customStats:e,catalog:n,onRefresh:o}){let[s,c]=(0,L.useState)(null),[l,f]=(0,L.useState)(null),[p,m]=(0,L.useState)(``),[h,g]=(0,L.useState)(null),[_,v]=(0,L.useState)(!1),[y,b]=(0,L.useState)(null),[S,C]=(0,L.useState)(!1),[w,E]=(0,L.useState)({name:``,role:``,baseRole:`generic`,purpose:``,taskTypes:``}),D=(0,L.useMemo)(()=>s?e.find(e=>e.role===s):null,[s,e]),j=(0,L.useMemo)(()=>{let e=n.find(e=>e.role===s);return e?.systemProtected??!e?.custom},[n,s]),M=(0,L.useCallback)(async(e,t)=>{v(!0),b(null),c(e);try{let n=await I(`agent-roster.read-customization`,{role:e});m(t===`config`?`${JSON.stringify(n.config??{},null,2)}\n`:n[t]??``),f(t),g(null)}catch(e){b(e instanceof Error?e.message:`Failed to load customization`)}finally{v(!1)}},[]),N=(0,L.useCallback)(async e=>{v(!0),b(null),c(e);try{let t=await I(`agent-roster.read-customization`,{role:e});g(t.config??{}),f(null)}catch(e){b(e instanceof Error?e.message:`Failed to load runtime policy`)}finally{v(!1)}},[]),P=(0,L.useCallback)(async e=>{if(s){v(!0),b(null);try{await I(`agent-roster.update-config`,{role:s,config:e}),g(null),o()}catch(e){b(e instanceof Error?e.message:`Runtime policy save failed`)}finally{v(!1)}}},[o,s]),F=(0,L.useCallback)(async()=>{if(!(!s||!l)){v(!0);try{let e={identity:`agent-roster.update-identity`,learned:`agent-roster.update-learned`,config:`agent-roster.update-config`},t={role:s};if(l===`config`)try{t.config=JSON.parse(p)}catch{b(`config.json must contain valid JSON`),v(!1);return}else t.content=p;await I(e[l],t),f(null),b(null),o()}catch(e){b(e instanceof Error?e.message:`Save failed`)}v(!1)}},[s,l,p,o]),z=(0,L.useCallback)(async()=>{if(s)try{let e=await I(`agent-roster.llm-improve`,{role:s,prompt:`Improve this agent for optimal project performance`});if(!e.instruction)throw Error(`No improvement instruction generated`);let n=t.getState();n.addMessage({role:`user`,content:e.instruction}),n.setLoading(!0),k().sendMessage(e.instruction);let r=O.getState();r.setSidebarOpen(!1),r.setCurrentView(`chat`)}catch(e){b(e instanceof Error?e.message:`LLM improvement failed`)}},[s]),B=(0,L.useCallback)(async e=>{if(window.confirm(`Reset all project-specific data for agent "${e}"?`))try{await I(`agent-roster.reset`,{role:e}),c(null),o()}catch{}},[o]),V=(0,L.useCallback)(async()=>{let e=w.taskTypes.split(/[\n,]+/).map(e=>e.trim()).filter(Boolean);v(!0),b(null);try{let t=await I(`agent-roster.create`,{name:w.name,role:w.role,baseRole:w.baseRole,purpose:w.purpose,taskTypes:e});C(!1),E({name:``,role:``,baseRole:`generic`,purpose:``,taskTypes:``}),c(t.role),o()}catch(e){b(e instanceof Error?e.message:`Agent creation failed`)}finally{v(!1)}},[w,o]),H=(0,L.useMemo)(()=>[...e].sort((e,t)=>{let n=+!!e.hasIdentity+ +(e.entryCount>0)+ +!!e.hasConfig;return+!!t.hasIdentity+ +(t.entryCount>0)+ +!!t.hasConfig-n}),[e]);return(0,R.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:[(0,R.jsxs)(`div`,{className:`w-80 shrink-0 border-r border-border/50 flex flex-col overflow-hidden`,children:[(0,R.jsx)(`div`,{className:`shrink-0 border-b border-border/50 px-3 py-2`,children:(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,R.jsxs)(`h3`,{className:`flex items-center gap-1.5 text-xs font-semibold`,children:[(0,R.jsx)(T,{className:`h-3.5 w-3.5`}),`Project Agents`]}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>{C(!0),c(null),g(null),b(null)},className:`rounded border border-primary/40 px-1.5 py-1 text-[9px] text-primary hover:bg-primary/10`,children:`+ Clone`})]})}),(0,R.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-2 space-y-1`,children:[H.map(e=>(0,R.jsxs)(`button`,{type:`button`,onClick:()=>{c(e.role),g(null),f(null)},className:A(`w-full text-left rounded-lg border px-3 py-2 transition-colors`,s===e.role?`border-primary/50 bg-primary/[0.06]`:`border-border/60 hover:border-primary/30`),children:[(0,R.jsx)(`div`,{className:`text-xs font-semibold`,children:e.role}),(0,R.jsxs)(`div`,{className:`flex gap-2 mt-0.5 text-[9px] text-muted-foreground`,children:[e.hasIdentity&&(0,R.jsx)(`span`,{className:`text-primary`,children:`id`}),e.entryCount>0&&(0,R.jsxs)(`span`,{className:`text-brand-2`,children:[e.entryCount,`e`]}),e.hasConfig&&(0,R.jsx)(`span`,{children:`cfg`})]})]},e.role)),H.length===0&&(0,R.jsx)(`div`,{className:`text-[10px] text-muted-foreground text-center py-4`,children:`No customizations yet`})]})]}),(0,R.jsxs)(`div`,{className:`flex-1 min-w-0 overflow-y-auto p-4`,children:[S&&(0,R.jsxs)(`div`,{className:`max-w-2xl space-y-4`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h3`,{className:`text-base font-semibold`,children:`Create or Clone Project Agent`}),(0,R.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Inherit any roster agent as a template, then develop an independent identity, runtime policy and learned history.`})]}),(0,R.jsxs)(`label`,{className:`block space-y-1 text-xs`,children:[(0,R.jsx)(`span`,{className:`font-medium`,children:`Clone from roster role`}),(0,R.jsx)(`select`,{value:w.baseRole,onChange:e=>E(t=>({...t,baseRole:e.target.value})),className:`h-9 w-full rounded border border-border bg-card px-2`,children:[...n].sort((e,t)=>e.name.localeCompare(t.name)).map(e=>(0,R.jsxs)(`option`,{value:e.role,children:[e.name,` (`,e.role,`)`]},e.role))}),(0,R.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`Prompt, tools, skills and defaults are inherited. Learning and later edits remain isolated to the new agent.`})]}),(0,R.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,R.jsxs)(`label`,{className:`space-y-1 text-xs`,children:[(0,R.jsx)(`span`,{className:`font-medium`,children:`Display name`}),(0,R.jsx)(`input`,{value:w.name,onChange:e=>E(t=>({...t,name:e.target.value})),placeholder:`ABC`,className:`h-9 w-full rounded border border-border bg-card px-2`})]}),(0,R.jsxs)(`label`,{className:`space-y-1 text-xs`,children:[(0,R.jsx)(`span`,{className:`font-medium`,children:`Role id (optional)`}),(0,R.jsx)(`input`,{value:w.role,onChange:e=>E(t=>({...t,role:e.target.value})),placeholder:`abc (generated from name)`,className:`h-9 w-full rounded border border-border bg-card px-2 font-mono`})]})]}),(0,R.jsxs)(`label`,{className:`block space-y-1 text-xs`,children:[(0,R.jsx)(`span`,{className:`font-medium`,children:`Purpose`}),(0,R.jsx)(`textarea`,{value:w.purpose,onChange:e=>E(t=>({...t,purpose:e.target.value})),placeholder:`Own X, Y and Z workflows for this project and verify their results.`,className:`h-24 w-full resize-y rounded border border-border bg-card p-2`})]}),(0,R.jsxs)(`label`,{className:`block space-y-1 text-xs`,children:[(0,R.jsx)(`span`,{className:`font-medium`,children:`Task types (comma or one per line)`}),(0,R.jsx)(`textarea`,{value:w.taskTypes,onChange:e=>E(t=>({...t,taskTypes:e.target.value})),placeholder:`X workflow
10
- Y analysis
11
- Z verification`,className:`h-24 w-full resize-y rounded border border-border bg-card p-2`})]}),y&&(0,R.jsx)(`p`,{className:`text-xs text-destructive`,children:y}),(0,R.jsxs)(`div`,{className:`flex gap-2`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:V,disabled:_||!w.name.trim()||w.purpose.trim().length<10||!w.taskTypes.trim(),className:`rounded bg-primary px-3 py-1.5 text-xs text-primary-foreground disabled:opacity-50`,children:_?`Creating…`:`Clone Agent`}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>C(!1),className:`rounded border border-border px-3 py-1.5 text-xs hover:bg-accent`,children:`Cancel`})]})]}),!S&&!s&&(0,R.jsx)(`div`,{className:`flex items-center justify-center h-full text-muted-foreground`,children:`Select an agent to edit customizations`}),!S&&s&&D&&(0,R.jsxs)(`div`,{className:`space-y-4 max-w-2xl`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,R.jsx)(`h3`,{className:`text-base font-semibold`,children:s}),(0,R.jsxs)(`div`,{className:`flex gap-1`,children:[(0,R.jsxs)(`button`,{type:`button`,onClick:z,className:`inline-flex items-center gap-1 rounded border border-border/50 px-2 py-1 text-[10px] hover:bg-accent transition-colors`,children:[(0,R.jsx)(a,{className:`h-3 w-3 text-brand-2`}),` LLM Improve`]}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>B(s),className:`inline-flex items-center gap-1 rounded border border-destructive/30 px-2 py-1 text-[10px] text-destructive hover:bg-destructive/10 transition-colors`,children:[(0,R.jsx)(r,{className:`h-3 w-3`}),` Reset`]})]})]}),(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[D.hasIdentity&&(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded bg-primary/10 px-2 py-1 text-[10px] text-primary`,children:[(0,R.jsx)(i,{className:`h-3 w-3`}),` identity.md`]}),D.hasConfig&&(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded bg-muted px-2 py-1 text-[10px] text-muted-foreground`,children:[(0,R.jsx)(T,{className:`h-3 w-3`}),` config.json`]}),D.hasKnowledge&&(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded bg-muted px-2 py-1 text-[10px] text-muted-foreground`,children:[(0,R.jsx)(x,{className:`h-3 w-3`}),` knowledge.json`]}),D.entryCount>0&&(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded bg-brand-2/10 px-2 py-1 text-[10px] text-brand-2`,children:[(0,R.jsx)(d,{className:`h-3 w-3`}),` `,D.entryCount,` learned entries`]})]}),(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>M(s,`identity`),className:`inline-flex items-center gap-1 rounded border border-border/50 px-3 py-1.5 text-xs hover:bg-accent transition-colors`,children:[(0,R.jsx)(i,{className:`h-3.5 w-3.5`}),` Edit identity.md`]}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>M(s,`learned`),className:`inline-flex items-center gap-1 rounded border border-border/50 px-3 py-1.5 text-xs hover:bg-accent transition-colors`,children:[(0,R.jsx)(d,{className:`h-3.5 w-3.5`}),` Edit learned.md`]}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>N(s),className:`inline-flex items-center gap-1 rounded border border-primary/40 bg-primary/5 px-3 py-1.5 text-xs text-primary hover:bg-primary/10 transition-colors`,children:[(0,R.jsx)(u,{className:`h-3.5 w-3.5`}),` Runtime policy`]}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>M(s,`config`),className:`inline-flex items-center gap-1 rounded border border-border/50 px-3 py-1.5 text-xs hover:bg-accent transition-colors`,children:[(0,R.jsx)(T,{className:`h-3.5 w-3.5`}),` Edit config.json`]})]}),y&&(0,R.jsx)(`p`,{className:`text-xs text-destructive`,children:y}),h&&(0,R.jsx)(G,{initialConfig:h,systemProtected:j,saving:_,onSave:P,onCancel:()=>g(null)},s),l&&(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,R.jsxs)(`span`,{className:`text-xs font-medium`,children:[l,`.md / `,l,`.json`]}),(0,R.jsxs)(`div`,{className:`flex gap-1`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:F,disabled:_,className:`inline-flex items-center gap-1 rounded bg-primary px-3 py-1.5 text-xs text-primary-foreground hover:bg-primary/90 transition-colors disabled:opacity-50`,children:_?`Saving…`:`Save`}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>f(null),className:`inline-flex items-center gap-1 rounded border border-border/50 px-3 py-1.5 text-xs hover:bg-accent transition-colors`,children:`Cancel`})]})]}),(0,R.jsx)(`textarea`,{className:`w-full h-48 font-mono text-xs p-2 bg-card border border-border rounded resize-y`,value:p,onChange:e=>m(e.target.value),placeholder:l===`config`?`{ "tools": [...], "budget": {...} }`:`# Project identity for ${s}\n\nDescribe this agent's role…`})]})]})]})]})}function ae({className:e}){let[t,n]=(0,L.useState)(`live`),[r,i]=(0,L.useState)(Date.now()),{customStats:a,catalog:o,rosterLoading:s,rosterError:c,loadRoster:l}=re();return(0,L.useEffect)(()=>{let e=setInterval(()=>{document.hidden||i(Date.now())},2e3);return()=>clearInterval(e)},[]),(0,R.jsxs)(`div`,{className:A(`flex h-full min-h-0 min-w-0 w-full flex-col overflow-hidden`,e),children:[(0,R.jsx)(J,{customStats:a,rosterLoading:s,onRefresh:l}),(0,R.jsx)(Y,{activeTab:t,onTabChange:n}),(0,R.jsxs)(`div`,{className:`flex min-h-0 min-w-0 w-full flex-1 overflow-hidden bg-background/50`,children:[c&&(0,R.jsxs)(`div`,{className:`flex items-center justify-center w-full text-destructive text-xs gap-2`,children:[(0,R.jsx)(_,{className:`h-4 w-4`}),c,(0,R.jsx)(`button`,{type:`button`,onClick:l,className:`underline`,children:`Retry`})]}),t===`live`&&(0,R.jsx)(te,{nowTick:r}),t===`catalog`&&(0,R.jsx)(ee,{customStats:a,catalog:o}),t===`learning`&&(0,R.jsx)(X,{customStats:a,onRefresh:l}),t===`customize`&&(0,R.jsx)(ie,{customStats:a,catalog:o,onRefresh:l})]})]})}export{ae as AgentRosterView};