@hotmeshio/long-tail 0.7.3 → 0.7.5

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 (213) hide show
  1. package/build/api/roles.d.ts +4 -0
  2. package/build/api/roles.js +7 -1
  3. package/build/lib/db/schemas/019_role_priority.sql +28 -0
  4. package/build/routes/roles.js +1 -1
  5. package/build/scripts/ortho-populate.d.ts +7 -1
  6. package/build/scripts/ortho-populate.js +21 -6
  7. package/build/services/escalation/facet-sql.d.ts +1 -0
  8. package/build/services/escalation/facet-sql.js +7 -6
  9. package/build/services/escalation/queries.js +27 -5
  10. package/build/services/escalation/sql.d.ts +19 -2
  11. package/build/services/escalation/sql.js +32 -9
  12. package/build/services/escalation/types.d.ts +7 -1
  13. package/build/services/role/index.js +2 -0
  14. package/build/services/role/sql.d.ts +4 -4
  15. package/build/services/role/sql.js +12 -6
  16. package/build/services/role/types.d.ts +14 -0
  17. package/build/system/mcp-servers/admin/schemas.d.ts +6 -0
  18. package/build/system/mcp-servers/admin/schemas.js +3 -0
  19. package/build/system/mcp-servers/admin/users.js +4 -1
  20. package/build/system/seed/tool-manifests-admin.d.ts +152 -0
  21. package/build/system/seed/tool-manifests-admin.js +1 -1
  22. package/dashboard/dist/assets/{AdminDashboard-C9eE1VEp.js → AdminDashboard-Bgomc_jH.js} +2 -2
  23. package/dashboard/dist/assets/{AdminDashboard-C9eE1VEp.js.map → AdminDashboard-Bgomc_jH.js.map} +1 -1
  24. package/dashboard/dist/assets/{AgentConfigPage-Ba8QfXM2.js → AgentConfigPage-C6gDgz21.js} +6 -6
  25. package/dashboard/dist/assets/{AgentConfigPage-Ba8QfXM2.js.map → AgentConfigPage-C6gDgz21.js.map} +1 -1
  26. package/dashboard/dist/assets/{AgentDetailPage-DVmec0CP.js → AgentDetailPage-0rrH5FmV.js} +4 -4
  27. package/dashboard/dist/assets/{AgentDetailPage-DVmec0CP.js.map → AgentDetailPage-0rrH5FmV.js.map} +1 -1
  28. package/dashboard/dist/assets/{AgentsPage-DNiCYMh3.js → AgentsPage-DkIU2zed.js} +2 -2
  29. package/dashboard/dist/assets/{AgentsPage-DNiCYMh3.js.map → AgentsPage-DkIU2zed.js.map} +1 -1
  30. package/dashboard/dist/assets/{AvailableEscalationsPage-gDIF8ocC.js → AvailableEscalationsPage-C9DAtNGp.js} +2 -2
  31. package/dashboard/dist/assets/{AvailableEscalationsPage-gDIF8ocC.js.map → AvailableEscalationsPage-C9DAtNGp.js.map} +1 -1
  32. package/dashboard/dist/assets/{BotPicker-3wBcBavT.js → BotPicker-MnI3OyE7.js} +2 -2
  33. package/dashboard/dist/assets/{BotPicker-3wBcBavT.js.map → BotPicker-MnI3OyE7.js.map} +1 -1
  34. package/dashboard/dist/assets/{CapabilitiesPage-WoPkND2y.js → CapabilitiesPage-Cv_AD_5i.js} +2 -2
  35. package/dashboard/dist/assets/{CapabilitiesPage-WoPkND2y.js.map → CapabilitiesPage-Cv_AD_5i.js.map} +1 -1
  36. package/dashboard/dist/assets/{CollapsibleSection-Cx99mqNN.js → CollapsibleSection-Ne-Q3QFM.js} +2 -2
  37. package/dashboard/dist/assets/{CollapsibleSection-Cx99mqNN.js.map → CollapsibleSection-Ne-Q3QFM.js.map} +1 -1
  38. package/dashboard/dist/assets/{CredentialsPage-DbNaoPbF.js → CredentialsPage-B3Mfwl22.js} +2 -2
  39. package/dashboard/dist/assets/{CredentialsPage-DbNaoPbF.js.map → CredentialsPage-B3Mfwl22.js.map} +1 -1
  40. package/dashboard/dist/assets/{CronLabel-DLW4_Zg4.js → CronLabel-CtjUBRPo.js} +2 -2
  41. package/dashboard/dist/assets/{CronLabel-DLW4_Zg4.js.map → CronLabel-CtjUBRPo.js.map} +1 -1
  42. package/dashboard/dist/assets/{CustomDurationPicker-BRUFjkiu.js → CustomDurationPicker-Cp1fgzPX.js} +2 -2
  43. package/dashboard/dist/assets/{CustomDurationPicker-BRUFjkiu.js.map → CustomDurationPicker-Cp1fgzPX.js.map} +1 -1
  44. package/dashboard/dist/assets/{DropZone-DEX0BBqt.js → DropZone-CZDmNBn-.js} +2 -2
  45. package/dashboard/dist/assets/{DropZone-DEX0BBqt.js.map → DropZone-CZDmNBn-.js.map} +1 -1
  46. package/dashboard/dist/assets/{ElapsedCell-BtmDQaym.js → ElapsedCell-Gr5UlUbn.js} +2 -2
  47. package/dashboard/dist/assets/{ElapsedCell-BtmDQaym.js.map → ElapsedCell-Gr5UlUbn.js.map} +1 -1
  48. package/dashboard/dist/assets/{EscalationSchemaPage-Bm4yBEGN.js → EscalationSchemaPage-C5tuV6SJ.js} +2 -2
  49. package/dashboard/dist/assets/{EscalationSchemaPage-Bm4yBEGN.js.map → EscalationSchemaPage-C5tuV6SJ.js.map} +1 -1
  50. package/dashboard/dist/assets/{EscalationsOverview-B3xZwTQA.js → EscalationsOverview-BIZVnSBF.js} +2 -2
  51. package/dashboard/dist/assets/{EscalationsOverview-B3xZwTQA.js.map → EscalationsOverview-BIZVnSBF.js.map} +1 -1
  52. package/dashboard/dist/assets/{EventTable-Bh9FKXLI.js → EventTable-90aUfsNr.js} +2 -2
  53. package/dashboard/dist/assets/{EventTable-Bh9FKXLI.js.map → EventTable-90aUfsNr.js.map} +1 -1
  54. package/dashboard/dist/assets/{GraphInvokePage-ov_ANlaE.js → GraphInvokePage-Io5ZucT8.js} +2 -2
  55. package/dashboard/dist/assets/{GraphInvokePage-ov_ANlaE.js.map → GraphInvokePage-Io5ZucT8.js.map} +1 -1
  56. package/dashboard/dist/assets/{HomePage-D0DV6izb.js → HomePage-Cu0vUzTF.js} +2 -2
  57. package/dashboard/dist/assets/{HomePage-D0DV6izb.js.map → HomePage-Cu0vUzTF.js.map} +1 -1
  58. package/dashboard/dist/assets/{ListToolbar-FpcvqNkN.js → ListToolbar-CdmIvEIF.js} +2 -2
  59. package/dashboard/dist/assets/{ListToolbar-FpcvqNkN.js.map → ListToolbar-CdmIvEIF.js.map} +1 -1
  60. package/dashboard/dist/assets/{McpOverview-DcuRiAff.js → McpOverview-C-Ypezuv.js} +2 -2
  61. package/dashboard/dist/assets/{McpOverview-DcuRiAff.js.map → McpOverview-C-Ypezuv.js.map} +1 -1
  62. package/dashboard/dist/assets/{McpQueryDetailPage-BcYl67KP.js → McpQueryDetailPage-DdontKcj.js} +2 -2
  63. package/dashboard/dist/assets/{McpQueryDetailPage-BcYl67KP.js.map → McpQueryDetailPage-DdontKcj.js.map} +1 -1
  64. package/dashboard/dist/assets/{McpQueryPage-C3GDzqZM.js → McpQueryPage-D-1TaOGG.js} +2 -2
  65. package/dashboard/dist/assets/{McpQueryPage-C3GDzqZM.js.map → McpQueryPage-D-1TaOGG.js.map} +1 -1
  66. package/dashboard/dist/assets/{McpRunDetailPage-SzOyhDBW.js → McpRunDetailPage-B1sCxKLD.js} +2 -2
  67. package/dashboard/dist/assets/{McpRunDetailPage-SzOyhDBW.js.map → McpRunDetailPage-B1sCxKLD.js.map} +1 -1
  68. package/dashboard/dist/assets/{McpRunsPage-BwgB6mRV.js → McpRunsPage-eWJ7cDa3.js} +2 -2
  69. package/dashboard/dist/assets/{McpRunsPage-BwgB6mRV.js.map → McpRunsPage-eWJ7cDa3.js.map} +1 -1
  70. package/dashboard/dist/assets/{NamespacePill-CwKdoyRM.js → NamespacePill-DlqBTvFR.js} +2 -2
  71. package/dashboard/dist/assets/{NamespacePill-CwKdoyRM.js.map → NamespacePill-DlqBTvFR.js.map} +1 -1
  72. package/dashboard/dist/assets/OperationsPage-C5phWL0O.js +2 -0
  73. package/dashboard/dist/assets/OperationsPage-C5phWL0O.js.map +1 -0
  74. package/dashboard/dist/assets/{OperatorDashboard-DSXh-yYw.js → OperatorDashboard-YP6kP-f_.js} +2 -2
  75. package/dashboard/dist/assets/{OperatorDashboard-DSXh-yYw.js.map → OperatorDashboard-YP6kP-f_.js.map} +1 -1
  76. package/dashboard/dist/assets/{PageHeader-BhaWTWcM.js → PageHeader-CFta2VaS.js} +2 -2
  77. package/dashboard/dist/assets/{PageHeader-BhaWTWcM.js.map → PageHeader-CFta2VaS.js.map} +1 -1
  78. package/dashboard/dist/assets/{PageHeaderWithStats-yex5WmHB.js → PageHeaderWithStats-CcVAji-7.js} +2 -2
  79. package/dashboard/dist/assets/{PageHeaderWithStats-yex5WmHB.js.map → PageHeaderWithStats-CcVAji-7.js.map} +1 -1
  80. package/dashboard/dist/assets/{ProcessDetailPage-iIB1rwEt.js → ProcessDetailPage-C_BXQvBs.js} +2 -2
  81. package/dashboard/dist/assets/{ProcessDetailPage-iIB1rwEt.js.map → ProcessDetailPage-C_BXQvBs.js.map} +1 -1
  82. package/dashboard/dist/assets/{ProcessesListPage-BrqWR2zr.js → ProcessesListPage-BNhFwTLl.js} +2 -2
  83. package/dashboard/dist/assets/{ProcessesListPage-BrqWR2zr.js.map → ProcessesListPage-BNhFwTLl.js.map} +1 -1
  84. package/dashboard/dist/assets/RoleDetailPage-8GLNjj9I.js +11 -0
  85. package/dashboard/dist/assets/RoleDetailPage-8GLNjj9I.js.map +1 -0
  86. package/dashboard/dist/assets/{RolePill-Cl71eDUA.js → RolePill-CXEyPMqb.js} +2 -2
  87. package/dashboard/dist/assets/{RolePill-Cl71eDUA.js.map → RolePill-CXEyPMqb.js.map} +1 -1
  88. package/dashboard/dist/assets/{RolesPage-Bzp9FhAl.js → RolesPage-B59tE2lZ.js} +2 -2
  89. package/dashboard/dist/assets/{RolesPage-Bzp9FhAl.js.map → RolesPage-B59tE2lZ.js.map} +1 -1
  90. package/dashboard/dist/assets/{RunAsSelector-DXbHRxQs.js → RunAsSelector-CokM3Ifp.js} +2 -2
  91. package/dashboard/dist/assets/{RunAsSelector-DXbHRxQs.js.map → RunAsSelector-CokM3Ifp.js.map} +1 -1
  92. package/dashboard/dist/assets/{StickyPagination-D8XuMSWD.js → StickyPagination-_H2j2CAH.js} +2 -2
  93. package/dashboard/dist/assets/{StickyPagination-D8XuMSWD.js.map → StickyPagination-_H2j2CAH.js.map} +1 -1
  94. package/dashboard/dist/assets/{StreamMessageDetail-D5v95pmz.js → StreamMessageDetail-sSfHDYIa.js} +2 -2
  95. package/dashboard/dist/assets/{StreamMessageDetail-D5v95pmz.js.map → StreamMessageDetail-sSfHDYIa.js.map} +1 -1
  96. package/dashboard/dist/assets/{SwimlaneTimeline-CUEf2R5R.js → SwimlaneTimeline-LZWtfBK3.js} +2 -2
  97. package/dashboard/dist/assets/{SwimlaneTimeline-CUEf2R5R.js.map → SwimlaneTimeline-LZWtfBK3.js.map} +1 -1
  98. package/dashboard/dist/assets/{TagInput-B_WQiuer.js → TagInput-CQg-TrV9.js} +2 -2
  99. package/dashboard/dist/assets/{TagInput-B_WQiuer.js.map → TagInput-CQg-TrV9.js.map} +1 -1
  100. package/dashboard/dist/assets/{TaskDetailPage-BJvKNwEe.js → TaskDetailPage-CHBV2V6R.js} +2 -2
  101. package/dashboard/dist/assets/{TaskDetailPage-BJvKNwEe.js.map → TaskDetailPage-CHBV2V6R.js.map} +1 -1
  102. package/dashboard/dist/assets/{TaskQueuePill-Lgn2obNU.js → TaskQueuePill-DyvtL8X4.js} +2 -2
  103. package/dashboard/dist/assets/{TaskQueuePill-Lgn2obNU.js.map → TaskQueuePill-DyvtL8X4.js.map} +1 -1
  104. package/dashboard/dist/assets/{TasksListPage-CM7BWh_h.js → TasksListPage-B71FxvrY.js} +2 -2
  105. package/dashboard/dist/assets/{TasksListPage-CM7BWh_h.js.map → TasksListPage-B71FxvrY.js.map} +1 -1
  106. package/dashboard/dist/assets/{TimeAgo-D1K7xKq5.js → TimeAgo-JgT0U_sd.js} +2 -2
  107. package/dashboard/dist/assets/{TimeAgo-D1K7xKq5.js.map → TimeAgo-JgT0U_sd.js.map} +1 -1
  108. package/dashboard/dist/assets/{TimestampCell-7G0echgP.js → TimestampCell-gEreK8Nn.js} +2 -2
  109. package/dashboard/dist/assets/{TimestampCell-7G0echgP.js.map → TimestampCell-gEreK8Nn.js.map} +1 -1
  110. package/dashboard/dist/assets/{ToolPill-uVqcbHPE.js → ToolPill-miuRcj1Q.js} +2 -2
  111. package/dashboard/dist/assets/{ToolPill-uVqcbHPE.js.map → ToolPill-miuRcj1Q.js.map} +1 -1
  112. package/dashboard/dist/assets/{ToolTestPanel-LxuJvURK.js → ToolTestPanel-ChfHw9Aq.js} +2 -2
  113. package/dashboard/dist/assets/{ToolTestPanel-LxuJvURK.js.map → ToolTestPanel-ChfHw9Aq.js.map} +1 -1
  114. package/dashboard/dist/assets/{TopicDetailPage-JvAX6rrR.js → TopicDetailPage-DigI0HGt.js} +2 -2
  115. package/dashboard/dist/assets/{TopicDetailPage-JvAX6rrR.js.map → TopicDetailPage-DigI0HGt.js.map} +1 -1
  116. package/dashboard/dist/assets/{TopicsPage-tFT2AcTz.js → TopicsPage-BHjlFpPN.js} +2 -2
  117. package/dashboard/dist/assets/{TopicsPage-tFT2AcTz.js.map → TopicsPage-BHjlFpPN.js.map} +1 -1
  118. package/dashboard/dist/assets/{UserName-Djz0nmaZ.js → UserName-uncbaKYf.js} +2 -2
  119. package/dashboard/dist/assets/{UserName-Djz0nmaZ.js.map → UserName-uncbaKYf.js.map} +1 -1
  120. package/dashboard/dist/assets/{WorkflowExecutionPage-f53hilbI.js → WorkflowExecutionPage-DwzLKTkt.js} +2 -2
  121. package/dashboard/dist/assets/{WorkflowExecutionPage-f53hilbI.js.map → WorkflowExecutionPage-DwzLKTkt.js.map} +1 -1
  122. package/dashboard/dist/assets/{WorkflowPill-IDjTRfQ8.js → WorkflowPill-BegV-iRF.js} +2 -2
  123. package/dashboard/dist/assets/{WorkflowPill-IDjTRfQ8.js.map → WorkflowPill-BegV-iRF.js.map} +1 -1
  124. package/dashboard/dist/assets/{WorkflowsDashboard-DM9Xe665.js → WorkflowsDashboard-rpnGhGnl.js} +2 -2
  125. package/dashboard/dist/assets/{WorkflowsDashboard-DM9Xe665.js.map → WorkflowsDashboard-rpnGhGnl.js.map} +1 -1
  126. package/dashboard/dist/assets/{WorkflowsOverview-CUGSrx9N.js → WorkflowsOverview-ihhW8DiS.js} +2 -2
  127. package/dashboard/dist/assets/{WorkflowsOverview-CUGSrx9N.js.map → WorkflowsOverview-ihhW8DiS.js.map} +1 -1
  128. package/dashboard/dist/assets/{YamlWorkflowDetailPage-B1_yqxAw.js → YamlWorkflowDetailPage-C61-8y-E.js} +2 -2
  129. package/dashboard/dist/assets/{YamlWorkflowDetailPage-B1_yqxAw.js.map → YamlWorkflowDetailPage-C61-8y-E.js.map} +1 -1
  130. package/dashboard/dist/assets/{YamlWorkflowsPage-NtGvqiu7.js → YamlWorkflowsPage-CMpgsLEo.js} +2 -2
  131. package/dashboard/dist/assets/{YamlWorkflowsPage-NtGvqiu7.js.map → YamlWorkflowsPage-CMpgsLEo.js.map} +1 -1
  132. package/dashboard/dist/assets/{agents-tML6AjDj.js → agents-27sErp5R.js} +2 -2
  133. package/dashboard/dist/assets/{agents-tML6AjDj.js.map → agents-27sErp5R.js.map} +1 -1
  134. package/dashboard/dist/assets/{bots-Cb0WTwhY.js → bots-CPHuAvjW.js} +2 -2
  135. package/dashboard/dist/assets/{bots-Cb0WTwhY.js.map → bots-CPHuAvjW.js.map} +1 -1
  136. package/dashboard/dist/assets/{capabilities-BGZogsi_.js → capabilities-BBTPqF-V.js} +2 -2
  137. package/dashboard/dist/assets/{capabilities-BGZogsi_.js.map → capabilities-BBTPqF-V.js.map} +1 -1
  138. package/dashboard/dist/assets/{controlplane-B7VJTlZD.js → controlplane-C9j2mwX8.js} +2 -2
  139. package/dashboard/dist/assets/{controlplane-B7VJTlZD.js.map → controlplane-C9j2mwX8.js.map} +1 -1
  140. package/dashboard/dist/assets/{escalation-Bl-SQV_u.js → escalation-CyJ_wz-f.js} +2 -2
  141. package/dashboard/dist/assets/{escalation-Bl-SQV_u.js.map → escalation-CyJ_wz-f.js.map} +1 -1
  142. package/dashboard/dist/assets/{escalation-columns-BlJOswRx.js → escalation-columns-DU4Jyxxo.js} +2 -2
  143. package/dashboard/dist/assets/{escalation-columns-BlJOswRx.js.map → escalation-columns-DU4Jyxxo.js.map} +1 -1
  144. package/dashboard/dist/assets/{index-e97M6GoI.js → index-BBQggGcf.js} +2 -2
  145. package/dashboard/dist/assets/{index-e97M6GoI.js.map → index-BBQggGcf.js.map} +1 -1
  146. package/dashboard/dist/assets/{index-D0-8byNu.js → index-BHS-ubrT.js} +2 -2
  147. package/dashboard/dist/assets/{index-D0-8byNu.js.map → index-BHS-ubrT.js.map} +1 -1
  148. package/dashboard/dist/assets/{index-DcbEIXit.js → index-BVHXREYZ.js} +2 -2
  149. package/dashboard/dist/assets/{index-DcbEIXit.js.map → index-BVHXREYZ.js.map} +1 -1
  150. package/dashboard/dist/assets/{index-Il_g7kw5.js → index-BiLZJ43R.js} +2 -2
  151. package/dashboard/dist/assets/{index-Il_g7kw5.js.map → index-BiLZJ43R.js.map} +1 -1
  152. package/dashboard/dist/assets/{index-Dgw1KKpq.js → index-BoZydcaW.js} +4 -4
  153. package/dashboard/dist/assets/{index-Dgw1KKpq.js.map → index-BoZydcaW.js.map} +1 -1
  154. package/dashboard/dist/assets/{index-CBv3UxF2.js → index-CCHGKErT.js} +2 -2
  155. package/dashboard/dist/assets/{index-CBv3UxF2.js.map → index-CCHGKErT.js.map} +1 -1
  156. package/dashboard/dist/assets/{index-0o71lRuY.js → index-CNprOGuS.js} +2 -2
  157. package/dashboard/dist/assets/{index-0o71lRuY.js.map → index-CNprOGuS.js.map} +1 -1
  158. package/dashboard/dist/assets/{index-Wny0bRgq.css → index-CZ6-l8_0.css} +1 -1
  159. package/dashboard/dist/assets/{index-3A_5CL81.js → index-CgeFUhUr.js} +2 -2
  160. package/dashboard/dist/assets/{index-3A_5CL81.js.map → index-CgeFUhUr.js.map} +1 -1
  161. package/dashboard/dist/assets/{index-TiKh2Ctj.js → index-ChniBGqD.js} +2 -2
  162. package/dashboard/dist/assets/{index-TiKh2Ctj.js.map → index-ChniBGqD.js.map} +1 -1
  163. package/dashboard/dist/assets/{index--WeZDfeN.js → index-CjXzZ19T.js} +2 -2
  164. package/dashboard/dist/assets/{index--WeZDfeN.js.map → index-CjXzZ19T.js.map} +1 -1
  165. package/dashboard/dist/assets/{index-DfDfJivY.js → index-D9pi0fs6.js} +2 -2
  166. package/dashboard/dist/assets/{index-DfDfJivY.js.map → index-D9pi0fs6.js.map} +1 -1
  167. package/dashboard/dist/assets/{index-SCrD3l-K.js → index-DoivEaUZ.js} +2 -2
  168. package/dashboard/dist/assets/{index-SCrD3l-K.js.map → index-DoivEaUZ.js.map} +1 -1
  169. package/dashboard/dist/assets/{index-BorpZbZA.js → index-Dzqt3g-K.js} +2 -2
  170. package/dashboard/dist/assets/{index-BorpZbZA.js.map → index-Dzqt3g-K.js.map} +1 -1
  171. package/dashboard/dist/assets/{knowledge-CDzw4E6q.js → knowledge-BErJA3Je.js} +2 -2
  172. package/dashboard/dist/assets/{knowledge-CDzw4E6q.js.map → knowledge-BErJA3Je.js.map} +1 -1
  173. package/dashboard/dist/assets/{mcp-D_-NQtnG.js → mcp-Cx9L42EN.js} +2 -2
  174. package/dashboard/dist/assets/{mcp-D_-NQtnG.js.map → mcp-Cx9L42EN.js.map} +1 -1
  175. package/dashboard/dist/assets/{mcp-query-BqZXdf9A.js → mcp-query-Cf6kcBoW.js} +2 -2
  176. package/dashboard/dist/assets/{mcp-query-BqZXdf9A.js.map → mcp-query-Cf6kcBoW.js.map} +1 -1
  177. package/dashboard/dist/assets/{pipelines-CNLhgj8b.js → pipelines-CFctrv71.js} +2 -2
  178. package/dashboard/dist/assets/{pipelines-CNLhgj8b.js.map → pipelines-CFctrv71.js.map} +1 -1
  179. package/dashboard/dist/assets/{roles-CFD2eYap.js → roles-CCXZtqDr.js} +2 -2
  180. package/dashboard/dist/assets/roles-CCXZtqDr.js.map +1 -0
  181. package/dashboard/dist/assets/{tasks-DcSvF636.js → tasks-BPNj8ZWL.js} +2 -2
  182. package/dashboard/dist/assets/{tasks-DcSvF636.js.map → tasks-BPNj8ZWL.js.map} +1 -1
  183. package/dashboard/dist/assets/{topics-DI8TFSZv.js → topics-CR4UBuSV.js} +2 -2
  184. package/dashboard/dist/assets/{topics-DI8TFSZv.js.map → topics-CR4UBuSV.js.map} +1 -1
  185. package/dashboard/dist/assets/{useEventHooks-DcIgMDh3.js → useEventHooks-BgdnN8Rj.js} +2 -2
  186. package/dashboard/dist/assets/{useEventHooks-DcIgMDh3.js.map → useEventHooks-BgdnN8Rj.js.map} +1 -1
  187. package/dashboard/dist/assets/{useNamespace-C88ZxGoX.js → useNamespace-BDsKfT0f.js} +2 -2
  188. package/dashboard/dist/assets/{useNamespace-C88ZxGoX.js.map → useNamespace-BDsKfT0f.js.map} +1 -1
  189. package/dashboard/dist/assets/{useYamlActivityEvents-D2-yVjJ7.js → useYamlActivityEvents-CWZwHIlR.js} +2 -2
  190. package/dashboard/dist/assets/{useYamlActivityEvents-D2-yVjJ7.js.map → useYamlActivityEvents-CWZwHIlR.js.map} +1 -1
  191. package/dashboard/dist/assets/{users-C0WV36X8.js → users-BqmKVXR1.js} +2 -2
  192. package/dashboard/dist/assets/{users-C0WV36X8.js.map → users-BqmKVXR1.js.map} +1 -1
  193. package/dashboard/dist/assets/{vendor-icons-CEWCGPeJ.js → vendor-icons-BaQqUm-e.js} +2 -2
  194. package/dashboard/dist/assets/{vendor-icons-CEWCGPeJ.js.map → vendor-icons-BaQqUm-e.js.map} +1 -1
  195. package/dashboard/dist/assets/{workflows-CkPv7xk-.js → workflows-Dps45zjk.js} +2 -2
  196. package/dashboard/dist/assets/{workflows-CkPv7xk-.js.map → workflows-Dps45zjk.js.map} +1 -1
  197. package/dashboard/dist/assets/{yaml-workflows-BjrMQLTK.js → yaml-workflows-DhlTkbvY.js} +2 -2
  198. package/dashboard/dist/assets/{yaml-workflows-BjrMQLTK.js.map → yaml-workflows-DhlTkbvY.js.map} +1 -1
  199. package/dashboard/dist/index.html +3 -3
  200. package/docs/api/http/escalations.md +3 -3
  201. package/docs/api/http/roles.md +6 -0
  202. package/docs/api/mcp/admin.md +2 -0
  203. package/docs/api/sdk/escalations.md +2 -2
  204. package/docs/api/sdk/roles.md +7 -1
  205. package/docs/dashboard.md +5 -4
  206. package/docs/data.md +2 -0
  207. package/docs/operations.md +16 -3
  208. package/package.json +2 -2
  209. package/dashboard/dist/assets/OperationsPage-BCr21p8I.js +0 -2
  210. package/dashboard/dist/assets/OperationsPage-BCr21p8I.js.map +0 -1
  211. package/dashboard/dist/assets/RoleDetailPage-DS37tJhq.js +0 -11
  212. package/dashboard/dist/assets/RoleDetailPage-DS37tJhq.js.map +0 -1
  213. package/dashboard/dist/assets/roles-CFD2eYap.js.map +0 -1
@@ -1,2 +1,2 @@
1
- import{j as e}from"./vendor-query-B2UbickB.js";import{u as h}from"./yaml-workflows-BjrMQLTK.js";import{u}from"./index-Dgw1KKpq.js";import{u as f}from"./useFilterParams-x-Dg0Vgz.js";import{P as p}from"./PageHeader-BhaWTWcM.js";import{F as g,a as j,b}from"./FilterBar-BQ2JGg8U.js";import{E as d}from"./EmptyState-BcsfPq9T.js";import{T as w}from"./ToolPill-uVqcbHPE.js";import{N as v}from"./NamespacePill-CwKdoyRM.js";import{S as y}from"./StatusBadge-D9MeQHrh.js";import{c as N,W as k}from"./vendor-icons-CEWCGPeJ.js";import{c as F}from"./vendor-react-CXumBFUA.js";function O(){var c;const a=F(),{data:r}=u(),o=!!((c=r==null?void 0:r.ai)!=null&&c.enabled),{filters:s,setFilter:l}=f({filters:{status:"",search:""}}),{data:i,isLoading:m}=h({status:s.status||void 0,search:s.search||void 0,limit:200,offset:0}),n=(i==null?void 0:i.workflows)??[];return m?e.jsxs("div",{children:[e.jsx(p,{title:"Configure",docsHash:"#docs:dashboard.md:mcp-pipeline-tools"}),e.jsx("div",{className:"animate-pulse space-y-0",children:Array.from({length:4}).map((t,x)=>e.jsx("div",{className:"h-14 border-b last:border-b-0 px-6 flex items-center",children:e.jsx("div",{className:"h-3 bg-surface-sunken rounded w-full"})},x))})]}):e.jsxs("div",{children:[e.jsx(p,{title:"Configure",docsHash:"#docs:dashboard.md:mcp-pipeline-tools",actions:o?e.jsx("button",{onClick:()=>a("/mcp/queries/new"),className:"btn-primary text-xs",children:"Design Flow"}):void 0}),e.jsxs("p",{className:"text-sm text-text-secondary mb-6 max-w-2xl leading-relaxed",children:["The compiled form of a durable workflow — the same guarantees at roughly 3× the speed. Each flow is a graph the router discovers and runs on demand. Open one to inspect or run it",o?", or design a new one from a description.":"."]}),e.jsxs(g,{children:[e.jsx(j,{label:"Search",value:s.search,onChange:t=>l("search",t),placeholder:"Flow or namespace…"}),e.jsx(b,{label:"Status",value:s.status,onChange:t=>l("status",t),options:[{value:"draft",label:"Draft"},{value:"deployed",label:"Deployed"},{value:"active",label:"Active"},{value:"archived",label:"Archived"}]})]}),n.length===0?o?e.jsx("div",{className:"cursor-pointer",onClick:()=>a("/mcp/queries/new"),children:e.jsx(d,{icon:N,title:"No graph flows yet",description:"Open the Designer to compile your first flow from a description, or register flows at startup with the graphWorkflows config."})}):e.jsx(d,{icon:k,title:"No graph flows yet",description:"Register graph flows at startup with the graphWorkflows config — see the docs for an example."}):e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b",children:[e.jsx("th",{className:"px-6 py-3 text-left text-[10px] font-semibold uppercase tracking-widest text-text-tertiary",children:"Flow"}),e.jsx("th",{className:"px-4 py-3 text-left text-[10px] font-semibold uppercase tracking-widest text-text-tertiary w-40",children:"Namespace"}),e.jsx("th",{className:"px-4 py-3 text-left text-[10px] font-semibold uppercase tracking-widest text-text-tertiary w-20",children:"Version"}),e.jsx("th",{className:"px-4 py-3 text-left text-[10px] font-semibold uppercase tracking-widest text-text-tertiary w-28",children:"Status"})]})}),e.jsx("tbody",{children:n.map(t=>e.jsxs("tr",{onClick:()=>a(`/mcp/workflows/${t.id}`),className:"border-b border-surface-border/50 hover:bg-surface-hover/40 transition-colors duration-100 cursor-pointer",children:[e.jsxs("td",{className:"px-6 py-2.5",children:[e.jsx(w,{name:t.graph_topic,size:"md"}),t.description&&e.jsx("p",{className:"text-[11px] leading-snug text-text-quaternary mt-0.5",children:t.description})]}),e.jsx("td",{className:"px-4 py-2.5",children:e.jsx(v,{namespace:t.app_id})}),e.jsxs("td",{className:"px-4 py-2.5 text-[10px] text-text-quaternary font-mono whitespace-nowrap",children:["v",t.content_version]}),e.jsx("td",{className:"px-4 py-2.5 whitespace-nowrap",children:e.jsx(y,{status:t.status})})]},t.id))})]})]})}export{O as YamlWorkflowsPage};
2
- //# sourceMappingURL=YamlWorkflowsPage-NtGvqiu7.js.map
1
+ import{j as e}from"./vendor-query-B2UbickB.js";import{u as h}from"./yaml-workflows-DhlTkbvY.js";import{u}from"./index-BoZydcaW.js";import{u as f}from"./useFilterParams-x-Dg0Vgz.js";import{P as p}from"./PageHeader-CFta2VaS.js";import{F as g,a as j,b}from"./FilterBar-BQ2JGg8U.js";import{E as d}from"./EmptyState-BcsfPq9T.js";import{T as w}from"./ToolPill-miuRcj1Q.js";import{N as v}from"./NamespacePill-DlqBTvFR.js";import{S as y}from"./StatusBadge-D9MeQHrh.js";import{c as N,W as k}from"./vendor-icons-BaQqUm-e.js";import{c as F}from"./vendor-react-CXumBFUA.js";function O(){var c;const a=F(),{data:r}=u(),o=!!((c=r==null?void 0:r.ai)!=null&&c.enabled),{filters:s,setFilter:l}=f({filters:{status:"",search:""}}),{data:i,isLoading:m}=h({status:s.status||void 0,search:s.search||void 0,limit:200,offset:0}),n=(i==null?void 0:i.workflows)??[];return m?e.jsxs("div",{children:[e.jsx(p,{title:"Configure",docsHash:"#docs:dashboard.md:mcp-pipeline-tools"}),e.jsx("div",{className:"animate-pulse space-y-0",children:Array.from({length:4}).map((t,x)=>e.jsx("div",{className:"h-14 border-b last:border-b-0 px-6 flex items-center",children:e.jsx("div",{className:"h-3 bg-surface-sunken rounded w-full"})},x))})]}):e.jsxs("div",{children:[e.jsx(p,{title:"Configure",docsHash:"#docs:dashboard.md:mcp-pipeline-tools",actions:o?e.jsx("button",{onClick:()=>a("/mcp/queries/new"),className:"btn-primary text-xs",children:"Design Flow"}):void 0}),e.jsxs("p",{className:"text-sm text-text-secondary mb-6 max-w-2xl leading-relaxed",children:["The compiled form of a durable workflow — the same guarantees at roughly 3× the speed. Each flow is a graph the router discovers and runs on demand. Open one to inspect or run it",o?", or design a new one from a description.":"."]}),e.jsxs(g,{children:[e.jsx(j,{label:"Search",value:s.search,onChange:t=>l("search",t),placeholder:"Flow or namespace…"}),e.jsx(b,{label:"Status",value:s.status,onChange:t=>l("status",t),options:[{value:"draft",label:"Draft"},{value:"deployed",label:"Deployed"},{value:"active",label:"Active"},{value:"archived",label:"Archived"}]})]}),n.length===0?o?e.jsx("div",{className:"cursor-pointer",onClick:()=>a("/mcp/queries/new"),children:e.jsx(d,{icon:N,title:"No graph flows yet",description:"Open the Designer to compile your first flow from a description, or register flows at startup with the graphWorkflows config."})}):e.jsx(d,{icon:k,title:"No graph flows yet",description:"Register graph flows at startup with the graphWorkflows config — see the docs for an example."}):e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b",children:[e.jsx("th",{className:"px-6 py-3 text-left text-[10px] font-semibold uppercase tracking-widest text-text-tertiary",children:"Flow"}),e.jsx("th",{className:"px-4 py-3 text-left text-[10px] font-semibold uppercase tracking-widest text-text-tertiary w-40",children:"Namespace"}),e.jsx("th",{className:"px-4 py-3 text-left text-[10px] font-semibold uppercase tracking-widest text-text-tertiary w-20",children:"Version"}),e.jsx("th",{className:"px-4 py-3 text-left text-[10px] font-semibold uppercase tracking-widest text-text-tertiary w-28",children:"Status"})]})}),e.jsx("tbody",{children:n.map(t=>e.jsxs("tr",{onClick:()=>a(`/mcp/workflows/${t.id}`),className:"border-b border-surface-border/50 hover:bg-surface-hover/40 transition-colors duration-100 cursor-pointer",children:[e.jsxs("td",{className:"px-6 py-2.5",children:[e.jsx(w,{name:t.graph_topic,size:"md"}),t.description&&e.jsx("p",{className:"text-[11px] leading-snug text-text-quaternary mt-0.5",children:t.description})]}),e.jsx("td",{className:"px-4 py-2.5",children:e.jsx(v,{namespace:t.app_id})}),e.jsxs("td",{className:"px-4 py-2.5 text-[10px] text-text-quaternary font-mono whitespace-nowrap",children:["v",t.content_version]}),e.jsx("td",{className:"px-4 py-2.5 whitespace-nowrap",children:e.jsx(y,{status:t.status})})]},t.id))})]})]})}export{O as YamlWorkflowsPage};
2
+ //# sourceMappingURL=YamlWorkflowsPage-CMpgsLEo.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"YamlWorkflowsPage-NtGvqiu7.js","sources":["../../src/pages/workflows/YamlWorkflowsPage.tsx"],"sourcesContent":["import { useNavigate } from 'react-router-dom';\nimport { Wand2, Workflow } from 'lucide-react';\nimport { useYamlWorkflows } from '../../api/yaml-workflows';\nimport { useSettings } from '../../api/settings';\nimport { useFilterParams } from '../../hooks/useFilterParams';\n\nimport { PageHeader } from '../../components/common/layout/PageHeader';\nimport { FilterBar, FilterSelect, FilterInput } from '../../components/common/data/FilterBar';\nimport { EmptyState } from '../../components/common/display/EmptyState';\nimport { ToolPill } from '../../components/common/display/ToolPill';\nimport { NamespacePill } from '../../components/common/display/NamespacePill';\nimport { StatusBadge } from '../../components/common/display/StatusBadge';\n\n// ── Page: Graph › Configure ─────────────────────────────────────────────────\n\nexport function YamlWorkflowsPage() {\n const navigate = useNavigate();\n const { data: settings } = useSettings();\n const aiEnabled = !!settings?.ai?.enabled;\n const { filters, setFilter } = useFilterParams({\n filters: { status: '', search: '' },\n });\n\n const { data, isLoading } = useYamlWorkflows({\n status: (filters.status || undefined) as any,\n search: filters.search || undefined,\n limit: 200,\n offset: 0,\n });\n\n const flows = data?.workflows ?? [];\n\n if (isLoading) {\n return (\n <div>\n <PageHeader title=\"Configure\" docsHash=\"#docs:dashboard.md:mcp-pipeline-tools\" />\n <div className=\"animate-pulse space-y-0\">\n {Array.from({ length: 4 }).map((_, i) => (\n <div key={i} className=\"h-14 border-b last:border-b-0 px-6 flex items-center\">\n <div className=\"h-3 bg-surface-sunken rounded w-full\" />\n </div>\n ))}\n </div>\n </div>\n );\n }\n\n return (\n <div>\n <PageHeader\n title=\"Configure\"\n docsHash=\"#docs:dashboard.md:mcp-pipeline-tools\"\n actions={\n aiEnabled ? (\n <button onClick={() => navigate('/mcp/queries/new')} className=\"btn-primary text-xs\">\n Design Flow\n </button>\n ) : undefined\n }\n />\n\n <p className=\"text-sm text-text-secondary mb-6 max-w-2xl leading-relaxed\">\n The compiled form of a durable workflow — the same guarantees at roughly 3× the speed. Each\n flow is a graph the router discovers and runs on demand. Open one to inspect or run it\n {aiEnabled ? ', or design a new one from a description.' : '.'}\n </p>\n\n <FilterBar>\n <FilterInput\n label=\"Search\"\n value={filters.search}\n onChange={(v) => setFilter('search', v)}\n placeholder=\"Flow or namespace…\"\n />\n <FilterSelect\n label=\"Status\"\n value={filters.status}\n onChange={(v) => setFilter('status', v)}\n options={[\n { value: 'draft', label: 'Draft' },\n { value: 'deployed', label: 'Deployed' },\n { value: 'active', label: 'Active' },\n { value: 'archived', label: 'Archived' },\n ]}\n />\n </FilterBar>\n\n {flows.length === 0 ? (\n aiEnabled ? (\n <div className=\"cursor-pointer\" onClick={() => navigate('/mcp/queries/new')}>\n <EmptyState\n icon={Wand2}\n title=\"No graph flows yet\"\n description=\"Open the Designer to compile your first flow from a description, or register flows at startup with the graphWorkflows config.\"\n />\n </div>\n ) : (\n <EmptyState\n icon={Workflow}\n title=\"No graph flows yet\"\n description=\"Register graph flows at startup with the graphWorkflows config — see the docs for an example.\"\n />\n )\n ) : (\n <table className=\"w-full\">\n <thead>\n <tr className=\"border-b\">\n <th className=\"px-6 py-3 text-left text-[10px] font-semibold uppercase tracking-widest text-text-tertiary\">\n Flow\n </th>\n <th className=\"px-4 py-3 text-left text-[10px] font-semibold uppercase tracking-widest text-text-tertiary w-40\">\n Namespace\n </th>\n <th className=\"px-4 py-3 text-left text-[10px] font-semibold uppercase tracking-widest text-text-tertiary w-20\">\n Version\n </th>\n <th className=\"px-4 py-3 text-left text-[10px] font-semibold uppercase tracking-widest text-text-tertiary w-28\">\n Status\n </th>\n </tr>\n </thead>\n <tbody>\n {flows.map((flow) => (\n <tr\n key={flow.id}\n onClick={() => navigate(`/mcp/workflows/${flow.id}`)}\n className=\"border-b border-surface-border/50 hover:bg-surface-hover/40 transition-colors duration-100 cursor-pointer\"\n >\n <td className=\"px-6 py-2.5\">\n <ToolPill name={flow.graph_topic} size=\"md\" />\n {flow.description && (\n <p className=\"text-[11px] leading-snug text-text-quaternary mt-0.5\">{flow.description}</p>\n )}\n </td>\n <td className=\"px-4 py-2.5\">\n <NamespacePill namespace={flow.app_id} />\n </td>\n <td className=\"px-4 py-2.5 text-[10px] text-text-quaternary font-mono whitespace-nowrap\">\n v{flow.content_version}\n </td>\n <td className=\"px-4 py-2.5 whitespace-nowrap\">\n <StatusBadge status={flow.status} />\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n )}\n </div>\n );\n}\n"],"names":["YamlWorkflowsPage","navigate","useNavigate","settings","useSettings","aiEnabled","_a","filters","setFilter","useFilterParams","data","isLoading","useYamlWorkflows","flows","jsx","PageHeader","_","i","jsxs","FilterBar","FilterInput","v","FilterSelect","EmptyState","Wand2","Workflow","flow","ToolPill","NamespacePill","StatusBadge"],"mappings":"kjBAeO,SAASA,GAAoB,OAClC,MAAMC,EAAWC,EAAA,EACX,CAAE,KAAMC,CAAA,EAAaC,EAAA,EACrBC,EAAY,CAAC,GAACC,EAAAH,GAAA,YAAAA,EAAU,KAAV,MAAAG,EAAc,SAC5B,CAAE,QAAAC,EAAS,UAAAC,CAAA,EAAcC,EAAgB,CAC7C,QAAS,CAAE,OAAQ,GAAI,OAAQ,EAAA,CAAG,CACnC,EAEK,CAAE,KAAAC,EAAM,UAAAC,CAAA,EAAcC,EAAiB,CAC3C,OAASL,EAAQ,QAAU,OAC3B,OAAQA,EAAQ,QAAU,OAC1B,MAAO,IACP,OAAQ,CAAA,CACT,EAEKM,GAAQH,GAAA,YAAAA,EAAM,YAAa,CAAA,EAEjC,OAAIC,SAEC,MAAA,CACC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.js","sources":["../../src/pages/workflows/YamlWorkflowsPage.tsx"],"sourcesContent":["import { useNavigate } from 'react-router-dom';\nimport { Wand2, Workflow } from 'lucide-react';\nimport { useYamlWorkflows } from '../../api/yaml-workflows';\nimport { useSettings } from '../../api/settings';\nimport { useFilterParams } from '../../hooks/useFilterParams';\n\nimport { PageHeader } from '../../components/common/layout/PageHeader';\nimport { FilterBar, FilterSelect, FilterInput } from '../../components/common/data/FilterBar';\nimport { EmptyState } from '../../components/common/display/EmptyState';\nimport { ToolPill } from '../../components/common/display/ToolPill';\nimport { NamespacePill } from '../../components/common/display/NamespacePill';\nimport { StatusBadge } from '../../components/common/display/StatusBadge';\n\n// ── Page: Graph › Configure ─────────────────────────────────────────────────\n\nexport function YamlWorkflowsPage() {\n const navigate = useNavigate();\n const { data: settings } = useSettings();\n const aiEnabled = !!settings?.ai?.enabled;\n const { filters, setFilter } = useFilterParams({\n filters: { status: '', search: '' },\n });\n\n const { data, isLoading } = useYamlWorkflows({\n status: (filters.status || undefined) as any,\n search: filters.search || undefined,\n limit: 200,\n offset: 0,\n });\n\n const flows = data?.workflows ?? [];\n\n if (isLoading) {\n return (\n <div>\n <PageHeader title=\"Configure\" docsHash=\"#docs:dashboard.md:mcp-pipeline-tools\" />\n <div className=\"animate-pulse space-y-0\">\n {Array.from({ length: 4 }).map((_, i) => (\n <div key={i} className=\"h-14 border-b last:border-b-0 px-6 flex items-center\">\n <div className=\"h-3 bg-surface-sunken rounded w-full\" />\n </div>\n ))}\n </div>\n </div>\n );\n }\n\n return (\n <div>\n <PageHeader\n title=\"Configure\"\n docsHash=\"#docs:dashboard.md:mcp-pipeline-tools\"\n actions={\n aiEnabled ? (\n <button onClick={() => navigate('/mcp/queries/new')} className=\"btn-primary text-xs\">\n Design Flow\n </button>\n ) : undefined\n }\n />\n\n <p className=\"text-sm text-text-secondary mb-6 max-w-2xl leading-relaxed\">\n The compiled form of a durable workflow — the same guarantees at roughly 3× the speed. Each\n flow is a graph the router discovers and runs on demand. Open one to inspect or run it\n {aiEnabled ? ', or design a new one from a description.' : '.'}\n </p>\n\n <FilterBar>\n <FilterInput\n label=\"Search\"\n value={filters.search}\n onChange={(v) => setFilter('search', v)}\n placeholder=\"Flow or namespace…\"\n />\n <FilterSelect\n label=\"Status\"\n value={filters.status}\n onChange={(v) => setFilter('status', v)}\n options={[\n { value: 'draft', label: 'Draft' },\n { value: 'deployed', label: 'Deployed' },\n { value: 'active', label: 'Active' },\n { value: 'archived', label: 'Archived' },\n ]}\n />\n </FilterBar>\n\n {flows.length === 0 ? (\n aiEnabled ? (\n <div className=\"cursor-pointer\" onClick={() => navigate('/mcp/queries/new')}>\n <EmptyState\n icon={Wand2}\n title=\"No graph flows yet\"\n description=\"Open the Designer to compile your first flow from a description, or register flows at startup with the graphWorkflows config.\"\n />\n </div>\n ) : (\n <EmptyState\n icon={Workflow}\n title=\"No graph flows yet\"\n description=\"Register graph flows at startup with the graphWorkflows config — see the docs for an example.\"\n />\n )\n ) : (\n <table className=\"w-full\">\n <thead>\n <tr className=\"border-b\">\n <th className=\"px-6 py-3 text-left text-[10px] font-semibold uppercase tracking-widest text-text-tertiary\">\n Flow\n </th>\n <th className=\"px-4 py-3 text-left text-[10px] font-semibold uppercase tracking-widest text-text-tertiary w-40\">\n Namespace\n </th>\n <th className=\"px-4 py-3 text-left text-[10px] font-semibold uppercase tracking-widest text-text-tertiary w-20\">\n Version\n </th>\n <th className=\"px-4 py-3 text-left text-[10px] font-semibold uppercase tracking-widest text-text-tertiary w-28\">\n Status\n </th>\n </tr>\n </thead>\n <tbody>\n {flows.map((flow) => (\n <tr\n key={flow.id}\n onClick={() => navigate(`/mcp/workflows/${flow.id}`)}\n className=\"border-b border-surface-border/50 hover:bg-surface-hover/40 transition-colors duration-100 cursor-pointer\"\n >\n <td className=\"px-6 py-2.5\">\n <ToolPill name={flow.graph_topic} size=\"md\" />\n {flow.description && (\n <p className=\"text-[11px] leading-snug text-text-quaternary mt-0.5\">{flow.description}</p>\n )}\n </td>\n <td className=\"px-4 py-2.5\">\n <NamespacePill namespace={flow.app_id} />\n </td>\n <td className=\"px-4 py-2.5 text-[10px] text-text-quaternary font-mono whitespace-nowrap\">\n v{flow.content_version}\n </td>\n <td className=\"px-4 py-2.5 whitespace-nowrap\">\n <StatusBadge status={flow.status} />\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n )}\n </div>\n );\n}\n"],"names":["YamlWorkflowsPage","navigate","useNavigate","settings","useSettings","aiEnabled","_a","filters","setFilter","useFilterParams","data","isLoading","useYamlWorkflows","flows","jsx","PageHeader","_","i","jsxs","FilterBar","FilterInput","v","FilterSelect","EmptyState","Wand2","Workflow","flow","ToolPill","NamespacePill","StatusBadge"],"mappings":"kjBAeO,SAASA,GAAoB,OAClC,MAAMC,EAAWC,EAAA,EACX,CAAE,KAAMC,CAAA,EAAaC,EAAA,EACrBC,EAAY,CAAC,GAACC,EAAAH,GAAA,YAAAA,EAAU,KAAV,MAAAG,EAAc,SAC5B,CAAE,QAAAC,EAAS,UAAAC,CAAA,EAAcC,EAAgB,CAC7C,QAAS,CAAE,OAAQ,GAAI,OAAQ,EAAA,CAAG,CACnC,EAEK,CAAE,KAAAC,EAAM,UAAAC,CAAA,EAAcC,EAAiB,CAC3C,OAASL,EAAQ,QAAU,OAC3B,OAAQA,EAAQ,QAAU,OAC1B,MAAO,IACP,OAAQ,CAAA,CACT,EAEKM,GAAQH,GAAA,YAAAA,EAAM,YAAa,CAAA,EAEjC,OAAIC,SAEC,MAAA,CACC,SAAA,CAAAG,EAAAA,IAACC,EAAA,CAAW,MAAM,YAAY,SAAS,wCAAwC,EAC/ED,EAAAA,IAAC,MAAA,CAAI,UAAU,0BACZ,SAAA,MAAM,KAAK,CAAE,OAAQ,CAAA,CAAG,EAAE,IAAI,CAACE,EAAGC,IACjCH,EAAAA,IAAC,MAAA,CAAY,UAAU,uDACrB,SAAAA,EAAAA,IAAC,MAAA,CAAI,UAAU,sCAAA,CAAuC,CAAA,EAD9CG,CAEV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AAkG,SAAA,YAEhH,EACAA,EAAAA,IAAC,KAAA,CAAG,UAAU,kGAAkG,SAAA,UAEhH,EACAA,EAAAA,IAAC,KAAA,CAAG,UAAU,kGAAkG,SAAA,QAAA,CAEhH,CAAA,CAAA,CACF,CAAA,CACF,EACAA,EAAAA,IAAC,QAAA,CACE,SAAAD,EAAM,IAAKa,GACVR,EAAAA,KAAC,KAAA,CAEC,QAAS,IAAMjB,EAAS,kBAAkByB,EAAK,EAAE,EAAE,EACnD,UAAU,4GAEV,SAAA,CAAAR,EAAAA,KAAC,KAAA,CAAG,UAAU,cACZ,SAAA,CAAAJ,EAAAA,IAACa,EAAA,CAAS,KAAMD,EAAK,YAAa,KAAK,KAAK,EAC3CA,EAAK,aACJZ,EAAAA,IAAC,KAAE,UAAU,uDAAwD,WAAK,WAAA,CAAY,CAAA,EAE1F,EACAA,EAAAA,IAAC,MAAG,UAAU,cACZ,eAACc,EAAA,CAAc,UAAWF,EAAK,MAAA,CAAQ,CAAA,CACzC,EACAR,EAAAA,KAAC,KAAA,CAAG,UAAU,2EAA2E,SAAA,CAAA,IACrFQ,EAAK,eAAA,EACT,EACAZ,EAAAA,IAAC,MAAG,UAAU,gCACZ,eAACe,EAAA,CAAY,OAAQH,EAAK,MAAA,CAAQ,CAAA,CACpC,CAAA,CAAA,EAlBKA,EAAK,EAAA,CAoBb,CAAA,CACH,CAAA,CAAA,CACF,CAAA,EAEJ,CAEJ"}
@@ -1,2 +1,2 @@
1
- import{u as o,b as u,c as a}from"./vendor-query-B2UbickB.js";import{d as t}from"./index-Dgw1KKpq.js";function g(e={}){const n=new URLSearchParams;e.status&&n.set("status",e.status),e.knowledge_domain&&n.set("knowledge_domain",e.knowledge_domain),e.limit!=null&&n.set("limit",String(e.limit)),e.offset!=null&&n.set("offset",String(e.offset));const s=n.toString();return o({queryKey:["agents",e],queryFn:()=>t(`/agents${s?`?${s}`:""}`)})}function y(e){return o({queryKey:["agents",e],queryFn:()=>t(`/agents/${e}`),enabled:!!e})}function c(){const e=u();return a({mutationFn:n=>t("/agents",{method:"POST",body:JSON.stringify(n)}),onSuccess:()=>{e.invalidateQueries({queryKey:["agents"]})}})}function m(){const e=u();return a({mutationFn:({id:n,...s})=>t(`/agents/${n}`,{method:"PUT",body:JSON.stringify(s)}),onSuccess:()=>{e.invalidateQueries({queryKey:["agents"]})}})}function d(){const e=u();return a({mutationFn:n=>t(`/agents/${n}`,{method:"DELETE"}),onSuccess:()=>{e.invalidateQueries({queryKey:["agents"]})}})}export{y as a,m as b,d as c,c as d,g as u};
2
- //# sourceMappingURL=agents-tML6AjDj.js.map
1
+ import{u as o,b as u,c as a}from"./vendor-query-B2UbickB.js";import{d as t}from"./index-BoZydcaW.js";function g(e={}){const n=new URLSearchParams;e.status&&n.set("status",e.status),e.knowledge_domain&&n.set("knowledge_domain",e.knowledge_domain),e.limit!=null&&n.set("limit",String(e.limit)),e.offset!=null&&n.set("offset",String(e.offset));const s=n.toString();return o({queryKey:["agents",e],queryFn:()=>t(`/agents${s?`?${s}`:""}`)})}function y(e){return o({queryKey:["agents",e],queryFn:()=>t(`/agents/${e}`),enabled:!!e})}function c(){const e=u();return a({mutationFn:n=>t("/agents",{method:"POST",body:JSON.stringify(n)}),onSuccess:()=>{e.invalidateQueries({queryKey:["agents"]})}})}function m(){const e=u();return a({mutationFn:({id:n,...s})=>t(`/agents/${n}`,{method:"PUT",body:JSON.stringify(s)}),onSuccess:()=>{e.invalidateQueries({queryKey:["agents"]})}})}function d(){const e=u();return a({mutationFn:n=>t(`/agents/${n}`,{method:"DELETE"}),onSuccess:()=>{e.invalidateQueries({queryKey:["agents"]})}})}export{y as a,m as b,d as c,c as d,g as u};
2
+ //# sourceMappingURL=agents-27sErp5R.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"agents-tML6AjDj.js","sources":["../../src/api/agents.ts"],"sourcesContent":["import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';\nimport { apiFetch } from './client';\n\nexport interface AgentCapability {\n serverId: string;\n toolNames?: string[];\n}\n\nexport interface AgentTrigger {\n event: string;\n filter?: Record<string, any>;\n}\n\nexport interface AgentSchedule {\n cron: string;\n workflow_type: string;\n envelope?: Record<string, any>;\n execute_as?: string;\n}\n\nexport interface AgentBehaviors {\n cron?: string;\n triggers?: AgentTrigger[];\n schedules?: AgentSchedule[];\n escalationRules?: Record<string, any>;\n}\n\nexport interface Agent {\n /** Agent identifier — human-readable kebab-case name (e.g. 'content-triage') */\n id: string;\n description?: string;\n status: 'inactive' | 'active' | 'paused' | 'error';\n user_id?: string;\n knowledge_domain?: string;\n capabilities: AgentCapability[];\n behaviors: AgentBehaviors;\n goals?: string;\n rules?: string;\n workflow_type?: string;\n pipeline_id?: string;\n metadata: Record<string, any>;\n last_run_at?: string;\n subscription_count?: number;\n sub_topics?: string[];\n created_at: string;\n updated_at: string;\n stats?: {\n knowledge_count: number;\n escalation_count: number;\n last_execution_at?: string;\n };\n}\n\ninterface AgentListResponse {\n agents: Agent[];\n total: number;\n}\n\ninterface AgentFilters {\n status?: string;\n knowledge_domain?: string;\n limit?: number;\n offset?: number;\n}\n\nexport function useAgents(filters: AgentFilters = {}) {\n const params = new URLSearchParams();\n if (filters.status) params.set('status', filters.status);\n if (filters.knowledge_domain) params.set('knowledge_domain', filters.knowledge_domain);\n if (filters.limit != null) params.set('limit', String(filters.limit));\n if (filters.offset != null) params.set('offset', String(filters.offset));\n const qs = params.toString();\n\n return useQuery<AgentListResponse>({\n queryKey: ['agents', filters],\n queryFn: () => apiFetch(`/agents${qs ? `?${qs}` : ''}`),\n });\n}\n\nexport function useAgent(id: string | null) {\n return useQuery<Agent>({\n queryKey: ['agents', id],\n queryFn: () => apiFetch(`/agents/${id}`),\n enabled: !!id,\n });\n}\n\nexport function useCreateAgent() {\n const queryClient = useQueryClient();\n return useMutation<Agent, Error, Partial<Agent> & { id: string }>({\n mutationFn: (body) =>\n apiFetch('/agents', {\n method: 'POST',\n body: JSON.stringify(body),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['agents'] });\n },\n });\n}\n\nexport function useUpdateAgent() {\n const queryClient = useQueryClient();\n return useMutation<Agent, Error, { id: string } & Partial<Agent>>({\n mutationFn: ({ id, ...body }) =>\n apiFetch(`/agents/${id}`, {\n method: 'PUT',\n body: JSON.stringify(body),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['agents'] });\n },\n });\n}\n\nexport function useDeleteAgent() {\n const queryClient = useQueryClient();\n return useMutation<{ deleted: boolean }, Error, string>({\n mutationFn: (id) =>\n apiFetch(`/agents/${id}`, { method: 'DELETE' }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['agents'] });\n },\n });\n}\n"],"names":["useAgents","filters","params","qs","useQuery","apiFetch","useAgent","id","useCreateAgent","queryClient","useQueryClient","useMutation","body","useUpdateAgent","useDeleteAgent"],"mappings":"qGAiEO,SAASA,EAAUC,EAAwB,GAAI,CACpD,MAAMC,EAAS,IAAI,gBACfD,EAAQ,QAAQC,EAAO,IAAI,SAAUD,EAAQ,MAAM,EACnDA,EAAQ,kBAAkBC,EAAO,IAAI,mBAAoBD,EAAQ,gBAAgB,EACjFA,EAAQ,OAAS,MAAMC,EAAO,IAAI,QAAS,OAAOD,EAAQ,KAAK,CAAC,EAChEA,EAAQ,QAAU,MAAMC,EAAO,IAAI,SAAU,OAAOD,EAAQ,MAAM,CAAC,EACvE,MAAME,EAAKD,EAAO,SAAA,EAElB,OAAOE,EAA4B,CACjC,SAAU,CAAC,SAAUH,CAAO,EAC5B,QAAS,IAAMI,EAAS,UAAUF,EAAK,IAAIA,CAAE,GAAK,EAAE,EAAE,CAAA,CACvD,CACH,CAEO,SAASG,EAASC,EAAmB,CAC1C,OAAOH,EAAgB,CACrB,SAAU,CAAC,SAAUG,CAAE,EACvB,QAAS,IAAMF,EAAS,WAAWE,CAAE,EAAE,EACvC,QAAS,CAAC,CAACA,CAAA,CACZ,CACH,CAEO,SAASC,GAAiB,CAC/B,MAAMC,EAAcC,EAAA,EACpB,OAAOC,EAA2D,CAChE,WAAaC,GACXP,EAAS,UAAW,CAClB,OAAQ,OACR,KAAM,KAAK,UAAUO,CAAI,CAAA,CAC1B,EACH,UAAW,IAAM,CACfH,EAAY,kBAAkB,CAAE,SAAU,CAAC,QAAQ,EAAG,CACxD,CAAA,CACD,CACH,CAEO,SAASI,GAAiB,CAC/B,MAAMJ,EAAcC,EAAA,EACpB,OAAOC,EAA2D,CAChE,WAAY,CAAC,CAAE,GAAAJ,EAAI,GAAGK,KACpBP,EAAS,WAAWE,CAAE,GAAI,CACxB,OAAQ,MACR,KAAM,KAAK,UAAUK,CAAI,CAAA,CAC1B,EACH,UAAW,IAAM,CACfH,EAAY,kBAAkB,CAAE,SAAU,CAAC,QAAQ,EAAG,CACxD,CAAA,CACD,CACH,CAEO,SAASK,GAAiB,CAC/B,MAAML,EAAcC,EAAA,EACpB,OAAOC,EAAiD,CACtD,WAAaJ,GACXF,EAAS,WAAWE,CAAE,GAAI,CAAE,OAAQ,SAAU,EAChD,UAAW,IAAM,CACfE,EAAY,kBAAkB,CAAE,SAAU,CAAC,QAAQ,EAAG,CACxD,CAAA,CACD,CACH"}
1
+ {"version":3,"file":"agents-27sErp5R.js","sources":["../../src/api/agents.ts"],"sourcesContent":["import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';\nimport { apiFetch } from './client';\n\nexport interface AgentCapability {\n serverId: string;\n toolNames?: string[];\n}\n\nexport interface AgentTrigger {\n event: string;\n filter?: Record<string, any>;\n}\n\nexport interface AgentSchedule {\n cron: string;\n workflow_type: string;\n envelope?: Record<string, any>;\n execute_as?: string;\n}\n\nexport interface AgentBehaviors {\n cron?: string;\n triggers?: AgentTrigger[];\n schedules?: AgentSchedule[];\n escalationRules?: Record<string, any>;\n}\n\nexport interface Agent {\n /** Agent identifier — human-readable kebab-case name (e.g. 'content-triage') */\n id: string;\n description?: string;\n status: 'inactive' | 'active' | 'paused' | 'error';\n user_id?: string;\n knowledge_domain?: string;\n capabilities: AgentCapability[];\n behaviors: AgentBehaviors;\n goals?: string;\n rules?: string;\n workflow_type?: string;\n pipeline_id?: string;\n metadata: Record<string, any>;\n last_run_at?: string;\n subscription_count?: number;\n sub_topics?: string[];\n created_at: string;\n updated_at: string;\n stats?: {\n knowledge_count: number;\n escalation_count: number;\n last_execution_at?: string;\n };\n}\n\ninterface AgentListResponse {\n agents: Agent[];\n total: number;\n}\n\ninterface AgentFilters {\n status?: string;\n knowledge_domain?: string;\n limit?: number;\n offset?: number;\n}\n\nexport function useAgents(filters: AgentFilters = {}) {\n const params = new URLSearchParams();\n if (filters.status) params.set('status', filters.status);\n if (filters.knowledge_domain) params.set('knowledge_domain', filters.knowledge_domain);\n if (filters.limit != null) params.set('limit', String(filters.limit));\n if (filters.offset != null) params.set('offset', String(filters.offset));\n const qs = params.toString();\n\n return useQuery<AgentListResponse>({\n queryKey: ['agents', filters],\n queryFn: () => apiFetch(`/agents${qs ? `?${qs}` : ''}`),\n });\n}\n\nexport function useAgent(id: string | null) {\n return useQuery<Agent>({\n queryKey: ['agents', id],\n queryFn: () => apiFetch(`/agents/${id}`),\n enabled: !!id,\n });\n}\n\nexport function useCreateAgent() {\n const queryClient = useQueryClient();\n return useMutation<Agent, Error, Partial<Agent> & { id: string }>({\n mutationFn: (body) =>\n apiFetch('/agents', {\n method: 'POST',\n body: JSON.stringify(body),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['agents'] });\n },\n });\n}\n\nexport function useUpdateAgent() {\n const queryClient = useQueryClient();\n return useMutation<Agent, Error, { id: string } & Partial<Agent>>({\n mutationFn: ({ id, ...body }) =>\n apiFetch(`/agents/${id}`, {\n method: 'PUT',\n body: JSON.stringify(body),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['agents'] });\n },\n });\n}\n\nexport function useDeleteAgent() {\n const queryClient = useQueryClient();\n return useMutation<{ deleted: boolean }, Error, string>({\n mutationFn: (id) =>\n apiFetch(`/agents/${id}`, { method: 'DELETE' }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['agents'] });\n },\n });\n}\n"],"names":["useAgents","filters","params","qs","useQuery","apiFetch","useAgent","id","useCreateAgent","queryClient","useQueryClient","useMutation","body","useUpdateAgent","useDeleteAgent"],"mappings":"qGAiEO,SAASA,EAAUC,EAAwB,GAAI,CACpD,MAAMC,EAAS,IAAI,gBACfD,EAAQ,QAAQC,EAAO,IAAI,SAAUD,EAAQ,MAAM,EACnDA,EAAQ,kBAAkBC,EAAO,IAAI,mBAAoBD,EAAQ,gBAAgB,EACjFA,EAAQ,OAAS,MAAMC,EAAO,IAAI,QAAS,OAAOD,EAAQ,KAAK,CAAC,EAChEA,EAAQ,QAAU,MAAMC,EAAO,IAAI,SAAU,OAAOD,EAAQ,MAAM,CAAC,EACvE,MAAME,EAAKD,EAAO,SAAA,EAElB,OAAOE,EAA4B,CACjC,SAAU,CAAC,SAAUH,CAAO,EAC5B,QAAS,IAAMI,EAAS,UAAUF,EAAK,IAAIA,CAAE,GAAK,EAAE,EAAE,CAAA,CACvD,CACH,CAEO,SAASG,EAASC,EAAmB,CAC1C,OAAOH,EAAgB,CACrB,SAAU,CAAC,SAAUG,CAAE,EACvB,QAAS,IAAMF,EAAS,WAAWE,CAAE,EAAE,EACvC,QAAS,CAAC,CAACA,CAAA,CACZ,CACH,CAEO,SAASC,GAAiB,CAC/B,MAAMC,EAAcC,EAAA,EACpB,OAAOC,EAA2D,CAChE,WAAaC,GACXP,EAAS,UAAW,CAClB,OAAQ,OACR,KAAM,KAAK,UAAUO,CAAI,CAAA,CAC1B,EACH,UAAW,IAAM,CACfH,EAAY,kBAAkB,CAAE,SAAU,CAAC,QAAQ,EAAG,CACxD,CAAA,CACD,CACH,CAEO,SAASI,GAAiB,CAC/B,MAAMJ,EAAcC,EAAA,EACpB,OAAOC,EAA2D,CAChE,WAAY,CAAC,CAAE,GAAAJ,EAAI,GAAGK,KACpBP,EAAS,WAAWE,CAAE,GAAI,CACxB,OAAQ,MACR,KAAM,KAAK,UAAUK,CAAI,CAAA,CAC1B,EACH,UAAW,IAAM,CACfH,EAAY,kBAAkB,CAAE,SAAU,CAAC,QAAQ,EAAG,CACxD,CAAA,CACD,CACH,CAEO,SAASK,GAAiB,CAC/B,MAAML,EAAcC,EAAA,EACpB,OAAOC,EAAiD,CACtD,WAAaJ,GACXF,EAAS,WAAWE,CAAE,GAAI,CAAE,OAAQ,SAAU,EAChD,UAAW,IAAM,CACfE,EAAY,kBAAkB,CAAE,SAAU,CAAC,QAAQ,EAAG,CACxD,CAAA,CACD,CACH"}
@@ -1,2 +1,2 @@
1
- import{u as a,b as s,c as u}from"./vendor-query-B2UbickB.js";import{d as n}from"./index-Dgw1KKpq.js";function y(e={}){const t=new URLSearchParams;return e.limit&&t.set("limit",String(e.limit)),e.offset!==void 0&&t.set("offset",String(e.offset)),a({queryKey:["bots",e],queryFn:()=>n(`/bot-accounts?${t}`)})}function d(e){return a({queryKey:["bots",e,"api-keys"],queryFn:()=>n(`/bot-accounts/${e}/api-keys`),enabled:!!e})}function b(){const e=s();return u({mutationFn:t=>n("/bot-accounts",{method:"POST",body:JSON.stringify(t)}),onSuccess:()=>{e.invalidateQueries({queryKey:["bots"]})}})}function m(){const e=s();return u({mutationFn:({id:t,...o})=>n(`/bot-accounts/${t}`,{method:"PUT",body:JSON.stringify(o)}),onSuccess:()=>{e.invalidateQueries({queryKey:["bots"]})}})}function f(){const e=s();return u({mutationFn:t=>n(`/bot-accounts/${t}`,{method:"DELETE"}),onSuccess:()=>{e.invalidateQueries({queryKey:["bots"]})}})}function l(){const e=s();return u({mutationFn:({botId:t,name:o,scopes:i})=>n(`/bot-accounts/${t}/api-keys`,{method:"POST",body:JSON.stringify({name:o,scopes:i})}),onSuccess:(t,o)=>{e.invalidateQueries({queryKey:["bots",o.botId,"api-keys"]})}})}function q(){const e=s();return u({mutationFn:({botId:t,keyId:o})=>n(`/bot-accounts/${t}/api-keys/${o}`,{method:"DELETE"}),onSuccess:(t,o)=>{e.invalidateQueries({queryKey:["bots",o.botId,"api-keys"]})}})}function S(){const e=s();return u({mutationFn:({botId:t,role:o,type:i})=>n(`/bot-accounts/${t}/roles`,{method:"POST",body:JSON.stringify({role:o,type:i})}),onSuccess:()=>{e.invalidateQueries({queryKey:["bots"]})}})}function p(){const e=s();return u({mutationFn:({botId:t,role:o})=>n(`/bot-accounts/${t}/roles/${encodeURIComponent(o)}`,{method:"DELETE"}),onSuccess:()=>{e.invalidateQueries({queryKey:["bots"]})}})}export{m as a,d as b,l as c,q as d,S as e,p as f,f as g,y as h,b as u};
2
- //# sourceMappingURL=bots-Cb0WTwhY.js.map
1
+ import{u as a,b as s,c as u}from"./vendor-query-B2UbickB.js";import{d as n}from"./index-BoZydcaW.js";function y(e={}){const t=new URLSearchParams;return e.limit&&t.set("limit",String(e.limit)),e.offset!==void 0&&t.set("offset",String(e.offset)),a({queryKey:["bots",e],queryFn:()=>n(`/bot-accounts?${t}`)})}function d(e){return a({queryKey:["bots",e,"api-keys"],queryFn:()=>n(`/bot-accounts/${e}/api-keys`),enabled:!!e})}function b(){const e=s();return u({mutationFn:t=>n("/bot-accounts",{method:"POST",body:JSON.stringify(t)}),onSuccess:()=>{e.invalidateQueries({queryKey:["bots"]})}})}function m(){const e=s();return u({mutationFn:({id:t,...o})=>n(`/bot-accounts/${t}`,{method:"PUT",body:JSON.stringify(o)}),onSuccess:()=>{e.invalidateQueries({queryKey:["bots"]})}})}function f(){const e=s();return u({mutationFn:t=>n(`/bot-accounts/${t}`,{method:"DELETE"}),onSuccess:()=>{e.invalidateQueries({queryKey:["bots"]})}})}function l(){const e=s();return u({mutationFn:({botId:t,name:o,scopes:i})=>n(`/bot-accounts/${t}/api-keys`,{method:"POST",body:JSON.stringify({name:o,scopes:i})}),onSuccess:(t,o)=>{e.invalidateQueries({queryKey:["bots",o.botId,"api-keys"]})}})}function q(){const e=s();return u({mutationFn:({botId:t,keyId:o})=>n(`/bot-accounts/${t}/api-keys/${o}`,{method:"DELETE"}),onSuccess:(t,o)=>{e.invalidateQueries({queryKey:["bots",o.botId,"api-keys"]})}})}function S(){const e=s();return u({mutationFn:({botId:t,role:o,type:i})=>n(`/bot-accounts/${t}/roles`,{method:"POST",body:JSON.stringify({role:o,type:i})}),onSuccess:()=>{e.invalidateQueries({queryKey:["bots"]})}})}function p(){const e=s();return u({mutationFn:({botId:t,role:o})=>n(`/bot-accounts/${t}/roles/${encodeURIComponent(o)}`,{method:"DELETE"}),onSuccess:()=>{e.invalidateQueries({queryKey:["bots"]})}})}export{m as a,d as b,l as c,q as d,S as e,p as f,f as g,y as h,b as u};
2
+ //# sourceMappingURL=bots-CPHuAvjW.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"bots-Cb0WTwhY.js","sources":["../../src/api/bots.ts"],"sourcesContent":["import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';\nimport { apiFetch } from './client';\nimport type { BotRecord, BotApiKeyRecord } from './types';\nimport type { LTRoleType } from './types';\n\ninterface BotListResponse {\n bots: BotRecord[];\n total: number;\n}\n\ninterface BotFilters {\n limit?: number;\n offset?: number;\n}\n\n// ── Query hooks ──────────────────────────────────────────────────────────────\n\nexport function useBots(filters: BotFilters = {}) {\n const params = new URLSearchParams();\n if (filters.limit) params.set('limit', String(filters.limit));\n if (filters.offset !== undefined) params.set('offset', String(filters.offset));\n\n return useQuery<BotListResponse>({\n queryKey: ['bots', filters],\n queryFn: () => apiFetch(`/bot-accounts?${params}`),\n });\n}\n\nexport function useBotApiKeys(botId: string) {\n return useQuery<{ keys: BotApiKeyRecord[] }>({\n queryKey: ['bots', botId, 'api-keys'],\n queryFn: () => apiFetch(`/bot-accounts/${botId}/api-keys`),\n enabled: !!botId,\n });\n}\n\n// ── Mutation hooks ───────────────────────────────────────────────────────────\n\nexport function useCreateBot() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (data: {\n name: string;\n description?: string;\n display_name?: string;\n roles?: { role: string; type: LTRoleType }[];\n }) =>\n apiFetch('/bot-accounts', {\n method: 'POST',\n body: JSON.stringify(data),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['bots'] });\n },\n });\n}\n\nexport function useUpdateBot() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({\n id,\n ...data\n }: {\n id: string;\n display_name?: string;\n description?: string;\n status?: string;\n }) =>\n apiFetch(`/bot-accounts/${id}`, {\n method: 'PUT',\n body: JSON.stringify(data),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['bots'] });\n },\n });\n}\n\nexport function useDeleteBot() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (id: string) =>\n apiFetch(`/bot-accounts/${id}`, { method: 'DELETE' }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['bots'] });\n },\n });\n}\n\nexport function useCreateBotApiKey() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({\n botId,\n name,\n scopes,\n }: {\n botId: string;\n name: string;\n scopes?: string[];\n }) =>\n apiFetch<{ id: string; rawKey: string }>(`/bot-accounts/${botId}/api-keys`, {\n method: 'POST',\n body: JSON.stringify({ name, scopes }),\n }),\n onSuccess: (_data, vars) => {\n queryClient.invalidateQueries({ queryKey: ['bots', vars.botId, 'api-keys'] });\n },\n });\n}\n\nexport function useRevokeBotApiKey() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ botId, keyId }: { botId: string; keyId: string }) =>\n apiFetch(`/bot-accounts/${botId}/api-keys/${keyId}`, { method: 'DELETE' }),\n onSuccess: (_data, vars) => {\n queryClient.invalidateQueries({ queryKey: ['bots', vars.botId, 'api-keys'] });\n },\n });\n}\n\nexport function useAddBotRole() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({\n botId,\n role,\n type,\n }: {\n botId: string;\n role: string;\n type: LTRoleType;\n }) =>\n apiFetch(`/bot-accounts/${botId}/roles`, {\n method: 'POST',\n body: JSON.stringify({ role, type }),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['bots'] });\n },\n });\n}\n\nexport function useRemoveBotRole() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ botId, role }: { botId: string; role: string }) =>\n apiFetch(`/bot-accounts/${botId}/roles/${encodeURIComponent(role)}`, {\n method: 'DELETE',\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['bots'] });\n },\n });\n}\n"],"names":["useBots","filters","params","useQuery","apiFetch","useBotApiKeys","botId","useCreateBot","queryClient","useQueryClient","useMutation","data","useUpdateBot","id","useDeleteBot","useCreateBotApiKey","name","scopes","_data","vars","useRevokeBotApiKey","keyId","useAddBotRole","role","type","useRemoveBotRole"],"mappings":"qGAiBO,SAASA,EAAQC,EAAsB,GAAI,CAChD,MAAMC,EAAS,IAAI,gBACnB,OAAID,EAAQ,OAAOC,EAAO,IAAI,QAAS,OAAOD,EAAQ,KAAK,CAAC,EACxDA,EAAQ,SAAW,QAAWC,EAAO,IAAI,SAAU,OAAOD,EAAQ,MAAM,CAAC,EAEtEE,EAA0B,CAC/B,SAAU,CAAC,OAAQF,CAAO,EAC1B,QAAS,IAAMG,EAAS,iBAAiBF,CAAM,EAAE,CAAA,CAClD,CACH,CAEO,SAASG,EAAcC,EAAe,CAC3C,OAAOH,EAAsC,CAC3C,SAAU,CAAC,OAAQG,EAAO,UAAU,EACpC,QAAS,IAAMF,EAAS,iBAAiBE,CAAK,WAAW,EACzD,QAAS,CAAC,CAACA,CAAA,CACZ,CACH,CAIO,SAASC,GAAe,CAC7B,MAAMC,EAAcC,EAAA,EACpB,OAAOC,EAAY,CACjB,WAAaC,GAMXP,EAAS,gBAAiB,CACxB,OAAQ,OACR,KAAM,KAAK,UAAUO,CAAI,CAAA,CAC1B,EACH,UAAW,IAAM,CACfH,EAAY,kBAAkB,CAAE,SAAU,CAAC,MAAM,EAAG,CACtD,CAAA,CACD,CACH,CAEO,SAASI,GAAe,CAC7B,MAAMJ,EAAcC,EAAA,EACpB,OAAOC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,EACA,KAAAiB,EACA,KAAAC,CAAA,IAMApB,EAAS,iBAAiBE,CAAK,SAAU,CACvC,OAAQ,OACR,KAAM,KAAK,UAAU,CAAE,KAAAiB,EAAM,KAAAC,EAAM,CAAA,CACpC,EACH,UAAW,IAAM,CACfhB,EAAY,kBAAkB,CAAE,SAAU,CAAC,MAAM,EAAG,CACtD,CAAA,CACD,CACH,CAEO,SAASiB,GAAmB,CACjC,MAAMjB,EAAcC,EAAA,EACpB,OAAOC,EAAY,CACjB,WAAY,CAAC,CAAE,MAAAJ,EAAO,KAAAiB,CAAA,IACpBnB,EAAS,iBAAiBE,CAAK,UAAU,mBAAmBiB,CAAI,CAAC,GAAI,CACnE,OAAQ,QAAA,CACT,EACH,UAAW,IAAM,CACff,EAAY,kBAAkB,CAAE,SAAU,CAAC,MAAM,EAAG,CACtD,CAAA,CACD,CACH"}
1
+ {"version":3,"file":"bots-CPHuAvjW.js","sources":["../../src/api/bots.ts"],"sourcesContent":["import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';\nimport { apiFetch } from './client';\nimport type { BotRecord, BotApiKeyRecord } from './types';\nimport type { LTRoleType } from './types';\n\ninterface BotListResponse {\n bots: BotRecord[];\n total: number;\n}\n\ninterface BotFilters {\n limit?: number;\n offset?: number;\n}\n\n// ── Query hooks ──────────────────────────────────────────────────────────────\n\nexport function useBots(filters: BotFilters = {}) {\n const params = new URLSearchParams();\n if (filters.limit) params.set('limit', String(filters.limit));\n if (filters.offset !== undefined) params.set('offset', String(filters.offset));\n\n return useQuery<BotListResponse>({\n queryKey: ['bots', filters],\n queryFn: () => apiFetch(`/bot-accounts?${params}`),\n });\n}\n\nexport function useBotApiKeys(botId: string) {\n return useQuery<{ keys: BotApiKeyRecord[] }>({\n queryKey: ['bots', botId, 'api-keys'],\n queryFn: () => apiFetch(`/bot-accounts/${botId}/api-keys`),\n enabled: !!botId,\n });\n}\n\n// ── Mutation hooks ───────────────────────────────────────────────────────────\n\nexport function useCreateBot() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (data: {\n name: string;\n description?: string;\n display_name?: string;\n roles?: { role: string; type: LTRoleType }[];\n }) =>\n apiFetch('/bot-accounts', {\n method: 'POST',\n body: JSON.stringify(data),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['bots'] });\n },\n });\n}\n\nexport function useUpdateBot() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({\n id,\n ...data\n }: {\n id: string;\n display_name?: string;\n description?: string;\n status?: string;\n }) =>\n apiFetch(`/bot-accounts/${id}`, {\n method: 'PUT',\n body: JSON.stringify(data),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['bots'] });\n },\n });\n}\n\nexport function useDeleteBot() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (id: string) =>\n apiFetch(`/bot-accounts/${id}`, { method: 'DELETE' }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['bots'] });\n },\n });\n}\n\nexport function useCreateBotApiKey() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({\n botId,\n name,\n scopes,\n }: {\n botId: string;\n name: string;\n scopes?: string[];\n }) =>\n apiFetch<{ id: string; rawKey: string }>(`/bot-accounts/${botId}/api-keys`, {\n method: 'POST',\n body: JSON.stringify({ name, scopes }),\n }),\n onSuccess: (_data, vars) => {\n queryClient.invalidateQueries({ queryKey: ['bots', vars.botId, 'api-keys'] });\n },\n });\n}\n\nexport function useRevokeBotApiKey() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ botId, keyId }: { botId: string; keyId: string }) =>\n apiFetch(`/bot-accounts/${botId}/api-keys/${keyId}`, { method: 'DELETE' }),\n onSuccess: (_data, vars) => {\n queryClient.invalidateQueries({ queryKey: ['bots', vars.botId, 'api-keys'] });\n },\n });\n}\n\nexport function useAddBotRole() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({\n botId,\n role,\n type,\n }: {\n botId: string;\n role: string;\n type: LTRoleType;\n }) =>\n apiFetch(`/bot-accounts/${botId}/roles`, {\n method: 'POST',\n body: JSON.stringify({ role, type }),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['bots'] });\n },\n });\n}\n\nexport function useRemoveBotRole() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ botId, role }: { botId: string; role: string }) =>\n apiFetch(`/bot-accounts/${botId}/roles/${encodeURIComponent(role)}`, {\n method: 'DELETE',\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['bots'] });\n },\n });\n}\n"],"names":["useBots","filters","params","useQuery","apiFetch","useBotApiKeys","botId","useCreateBot","queryClient","useQueryClient","useMutation","data","useUpdateBot","id","useDeleteBot","useCreateBotApiKey","name","scopes","_data","vars","useRevokeBotApiKey","keyId","useAddBotRole","role","type","useRemoveBotRole"],"mappings":"qGAiBO,SAASA,EAAQC,EAAsB,GAAI,CAChD,MAAMC,EAAS,IAAI,gBACnB,OAAID,EAAQ,OAAOC,EAAO,IAAI,QAAS,OAAOD,EAAQ,KAAK,CAAC,EACxDA,EAAQ,SAAW,QAAWC,EAAO,IAAI,SAAU,OAAOD,EAAQ,MAAM,CAAC,EAEtEE,EAA0B,CAC/B,SAAU,CAAC,OAAQF,CAAO,EAC1B,QAAS,IAAMG,EAAS,iBAAiBF,CAAM,EAAE,CAAA,CAClD,CACH,CAEO,SAASG,EAAcC,EAAe,CAC3C,OAAOH,EAAsC,CAC3C,SAAU,CAAC,OAAQG,EAAO,UAAU,EACpC,QAAS,IAAMF,EAAS,iBAAiBE,CAAK,WAAW,EACzD,QAAS,CAAC,CAACA,CAAA,CACZ,CACH,CAIO,SAASC,GAAe,CAC7B,MAAMC,EAAcC,EAAA,EACpB,OAAOC,EAAY,CACjB,WAAaC,GAMXP,EAAS,gBAAiB,CACxB,OAAQ,OACR,KAAM,KAAK,UAAUO,CAAI,CAAA,CAC1B,EACH,UAAW,IAAM,CACfH,EAAY,kBAAkB,CAAE,SAAU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ACH,CAEO,SAASG,GAAgB,CAC9B,MAAMd,EAAcC,EAAA,EACpB,OAAOC,EAAY,CACjB,WAAY,CAAC,CACX,MAAAJ,EACA,KAAAiB,EACA,KAAAC,CAAA,IAMApB,EAAS,iBAAiBE,CAAK,SAAU,CACvC,OAAQ,OACR,KAAM,KAAK,UAAU,CAAE,KAAAiB,EAAM,KAAAC,EAAM,CAAA,CACpC,EACH,UAAW,IAAM,CACfhB,EAAY,kBAAkB,CAAE,SAAU,CAAC,MAAM,EAAG,CACtD,CAAA,CACD,CACH,CAEO,SAASiB,GAAmB,CACjC,MAAMjB,EAAcC,EAAA,EACpB,OAAOC,EAAY,CACjB,WAAY,CAAC,CAAE,MAAAJ,EAAO,KAAAiB,CAAA,IACpBnB,EAAS,iBAAiBE,CAAK,UAAU,mBAAmBiB,CAAI,CAAC,GAAI,CACnE,OAAQ,QAAA,CACT,EACH,UAAW,IAAM,CACff,EAAY,kBAAkB,CAAE,SAAU,CAAC,MAAM,EAAG,CACtD,CAAA,CACD,CACH"}
@@ -1,2 +1,2 @@
1
- import{u as i}from"./vendor-query-B2UbickB.js";import{d as e}from"./index-Dgw1KKpq.js";function t(){return i({queryKey:["capabilities"],queryFn:()=>e("/capabilities")})}export{t as u};
2
- //# sourceMappingURL=capabilities-BGZogsi_.js.map
1
+ import{u as i}from"./vendor-query-B2UbickB.js";import{d as e}from"./index-BoZydcaW.js";function t(){return i({queryKey:["capabilities"],queryFn:()=>e("/capabilities")})}export{t as u};
2
+ //# sourceMappingURL=capabilities-BBTPqF-V.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"capabilities-BGZogsi_.js","sources":["../../src/api/capabilities.ts"],"sourcesContent":["import { useQuery } from '@tanstack/react-query';\nimport { apiFetch } from './client';\n\nexport interface CapabilityTool {\n name: string;\n description: string;\n inputSchema: Record<string, any>;\n serverName: string;\n serverId: string;\n}\n\nexport interface CapabilityCategory {\n name: string;\n tools: CapabilityTool[];\n}\n\nexport interface CapabilitiesResponse {\n categories: CapabilityCategory[];\n totalTools: number;\n}\n\nexport function useCapabilities() {\n return useQuery<CapabilitiesResponse>({\n queryKey: ['capabilities'],\n queryFn: () => apiFetch('/capabilities'),\n });\n}\n"],"names":["useCapabilities","useQuery","apiFetch"],"mappings":"uFAqBO,SAASA,GAAkB,CAChC,OAAOC,EAA+B,CACpC,SAAU,CAAC,cAAc,EACzB,QAAS,IAAMC,EAAS,eAAe,CAAA,CACxC,CACH"}
1
+ {"version":3,"file":"capabilities-BBTPqF-V.js","sources":["../../src/api/capabilities.ts"],"sourcesContent":["import { useQuery } from '@tanstack/react-query';\nimport { apiFetch } from './client';\n\nexport interface CapabilityTool {\n name: string;\n description: string;\n inputSchema: Record<string, any>;\n serverName: string;\n serverId: string;\n}\n\nexport interface CapabilityCategory {\n name: string;\n tools: CapabilityTool[];\n}\n\nexport interface CapabilitiesResponse {\n categories: CapabilityCategory[];\n totalTools: number;\n}\n\nexport function useCapabilities() {\n return useQuery<CapabilitiesResponse>({\n queryKey: ['capabilities'],\n queryFn: () => apiFetch('/capabilities'),\n });\n}\n"],"names":["useCapabilities","useQuery","apiFetch"],"mappings":"uFAqBO,SAASA,GAAkB,CAChC,OAAOC,EAA+B,CACpC,SAAU,CAAC,cAAc,EACzB,QAAS,IAAMC,EAAS,eAAe,CAAA,CACxC,CACH"}
@@ -1,2 +1,2 @@
1
- import{u as o,c as l,b as a}from"./vendor-query-B2UbickB.js";import{d as n}from"./index-Dgw1KKpq.js";function s(){return n("/controlplane/apps")}function c(e){return n(`/controlplane/rollcall?app_id=${encodeURIComponent(e)}`)}function i(e){return n("/controlplane/throttle",{method:"POST",body:JSON.stringify(e)})}function m(e){return n("/controlplane/subscribe",{method:"POST",body:JSON.stringify(e)})}function f(e,t,u){let r=`/controlplane/streams?app_id=${encodeURIComponent(e)}&duration=${encodeURIComponent(t)}`;return n(r)}function b(e){return o({queryKey:["controlplane","apps"],queryFn:s,staleTime:6e4,enabled:(e==null?void 0:e.enabled)??!0})}function d(e,t){return o({queryKey:["controlplane","rollcall",e],queryFn:()=>c(e),enabled:!!e,refetchInterval:t})}function h(){const e=a();return l({mutationFn:i,onSuccess:()=>{setTimeout(()=>{e.invalidateQueries({queryKey:["controlplane","rollcall"]})},1500)}})}function S(e,t,u,r){return o({queryKey:["controlplane","streams",e,t,""],queryFn:()=>f(e,t),enabled:!!e,staleTime:15e3,refetchInterval:r})}function q(){return l({mutationFn:m})}export{h as a,q as b,d as c,S as d,b as u};
2
- //# sourceMappingURL=controlplane-B7VJTlZD.js.map
1
+ import{u as o,c as l,b as a}from"./vendor-query-B2UbickB.js";import{d as n}from"./index-BoZydcaW.js";function s(){return n("/controlplane/apps")}function c(e){return n(`/controlplane/rollcall?app_id=${encodeURIComponent(e)}`)}function i(e){return n("/controlplane/throttle",{method:"POST",body:JSON.stringify(e)})}function m(e){return n("/controlplane/subscribe",{method:"POST",body:JSON.stringify(e)})}function f(e,t,u){let r=`/controlplane/streams?app_id=${encodeURIComponent(e)}&duration=${encodeURIComponent(t)}`;return n(r)}function b(e){return o({queryKey:["controlplane","apps"],queryFn:s,staleTime:6e4,enabled:(e==null?void 0:e.enabled)??!0})}function d(e,t){return o({queryKey:["controlplane","rollcall",e],queryFn:()=>c(e),enabled:!!e,refetchInterval:t})}function h(){const e=a();return l({mutationFn:i,onSuccess:()=>{setTimeout(()=>{e.invalidateQueries({queryKey:["controlplane","rollcall"]})},1500)}})}function S(e,t,u,r){return o({queryKey:["controlplane","streams",e,t,""],queryFn:()=>f(e,t),enabled:!!e,staleTime:15e3,refetchInterval:r})}function q(){return l({mutationFn:m})}export{h as a,q as b,d as c,S as d,b as u};
2
+ //# sourceMappingURL=controlplane-C9j2mwX8.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"controlplane-B7VJTlZD.js","sources":["../../src/api/controlplane.ts"],"sourcesContent":["import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';\nimport { apiFetch } from './client';\n\n// ── Types ───────────────────────────────────────────────────────────────────\n\nexport interface ControlPlaneApp {\n appId: string;\n version: string;\n}\n\nexport interface QuorumProfile {\n namespace: string;\n app_id: string;\n engine_id: string;\n entity?: string;\n worker_topic?: string;\n stream?: string;\n stream_depth?: number;\n counts?: Record<string, number>;\n inited?: string;\n timestamp?: string;\n throttle?: number;\n reclaimDelay?: number;\n reclaimCount?: number;\n system?: {\n TotalMemoryGB: string;\n FreeMemoryGB: string;\n UsedMemoryGB: string;\n CPULoad: Array<Record<string, string>>;\n NetworkStats: Array<Record<string, unknown>>;\n };\n is_scout?: boolean;\n signature?: string;\n}\n\n// ── API functions ───────────────────────────────────────────────────────────\n\nfunction fetchApps() {\n return apiFetch<{ apps: ControlPlaneApp[] }>('/controlplane/apps');\n}\n\nfunction fetchRollCall(appId: string) {\n return apiFetch<{ profiles: QuorumProfile[] }>(`/controlplane/rollcall?app_id=${encodeURIComponent(appId)}`);\n}\n\nfunction postThrottle(body: { appId: string; throttle: number; topic?: string; guid?: string; scope?: 'engines' | 'workers' | 'all' }) {\n return apiFetch<{ success: boolean }>('/controlplane/throttle', {\n method: 'POST',\n body: JSON.stringify(body),\n });\n}\n\nfunction postSubscribe(body: { appId: string }) {\n return apiFetch<{ subscribed: boolean; appId: string }>('/controlplane/subscribe', {\n method: 'POST',\n body: JSON.stringify(body),\n });\n}\n\nexport interface StreamStats {\n pending: number;\n processed: number;\n byStream: Array<{ stream_type: 'engine' | 'worker'; stream_name: string; count: number }>;\n}\n\nfunction fetchStreamStats(appId: string, duration: string, stream?: string) {\n let url = `/controlplane/streams?app_id=${encodeURIComponent(appId)}&duration=${encodeURIComponent(duration)}`;\n if (stream) url += `&stream=${encodeURIComponent(stream)}`;\n return apiFetch<StreamStats>(url);\n}\n\n// ── Hooks ───────────────────────────────────────────────────────────────────\n\nexport function useControlPlaneApps(options?: { enabled?: boolean }) {\n return useQuery({\n queryKey: ['controlplane', 'apps'],\n queryFn: fetchApps,\n staleTime: 60_000,\n enabled: options?.enabled ?? true,\n });\n}\n\nexport function useRollCall(appId: string, refetchInterval?: number | false) {\n return useQuery({\n queryKey: ['controlplane', 'rollcall', appId],\n queryFn: () => fetchRollCall(appId),\n enabled: !!appId,\n refetchInterval: refetchInterval ?? false,\n });\n}\n\nexport function useThrottle() {\n const qc = useQueryClient();\n return useMutation({\n mutationFn: postThrottle,\n onSuccess: () => {\n // Delay refetch so mesh members have time to process the throttle message\n setTimeout(() => {\n qc.invalidateQueries({ queryKey: ['controlplane', 'rollcall'] });\n }, 1500);\n },\n });\n}\n\nexport function useStreamStats(appId: string, duration: string, stream?: string, refetchInterval?: number | false) {\n return useQuery({\n queryKey: ['controlplane', 'streams', appId, duration, stream ?? ''],\n queryFn: () => fetchStreamStats(appId, duration, stream),\n enabled: !!appId,\n staleTime: 15_000,\n refetchInterval: refetchInterval ?? false,\n });\n}\n\nexport function useSubscribeMesh() {\n return useMutation({\n mutationFn: postSubscribe,\n });\n}\n"],"names":["fetchApps","apiFetch","fetchRollCall","appId","postThrottle","body","postSubscribe","fetchStreamStats","duration","stream","url","useControlPlaneApps","options","useQuery","useRollCall","refetchInterval","useThrottle","qc","useQueryClient","useMutation","useStreamStats","useSubscribeMesh"],"mappings":"qGAqCA,SAASA,GAAY,CACnB,OAAOC,EAAsC,oBAAoB,CACnE,CAEA,SAASC,EAAcC,EAAe,CACpC,OAAOF,EAAwC,iCAAiC,mBAAmBE,CAAK,CAAC,EAAE,CAC7G,CAEA,SAASC,EAAaC,EAAiH,CACrI,OAAOJ,EAA+B,yBAA0B,CAC9D,OAAQ,OACR,KAAM,KAAK,UAAUI,CAAI,CAAA,CAC1B,CACH,CAEA,SAASC,EAAcD,EAAyB,CAC9C,OAAOJ,EAAiD,0BAA2B,CACjF,OAAQ,OACR,KAAM,KAAK,UAAUI,CAAI,CAAA,CAC1B,CACH,CAQA,SAASE,EAAiBJ,EAAeK,EAAkBC,EAAiB,CAC1E,IAAIC,EAAM,gCAAgC,mBAAmBP,CAAK,CAAC,aAAa,mBAAmBK,CAAQ,CAAC,GAE5G,OAAOP,EAAsBS,CAAG,CAClC,CAIO,SAASC,EAAoBC,EAAiC,CACnE,OAAOC,EAAS,CACd,SAAU,CAAC,eAAgB,MAAM,EACjC,QAASb,EACT,UAAW,IACX,SAASY,GAAA,YAAAA,EAAS,UAAW,EAAA,CAC9B,CACH,CAEO,SAASE,EAAYX,EAAeY,EAAkC,CAC3E,OAAOF,EAAS,CACd,SAAU,CAAC,eAAgB,WAAYV,CAAK,EAC5C,QAAS,IAAMD,EAAcC,CAAK,EAClC,QAAS,CAAC,CAACA,EACX,gBAAiBY,CAAmB,CACrC,CACH,CAEO,SAASC,GAAc,CAC5B,MAAMC,EAAKC,EAAA,EACX,OAAOC,EAAY,CACjB,WAAYf,EACZ,UAAW,IAAM,CAEf,WAAW,IAAM,CACfa,EAAG,kBAAkB,CAAE,SAAU,CAAC,eAAgB,UAAU,EAAG,CACjE,EAAG,IAAI,CACT,CAAA,CACD,CACH,CAEO,SAASG,EAAejB,EAAeK,EAAkBC,EAAiBM,EAAkC,CACjH,OAAOF,EAAS,CACd,SAAU,CAAC,eAAgB,UAAWV,EAAOK,EAAoB,EAAE,EACnE,QAAS,IAAMD,EAAiBJ,EAAOK,CAAgB,EACvD,QAAS,CAAC,CAACL,EACX,UAAW,KACX,gBAAiBY,CAAmB,CACrC,CACH,CAEO,SAASM,GAAmB,CACjC,OAAOF,EAAY,CACjB,WAAYb,CAAA,CACb,CACH"}
1
+ {"version":3,"file":"controlplane-C9j2mwX8.js","sources":["../../src/api/controlplane.ts"],"sourcesContent":["import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';\nimport { apiFetch } from './client';\n\n// ── Types ───────────────────────────────────────────────────────────────────\n\nexport interface ControlPlaneApp {\n appId: string;\n version: string;\n}\n\nexport interface QuorumProfile {\n namespace: string;\n app_id: string;\n engine_id: string;\n entity?: string;\n worker_topic?: string;\n stream?: string;\n stream_depth?: number;\n counts?: Record<string, number>;\n inited?: string;\n timestamp?: string;\n throttle?: number;\n reclaimDelay?: number;\n reclaimCount?: number;\n system?: {\n TotalMemoryGB: string;\n FreeMemoryGB: string;\n UsedMemoryGB: string;\n CPULoad: Array<Record<string, string>>;\n NetworkStats: Array<Record<string, unknown>>;\n };\n is_scout?: boolean;\n signature?: string;\n}\n\n// ── API functions ───────────────────────────────────────────────────────────\n\nfunction fetchApps() {\n return apiFetch<{ apps: ControlPlaneApp[] }>('/controlplane/apps');\n}\n\nfunction fetchRollCall(appId: string) {\n return apiFetch<{ profiles: QuorumProfile[] }>(`/controlplane/rollcall?app_id=${encodeURIComponent(appId)}`);\n}\n\nfunction postThrottle(body: { appId: string; throttle: number; topic?: string; guid?: string; scope?: 'engines' | 'workers' | 'all' }) {\n return apiFetch<{ success: boolean }>('/controlplane/throttle', {\n method: 'POST',\n body: JSON.stringify(body),\n });\n}\n\nfunction postSubscribe(body: { appId: string }) {\n return apiFetch<{ subscribed: boolean; appId: string }>('/controlplane/subscribe', {\n method: 'POST',\n body: JSON.stringify(body),\n });\n}\n\nexport interface StreamStats {\n pending: number;\n processed: number;\n byStream: Array<{ stream_type: 'engine' | 'worker'; stream_name: string; count: number }>;\n}\n\nfunction fetchStreamStats(appId: string, duration: string, stream?: string) {\n let url = `/controlplane/streams?app_id=${encodeURIComponent(appId)}&duration=${encodeURIComponent(duration)}`;\n if (stream) url += `&stream=${encodeURIComponent(stream)}`;\n return apiFetch<StreamStats>(url);\n}\n\n// ── Hooks ───────────────────────────────────────────────────────────────────\n\nexport function useControlPlaneApps(options?: { enabled?: boolean }) {\n return useQuery({\n queryKey: ['controlplane', 'apps'],\n queryFn: fetchApps,\n staleTime: 60_000,\n enabled: options?.enabled ?? true,\n });\n}\n\nexport function useRollCall(appId: string, refetchInterval?: number | false) {\n return useQuery({\n queryKey: ['controlplane', 'rollcall', appId],\n queryFn: () => fetchRollCall(appId),\n enabled: !!appId,\n refetchInterval: refetchInterval ?? false,\n });\n}\n\nexport function useThrottle() {\n const qc = useQueryClient();\n return useMutation({\n mutationFn: postThrottle,\n onSuccess: () => {\n // Delay refetch so mesh members have time to process the throttle message\n setTimeout(() => {\n qc.invalidateQueries({ queryKey: ['controlplane', 'rollcall'] });\n }, 1500);\n },\n });\n}\n\nexport function useStreamStats(appId: string, duration: string, stream?: string, refetchInterval?: number | false) {\n return useQuery({\n queryKey: ['controlplane', 'streams', appId, duration, stream ?? ''],\n queryFn: () => fetchStreamStats(appId, duration, stream),\n enabled: !!appId,\n staleTime: 15_000,\n refetchInterval: refetchInterval ?? false,\n });\n}\n\nexport function useSubscribeMesh() {\n return useMutation({\n mutationFn: postSubscribe,\n });\n}\n"],"names":["fetchApps","apiFetch","fetchRollCall","appId","postThrottle","body","postSubscribe","fetchStreamStats","duration","stream","url","useControlPlaneApps","options","useQuery","useRollCall","refetchInterval","useThrottle","qc","useQueryClient","useMutation","useStreamStats","useSubscribeMesh"],"mappings":"qGAqCA,SAASA,GAAY,CACnB,OAAOC,EAAsC,oBAAoB,CACnE,CAEA,SAASC,EAAcC,EAAe,CACpC,OAAOF,EAAwC,iCAAiC,mBAAmBE,CAAK,CAAC,EAAE,CAC7G,CAEA,SAASC,EAAaC,EAAiH,CACrI,OAAOJ,EAA+B,yBAA0B,CAC9D,OAAQ,OACR,KAAM,KAAK,UAAUI,CAAI,CAAA,CAC1B,CACH,CAEA,SAASC,EAAcD,EAAyB,CAC9C,OAAOJ,EAAiD,0BAA2B,CACjF,OAAQ,OACR,KAAM,KAAK,UAAUI,CAAI,CAAA,CAC1B,CACH,CAQA,SAASE,EAAiBJ,EAAeK,EAAkBC,EAAiB,CAC1E,IAAIC,EAAM,gCAAgC,mBAAmBP,CAAK,CAAC,aAAa,mBAAmBK,CAAQ,CAAC,GAE5G,OAAOP,EAAsBS,CAAG,CAClC,CAIO,SAASC,EAAoBC,EAAiC,CACnE,OAAOC,EAAS,CACd,SAAU,CAAC,eAAgB,MAAM,EACjC,QAASb,EACT,UAAW,IACX,SAASY,GAAA,YAAAA,EAAS,UAAW,EAAA,CAC9B,CACH,CAEO,SAASE,EAAYX,EAAeY,EAAkC,CAC3E,OAAOF,EAAS,CACd,SAAU,CAAC,eAAgB,WAAYV,CAAK,EAC5C,QAAS,IAAMD,EAAcC,CAAK,EAClC,QAAS,CAAC,CAACA,EACX,gBAAiBY,CAAmB,CACrC,CACH,CAEO,SAASC,GAAc,CAC5B,MAAMC,EAAKC,EAAA,EACX,OAAOC,EAAY,CACjB,WAAYf,EACZ,UAAW,IAAM,CAEf,WAAW,IAAM,CACfa,EAAG,kBAAkB,CAAE,SAAU,CAAC,eAAgB,UAAU,EAAG,CACjE,EAAG,IAAI,CACT,CAAA,CACD,CACH,CAEO,SAASG,EAAejB,EAAeK,EAAkBC,EAAiBM,EAAkC,CACjH,OAAOF,EAAS,CACd,SAAU,CAAC,eAAgB,UAAWV,EAAOK,EAAoB,EAAE,EACnE,QAAS,IAAMD,EAAiBJ,EAAOK,CAAgB,EACvD,QAAS,CAAC,CAACL,EACX,UAAW,KACX,gBAAiBY,CAAmB,CACrC,CACH,CAEO,SAASM,GAAmB,CACjC,OAAOF,EAAY,CACjB,WAAYb,CAAA,CACb,CACH"}
@@ -1,2 +1,2 @@
1
- import{a,j as r}from"./vendor-query-B2UbickB.js";import{G as l,H as c,I as m}from"./index-Dgw1KKpq.js";const n=[{maxMs:0,color:"text-status-error"},{maxMs:300*1e3,color:"text-status-error"},{maxMs:900*1e3,color:"text-status-warning"},{maxMs:1/0,color:"text-text-secondary"}];function u(t){if(t<=0)return n[0].color;for(const e of n)if(t<e.maxMs)return e.color;return n[n.length-1].color}function w({until:t}){const[e,s]=a.useState(()=>new Date(t).getTime()-Date.now());a.useEffect(()=>{const o=setInterval(()=>{s(new Date(t).getTime()-Date.now())},1e3);return()=>clearInterval(o)},[t]);const i=a.useMemo(()=>{const o=new Date(t);return[{label:"ms",value:String(Math.max(0,e))},{label:"until",value:o.toISOString()},{label:"local",value:l(o,"MMM d, yyyy h:mm:ss a")}]},[t,e]);return r.jsx(c,{options:i,children:r.jsx("span",{className:`text-xs font-mono ${u(e)}`,children:m(e)})})}function d(t){return!!(t.assigned_to&&t.assigned_until&&new Date(t.assigned_until)>new Date)}function g(t){return!t.workflow_type}export{w as C,d as a,g as i};
2
- //# sourceMappingURL=escalation-Bl-SQV_u.js.map
1
+ import{a,j as r}from"./vendor-query-B2UbickB.js";import{G as l,H as c,I as m}from"./index-BoZydcaW.js";const n=[{maxMs:0,color:"text-status-error"},{maxMs:300*1e3,color:"text-status-error"},{maxMs:900*1e3,color:"text-status-warning"},{maxMs:1/0,color:"text-text-secondary"}];function u(t){if(t<=0)return n[0].color;for(const e of n)if(t<e.maxMs)return e.color;return n[n.length-1].color}function w({until:t}){const[e,s]=a.useState(()=>new Date(t).getTime()-Date.now());a.useEffect(()=>{const o=setInterval(()=>{s(new Date(t).getTime()-Date.now())},1e3);return()=>clearInterval(o)},[t]);const i=a.useMemo(()=>{const o=new Date(t);return[{label:"ms",value:String(Math.max(0,e))},{label:"until",value:o.toISOString()},{label:"local",value:l(o,"MMM d, yyyy h:mm:ss a")}]},[t,e]);return r.jsx(c,{options:i,children:r.jsx("span",{className:`text-xs font-mono ${u(e)}`,children:m(e)})})}function d(t){return!!(t.assigned_to&&t.assigned_until&&new Date(t.assigned_until)>new Date)}function g(t){return!t.workflow_type}export{w as C,d as a,g as i};
2
+ //# sourceMappingURL=escalation-CyJ_wz-f.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"escalation-Bl-SQV_u.js","sources":["../../src/components/common/display/CountdownTimer.tsx","../../src/lib/escalation.ts"],"sourcesContent":["import { useState, useEffect, useMemo } from 'react';\nimport { format as fnsFormat } from 'date-fns';\nimport { formatRemaining } from '../../../lib/format';\nimport { DateTooltip } from './DateTooltip';\n\nconst COUNTDOWN_THRESHOLDS = [\n { maxMs: 0, color: 'text-status-error' },\n { maxMs: 5 * 60 * 1000, color: 'text-status-error' },\n { maxMs: 15 * 60 * 1000, color: 'text-status-warning' },\n { maxMs: Infinity, color: 'text-text-secondary' },\n] as const;\n\nfunction countdownColor(remainingMs: number): string {\n if (remainingMs <= 0) return COUNTDOWN_THRESHOLDS[0].color;\n for (const t of COUNTDOWN_THRESHOLDS) {\n if (remainingMs < t.maxMs) return t.color;\n }\n return COUNTDOWN_THRESHOLDS[COUNTDOWN_THRESHOLDS.length - 1].color;\n}\n\nexport function CountdownTimer({ until }: { until: string }) {\n const [remaining, setRemaining] = useState(() => new Date(until).getTime() - Date.now());\n\n useEffect(() => {\n const interval = setInterval(() => {\n setRemaining(new Date(until).getTime() - Date.now());\n }, 1000);\n return () => clearInterval(interval);\n }, [until]);\n\n const options = useMemo(() => {\n const d = new Date(until);\n return [\n { label: 'ms', value: String(Math.max(0, remaining)) },\n { label: 'until', value: d.toISOString() },\n { label: 'local', value: fnsFormat(d, 'MMM d, yyyy h:mm:ss a') },\n ];\n }, [until, remaining]);\n\n return (\n <DateTooltip options={options}>\n <span className={`text-xs font-mono ${countdownColor(remaining)}`}>\n {formatRemaining(remaining)}\n </span>\n </DateTooltip>\n );\n}\n","import type { LTEscalationRecord } from '../api/types';\n\nexport function isEffectivelyClaimed(esc: LTEscalationRecord): boolean {\n return !!(\n esc.assigned_to &&\n esc.assigned_until &&\n new Date(esc.assigned_until) > new Date()\n );\n}\n\n/** An ACK escalation has no associated workflow — it's a notification, not a task. */\nexport function isAckEscalation(esc: LTEscalationRecord): boolean {\n return !esc.workflow_type;\n}\n\nexport function isAvailable(esc: LTEscalationRecord): boolean {\n return (\n esc.status === 'pending' &&\n (!esc.assigned_to ||\n !esc.assigned_until ||\n new Date(esc.assigned_until) <= new Date())\n );\n}\n"],"names":["COUNTDOWN_THRESHOLDS","countdownColor","remainingMs","t","CountdownTimer","until","remaining","setRemaining","useState","useEffect","interval","options","useMemo","d","fnsFormat","jsx","DateTooltip","formatRemaining","isEffectivelyClaimed","esc","isAckEscalation"],"mappings":"uGAKA,MAAMA,EAAuB,CAC3B,CAAE,MAAO,EAAgB,MAAO,mBAAA,EAChC,CAAE,MAAO,IAAS,IAAO,MAAO,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AAgBD,EAAkC,CAChE,MAAO,CAACA,EAAI,aACd"}
1
+ {"version":3,"file":"escalation-CyJ_wz-f.js","sources":["../../src/components/common/display/CountdownTimer.tsx","../../src/lib/escalation.ts"],"sourcesContent":["import { useState, useEffect, useMemo } from 'react';\nimport { format as fnsFormat } from 'date-fns';\nimport { formatRemaining } from '../../../lib/format';\nimport { DateTooltip } from './DateTooltip';\n\nconst COUNTDOWN_THRESHOLDS = [\n { maxMs: 0, color: 'text-status-error' },\n { maxMs: 5 * 60 * 1000, color: 'text-status-error' },\n { maxMs: 15 * 60 * 1000, color: 'text-status-warning' },\n { maxMs: Infinity, color: 'text-text-secondary' },\n] as const;\n\nfunction countdownColor(remainingMs: number): string {\n if (remainingMs <= 0) return COUNTDOWN_THRESHOLDS[0].color;\n for (const t of COUNTDOWN_THRESHOLDS) {\n if (remainingMs < t.maxMs) return t.color;\n }\n return COUNTDOWN_THRESHOLDS[COUNTDOWN_THRESHOLDS.length - 1].color;\n}\n\nexport function CountdownTimer({ until }: { until: string }) {\n const [remaining, setRemaining] = useState(() => new Date(until).getTime() - Date.now());\n\n useEffect(() => {\n const interval = setInterval(() => {\n setRemaining(new Date(until).getTime() - Date.now());\n }, 1000);\n return () => clearInterval(interval);\n }, [until]);\n\n const options = useMemo(() => {\n const d = new Date(until);\n return [\n { label: 'ms', value: String(Math.max(0, remaining)) },\n { label: 'until', value: d.toISOString() },\n { label: 'local', value: fnsFormat(d, 'MMM d, yyyy h:mm:ss a') },\n ];\n }, [until, remaining]);\n\n return (\n <DateTooltip options={options}>\n <span className={`text-xs font-mono ${countdownColor(remaining)}`}>\n {formatRemaining(remaining)}\n </span>\n </DateTooltip>\n );\n}\n","import type { LTEscalationRecord } from '../api/types';\n\nexport function isEffectivelyClaimed(esc: LTEscalationRecord): boolean {\n return !!(\n esc.assigned_to &&\n esc.assigned_until &&\n new Date(esc.assigned_until) > new Date()\n );\n}\n\n/** An ACK escalation has no associated workflow — it's a notification, not a task. */\nexport function isAckEscalation(esc: LTEscalationRecord): boolean {\n return !esc.workflow_type;\n}\n\nexport function isAvailable(esc: LTEscalationRecord): boolean {\n return (\n esc.status === 'pending' &&\n (!esc.assigned_to ||\n !esc.assigned_until ||\n new Date(esc.assigned_until) <= new Date())\n );\n}\n"],"names":["COUNTDOWN_THRESHOLDS","countdownColor","remainingMs","t","CountdownTimer","until","remaining","setRemaining","useState","useEffect","interval","options","useMemo","d","fnsFormat","jsx","DateTooltip","formatRemaining","isEffectivelyClaimed","esc","isAckEscalation"],"mappings":"uGAKA,MAAMA,EAAuB,CAC3B,CAAE,MAAO,EAAgB,MAAO,mBAAA,EAChC,CAAE,MAAO,IAAS,IAAO,MAAO,mBAAA,EAChC,CAAE,MAAO,IAAU,IAAM,MAAO,qBAAA,EAChC,CAAE,MAAO,IAAiB,MAAO,qBAAA,CACnC,EAEA,SAASC,EAAeC,EAA6B,CACnD,GAAIA,GAAe,EAAG,OAAOF,EAAqB,CAAC,EAAE,MACrD,UAAWG,KAAKH,EACd,GAAIE,EAAcC,EAAE,MAAO,OAAOA,EAAE,MAEtC,OAAOH,EAAqBA,EAAqB,OAAS,CAAC,EAAE,KAC/D,CAEO,SAASI,EAAe,CAAE,MAAAC,GAA4B,CAC3D,KAAM,CAACC,EAAWC,CAAY,EAAIC,EAAAA,SAAS,IAAM,IAAI,KAAKH,CAAK,EAAE,QAAA,EAAY,KAAK,KAAK,EAEvFI,EAAAA,UAAU,IAAM,CACd,MAAMC,EAAW,YAAY,IAAM,CACjCH,EAAa,IAAI,KAAKF,CAAK,EAAE,UAAY,KAAK,KAAK,CACrD,EAAG,GAAI,EACP,MAAO,IAAM,cAAcK,CAAQ,CACrC,EAAG,CAACL,CAAK,CAAC,EAEV,MAAMM,EAAUC,EAAAA,QAAQ,IAAM,CAC5B,MAAMC,EAAI,IAAI,KAAKR,CAAK,EACxB,MAAO,CACL,CAAE,MAAO,KAAM,MAAO,OAAO,KAAK,IAAI,EAAGC,CAAS,CAAC,CAAA,EACnD,CAAE,MAAO,QAAS,MAAOO,EAAE,aAAY,EACvC,CAAE,MAAO,QAAS,MAAOC,EAAUD,EAAG,uBAAuB,CAAA,CAAE,CAEnE,EAAG,CAACR,EAAOC,CAAS,CAAC,EAErB,OACES,EAAAA,IAACC,EAAA,CAAY,QAAAL,EACX,SAAAI,MAAC,QAAK,UAAW,qBAAqBd,EAAeK,CAAS,CAAC,GAC5D,SAAAW,EAAgBX,CAAS,EAC5B,EACF,CAEJ,CC5CO,SAASY,EAAqBC,EAAkC,CACrE,MAAO,CAAC,EACNA,EAAI,aACJA,EAAI,gBACJ,IAAI,KAAKA,EAAI,cAAc,EAAI,IAAI,KAEvC,CAGO,SAASC,EAAgBD,EAAkC,CAChE,MAAO,CAACA,EAAI,aACd"}
@@ -1,2 +1,2 @@
1
- import{j as e,a as p}from"./vendor-query-B2UbickB.js";import{F as u,b as n,c as o,a as h}from"./FilterBar-BQ2JGg8U.js";import{P as j}from"./PriorityBadge-B4ykBH7f.js";import{R as f}from"./RolePill-Cl71eDUA.js";import{W as v}from"./WorkflowPill-IDjTRfQ8.js";import{C as w,i as y,a as N}from"./escalation-Bl-SQV_u.js";import{x as b,y as g,J as k}from"./index-Dgw1KKpq.js";import{a6 as C,a7 as _,a8 as c,o as P}from"./vendor-icons-CEWCGPeJ.js";const l="text-text-secondary transition-colors group-hover/row:text-text-primary";function T({row:a}){if(y(a)){const t=a.status==="resolved"?"text-status-success":"text-text-tertiary";return e.jsx(_,{className:`w-3 h-3 shrink-0 ${t}`})}return a.status==="resolved"?e.jsx(c,{className:"w-2.5 h-2.5 shrink-0 fill-status-success text-status-success"}):a.status==="cancelled"?e.jsx(c,{className:"w-2.5 h-2.5 shrink-0 fill-status-error text-status-error"}):N(a)?e.jsx(c,{className:"w-2.5 h-2.5 shrink-0 fill-status-warning text-status-warning"}):e.jsx(c,{className:"w-2.5 h-2.5 shrink-0 fill-status-active text-status-active"})}function E({metadata:a}){const[t,x]=p.useState(!1);if(!a||Object.keys(a).length===0)return e.jsx("span",{className:"text-[11px] text-text-tertiary",children:"—"});const r=Object.keys(a),m=`${r.slice(0,2).join(", ")}${r.length>2?` +${r.length-2}`:""}`;return e.jsxs("div",{className:"w-full",children:[e.jsxs("button",{onClick:i=>{i.stopPropagation(),x(d=>!d)},className:`inline-flex max-w-full items-center gap-1 font-mono text-[11px] ${l}`,title:t?"Collapse metadata":"Expand metadata",children:[e.jsx(P,{className:`h-3 w-3 shrink-0 transition-transform ${t?"rotate-90":""}`}),e.jsx("span",{className:"truncate",children:`{ ${m} }`})]}),e.jsx("div",{className:`grid transition-[grid-template-rows] duration-200 ease-out ${t?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,children:e.jsx("div",{className:"overflow-hidden",children:e.jsx("div",{className:"mt-1 overflow-x-auto",onClick:i=>i.stopPropagation(),children:e.jsx(k,{data:a,defaultCollapsed:!0})})})})]})}const D=[{key:"description",label:"Summary",render:a=>e.jsxs("div",{className:"flex items-center gap-2 overflow-hidden",children:[e.jsx("span",{className:"shrink-0",children:e.jsx(T,{row:a})}),e.jsx("span",{className:`truncate text-xs ${l}`,children:a.description||a.type})]}),className:"max-w-0"},{key:"workflow_type",label:"Workflow",render:a=>e.jsx(v,{type:a.workflow_type||a.type}),className:"w-40 whitespace-nowrap"},{key:"metadata",label:"Metadata",render:a=>e.jsx(E,{metadata:a.metadata}),className:"w-80 max-w-[19rem] align-top"},{key:"role",label:"Role",render:a=>e.jsx("span",{className:l,children:e.jsx(f,{role:a.role,size:"md",tone:"inherit"})}),className:"w-28"},{key:"priority",label:"Priority",render:a=>e.jsx("span",{className:l,children:e.jsx(j,{priority:a.priority,size:"sm",tone:"inherit"})}),className:"w-14",sortable:!0},{key:"created_time",label:"Created",render:a=>e.jsx("span",{className:`text-[11px] font-mono whitespace-nowrap ${l}`,title:a.created_at,children:b(a.created_at)}),className:"w-40 whitespace-nowrap"},{key:"created_at",label:"Ago",render:a=>e.jsx("span",{className:`text-xs tabular-nums ${l}`,title:a.created_at,children:g(a.created_at)}),className:"w-12 whitespace-nowrap",sortable:!0}],U={key:"expires",label:e.jsx(C,{className:"w-3.5 h-3.5 text-text-tertiary"}),render:a=>a.assigned_until?e.jsx(w,{until:a.assigned_until}):e.jsx("span",{className:"text-xs text-text-tertiary",children:"—"}),className:"w-16 whitespace-nowrap"},S=[{value:"1",label:"P1"},{value:"2",label:"P2"},{value:"3",label:"P3"},{value:"4",label:"P4"}],O=[{value:"all",label:"All"},{value:"available",label:"Available"},{value:"claimed",label:"Claimed"},{value:"resolved",label:"Resolved"},{value:"cancelled",label:"Cancelled"},{value:"expired",label:"Expired"}];function W({filters:a,setFilter:t,roles:x,types:r,showStatus:m=!1,showSearch:i=!0,actions:d}){return e.jsxs(u,{actions:d,children:[m&&e.jsxs(e.Fragment,{children:[e.jsx(n,{label:"Status",value:a.status??"",onChange:s=>t("status",s),options:O}),e.jsx(o,{})]}),e.jsx(n,{label:"Role",value:a.role,onChange:s=>t("role",s),options:x.map(s=>({value:s,label:s}))}),e.jsx(o,{}),e.jsx(n,{label:"Type",value:a.type,onChange:s=>t("type",s),options:r.map(s=>({value:s,label:s}))}),e.jsx(o,{}),e.jsx(n,{label:"Priority",value:a.priority,onChange:s=>t("priority",s),options:S}),i&&e.jsxs(e.Fragment,{children:[e.jsx(o,{}),e.jsx(h,{label:"Search",value:a.search??"",onChange:s=>t("search",s),placeholder:"ID, workflow, origin…"})]})]})}export{D as E,U as T,W as a};
2
- //# sourceMappingURL=escalation-columns-BlJOswRx.js.map
1
+ import{j as e,a as p}from"./vendor-query-B2UbickB.js";import{F as u,b as n,c as o,a as h}from"./FilterBar-BQ2JGg8U.js";import{P as j}from"./PriorityBadge-B4ykBH7f.js";import{R as f}from"./RolePill-CXEyPMqb.js";import{W as v}from"./WorkflowPill-BegV-iRF.js";import{C as w,i as y,a as N}from"./escalation-CyJ_wz-f.js";import{x as b,y as g,J as k}from"./index-BoZydcaW.js";import{a6 as C,a7 as _,a8 as c,o as P}from"./vendor-icons-BaQqUm-e.js";const l="text-text-secondary transition-colors group-hover/row:text-text-primary";function T({row:a}){if(y(a)){const t=a.status==="resolved"?"text-status-success":"text-text-tertiary";return e.jsx(_,{className:`w-3 h-3 shrink-0 ${t}`})}return a.status==="resolved"?e.jsx(c,{className:"w-2.5 h-2.5 shrink-0 fill-status-success text-status-success"}):a.status==="cancelled"?e.jsx(c,{className:"w-2.5 h-2.5 shrink-0 fill-status-error text-status-error"}):N(a)?e.jsx(c,{className:"w-2.5 h-2.5 shrink-0 fill-status-warning text-status-warning"}):e.jsx(c,{className:"w-2.5 h-2.5 shrink-0 fill-status-active text-status-active"})}function E({metadata:a}){const[t,x]=p.useState(!1);if(!a||Object.keys(a).length===0)return e.jsx("span",{className:"text-[11px] text-text-tertiary",children:"—"});const r=Object.keys(a),m=`${r.slice(0,2).join(", ")}${r.length>2?` +${r.length-2}`:""}`;return e.jsxs("div",{className:"w-full",children:[e.jsxs("button",{onClick:i=>{i.stopPropagation(),x(d=>!d)},className:`inline-flex max-w-full items-center gap-1 font-mono text-[11px] ${l}`,title:t?"Collapse metadata":"Expand metadata",children:[e.jsx(P,{className:`h-3 w-3 shrink-0 transition-transform ${t?"rotate-90":""}`}),e.jsx("span",{className:"truncate",children:`{ ${m} }`})]}),e.jsx("div",{className:`grid transition-[grid-template-rows] duration-200 ease-out ${t?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,children:e.jsx("div",{className:"overflow-hidden",children:e.jsx("div",{className:"mt-1 overflow-x-auto",onClick:i=>i.stopPropagation(),children:e.jsx(k,{data:a,defaultCollapsed:!0})})})})]})}const D=[{key:"description",label:"Summary",render:a=>e.jsxs("div",{className:"flex items-center gap-2 overflow-hidden",children:[e.jsx("span",{className:"shrink-0",children:e.jsx(T,{row:a})}),e.jsx("span",{className:`truncate text-xs ${l}`,children:a.description||a.type})]}),className:"max-w-0"},{key:"workflow_type",label:"Workflow",render:a=>e.jsx(v,{type:a.workflow_type||a.type}),className:"w-40 whitespace-nowrap"},{key:"metadata",label:"Metadata",render:a=>e.jsx(E,{metadata:a.metadata}),className:"w-80 max-w-[19rem] align-top"},{key:"role",label:"Role",render:a=>e.jsx("span",{className:l,children:e.jsx(f,{role:a.role,size:"md",tone:"inherit"})}),className:"w-28"},{key:"priority",label:"Priority",render:a=>e.jsx("span",{className:l,children:e.jsx(j,{priority:a.priority,size:"sm",tone:"inherit"})}),className:"w-14",sortable:!0},{key:"created_time",label:"Created",render:a=>e.jsx("span",{className:`text-[11px] font-mono whitespace-nowrap ${l}`,title:a.created_at,children:b(a.created_at)}),className:"w-40 whitespace-nowrap"},{key:"created_at",label:"Ago",render:a=>e.jsx("span",{className:`text-xs tabular-nums ${l}`,title:a.created_at,children:g(a.created_at)}),className:"w-12 whitespace-nowrap",sortable:!0}],U={key:"expires",label:e.jsx(C,{className:"w-3.5 h-3.5 text-text-tertiary"}),render:a=>a.assigned_until?e.jsx(w,{until:a.assigned_until}):e.jsx("span",{className:"text-xs text-text-tertiary",children:"—"}),className:"w-16 whitespace-nowrap"},S=[{value:"1",label:"P1"},{value:"2",label:"P2"},{value:"3",label:"P3"},{value:"4",label:"P4"}],O=[{value:"all",label:"All"},{value:"available",label:"Available"},{value:"claimed",label:"Claimed"},{value:"resolved",label:"Resolved"},{value:"cancelled",label:"Cancelled"},{value:"expired",label:"Expired"}];function W({filters:a,setFilter:t,roles:x,types:r,showStatus:m=!1,showSearch:i=!0,actions:d}){return e.jsxs(u,{actions:d,children:[m&&e.jsxs(e.Fragment,{children:[e.jsx(n,{label:"Status",value:a.status??"",onChange:s=>t("status",s),options:O}),e.jsx(o,{})]}),e.jsx(n,{label:"Role",value:a.role,onChange:s=>t("role",s),options:x.map(s=>({value:s,label:s}))}),e.jsx(o,{}),e.jsx(n,{label:"Type",value:a.type,onChange:s=>t("type",s),options:r.map(s=>({value:s,label:s}))}),e.jsx(o,{}),e.jsx(n,{label:"Priority",value:a.priority,onChange:s=>t("priority",s),options:S}),i&&e.jsxs(e.Fragment,{children:[e.jsx(o,{}),e.jsx(h,{label:"Search",value:a.search??"",onChange:s=>t("search",s),placeholder:"ID, workflow, origin…"})]})]})}export{D as E,U as T,W as a};
2
+ //# sourceMappingURL=escalation-columns-DU4Jyxxo.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"escalation-columns-BlJOswRx.js","sources":["../../src/pages/operator/escalation-columns.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { Circle, Bell, Clock, ChevronRight } from 'lucide-react';\nimport type { Column } from '../../components/common/data/DataTable';\nimport { FilterBar, FilterSelect, FilterInput, FilterDivider } from '../../components/common/data/FilterBar';\nimport { PriorityBadge } from '../../components/common/display/PriorityBadge';\nimport { RolePill } from '../../components/common/display/RolePill';\nimport { WorkflowPill } from '../../components/common/display/WorkflowPill';\nimport { CountdownTimer } from '../../components/common/display/CountdownTimer';\nimport { JsonViewer } from '../../components/common/data/JsonViewer';\nimport { formatAgoCompact, formatDateTime } from '../../lib/format';\nimport { isEffectivelyClaimed, isAckEscalation } from '../../lib/escalation';\nimport type { LTEscalationRecord } from '../../api/types';\n\n// Shared cell text: a consistent resting shade for every cell, sharpening to\n// the primary text colour when the row is hovered. Cells (and pills via their\n// `inherit` tone) all read this single source so the whole row darkens as one.\nconst CELL_TEXT = 'text-text-secondary transition-colors group-hover/row:text-text-primary';\n\n/** Status dot — rendered inline before summary. */\nfunction StatusDot({ row }: { row: LTEscalationRecord }) {\n if (isAckEscalation(row)) {\n const color = row.status === 'resolved' ? 'text-status-success' : 'text-text-tertiary';\n return <Bell className={`w-3 h-3 shrink-0 ${color}`} />;\n }\n if (row.status === 'resolved') {\n return <Circle className=\"w-2.5 h-2.5 shrink-0 fill-status-success text-status-success\" />;\n }\n if (row.status === 'cancelled') {\n return <Circle className=\"w-2.5 h-2.5 shrink-0 fill-status-error text-status-error\" />;\n }\n if (isEffectivelyClaimed(row)) {\n return <Circle className=\"w-2.5 h-2.5 shrink-0 fill-status-warning text-status-warning\" />;\n }\n // pending (unclaimed)\n return <Circle className=\"w-2.5 h-2.5 shrink-0 fill-status-active text-status-active\" />;\n}\n\n/**\n * Metadata cell — a compact `{ key, key +N }` preview that expands inline to the\n * pretty-printed JSON. The same metadata the faceted query filters on, visible per row.\n */\nfunction MetadataCell({ metadata }: { metadata: Record<string, unknown> | null }) {\n const [open, setOpen] = useState(false);\n if (!metadata || Object.keys(metadata).length === 0) {\n return <span className=\"text-[11px] text-text-tertiary\">—</span>;\n }\n const keys = Object.keys(metadata);\n const preview = `${keys.slice(0, 2).join(', ')}${keys.length > 2 ? ` +${keys.length - 2}` : ''}`;\n // Width is fixed by the wrapper so toggling never changes the column width —\n // the JSON viewer reveals with an animated row-height transition, and long\n // lines scroll horizontally inside the cell rather than widening it.\n return (\n <div className=\"w-full\">\n <button\n onClick={(e) => { e.stopPropagation(); setOpen((v) => !v); }}\n className={`inline-flex max-w-full items-center gap-1 font-mono text-[11px] ${CELL_TEXT}`}\n title={open ? 'Collapse metadata' : 'Expand metadata'}\n >\n <ChevronRight className={`h-3 w-3 shrink-0 transition-transform ${open ? 'rotate-90' : ''}`} />\n <span className=\"truncate\">{`{ ${preview} }`}</span>\n </button>\n <div\n className={`grid transition-[grid-template-rows] duration-200 ease-out ${open ? 'grid-rows-[1fr]' : 'grid-rows-[0fr]'}`}\n >\n <div className=\"overflow-hidden\">\n <div className=\"mt-1 overflow-x-auto\" onClick={(e) => e.stopPropagation()}>\n {/* defaultCollapsed → root expanded, nested objects collapsed (one level). */}\n <JsonViewer data={metadata} defaultCollapsed />\n </div>\n </div>\n </div>\n </div>\n );\n}\n\n/** Base columns shared by all escalation list pages. */\nexport const ESCALATION_COLUMNS: Column<LTEscalationRecord>[] = [\n {\n key: 'description',\n label: 'Summary',\n render: (row) => (\n <div className=\"flex items-center gap-2 overflow-hidden\">\n <span className=\"shrink-0\"><StatusDot row={row} /></span>\n <span className={`truncate text-xs ${CELL_TEXT}`}>{row.description || row.type}</span>\n </div>\n ),\n className: 'max-w-0',\n },\n {\n key: 'workflow_type',\n label: 'Workflow',\n // The workflow function name (e.g. `richForm`, `basicSignal`) lives in\n // workflow_type; `type` is the escalation category. Fall back to type for\n // standalone escalations with no workflow.\n render: (row) => <WorkflowPill type={row.workflow_type || row.type} />,\n className: 'w-40 whitespace-nowrap',\n },\n {\n key: 'metadata',\n label: 'Metadata',\n render: (row) => <MetadataCell metadata={row.metadata} />,\n // Fixed width — never grows on expand (the viewer reveals via row-height).\n // Given extra room (borrowed from priority/ago/actions) so JSON wraps less.\n className: 'w-80 max-w-[19rem] align-top',\n },\n {\n key: 'role',\n label: 'Role',\n render: (row) => (\n <span className={CELL_TEXT}>\n <RolePill role={row.role} size=\"md\" tone=\"inherit\" />\n </span>\n ),\n className: 'w-28',\n },\n {\n key: 'priority',\n label: 'Priority',\n render: (row) => (\n <span className={CELL_TEXT}>\n <PriorityBadge priority={row.priority} size=\"sm\" tone=\"inherit\" />\n </span>\n ),\n className: 'w-14',\n sortable: true,\n },\n {\n key: 'created_time',\n label: 'Created',\n render: (row) => (\n <span className={`text-[11px] font-mono whitespace-nowrap ${CELL_TEXT}`} title={row.created_at}>\n {formatDateTime(row.created_at)}\n </span>\n ),\n className: 'w-40 whitespace-nowrap',\n },\n {\n key: 'created_at',\n label: 'Ago',\n render: (row) => (\n <span className={`text-xs tabular-nums ${CELL_TEXT}`} title={row.created_at}>\n {formatAgoCompact(row.created_at)}\n </span>\n ),\n className: 'w-12 whitespace-nowrap',\n sortable: true,\n },\n];\n\n/** Time-remaining column for claimed escalations — aligns with checkbox column on All Escalations. */\nexport const TIME_LEFT_COLUMN: Column<LTEscalationRecord> = {\n key: 'expires',\n label: (<Clock className=\"w-3.5 h-3.5 text-text-tertiary\" />) as any,\n render: (row) =>\n row.assigned_until ? (\n <CountdownTimer until={row.assigned_until} />\n ) : (\n <span className=\"text-xs text-text-tertiary\">—</span>\n ),\n className: 'w-16 whitespace-nowrap',\n};\n\n/** Status icon column — color-coded filled circle, or bell for ACK/notification escalations. */\nexport const STATUS_COLUMN: Column<LTEscalationRecord> = {\n key: 'status',\n label: '',\n render: (row) => {\n if (isAckEscalation(row)) {\n const color = row.status === 'resolved' ? 'text-status-success' : 'text-text-tertiary';\n return <Bell className={`w-3 h-3 ${color}`} />;\n }\n if (row.status === 'resolved') {\n return <Circle className=\"w-2.5 h-2.5 fill-status-success text-status-success\" />;\n }\n if (isEffectivelyClaimed(row)) {\n return <Circle className=\"w-2.5 h-2.5 fill-status-warning text-status-warning\" />;\n }\n // pending (unclaimed)\n return <Circle className=\"w-2.5 h-2.5 fill-text-tertiary text-text-tertiary\" />;\n },\n className: 'w-8',\n};\n\n/** Claimed-only status icon (always orange, or bell for ACK). */\nexport const CLAIMED_STATUS_COLUMN: Column<LTEscalationRecord> = {\n key: 'status',\n label: '',\n render: (row) =>\n isAckEscalation(row)\n ? <Bell className=\"w-3 h-3 text-status-warning\" />\n : <Circle className=\"w-2.5 h-2.5 fill-status-warning text-status-warning\" />,\n className: 'w-8',\n};\n\n/** Priority filter options shared by both pages. */\nexport const PRIORITY_OPTIONS = [\n { value: '1', label: 'P1' },\n { value: '2', label: 'P2' },\n { value: '3', label: 'P3' },\n { value: '4', label: 'P4' },\n];\n\n/** Status filter options for escalation list pages. `all` spans every status so a\n * metadata search (e.g. one order id) returns its escalations regardless of status. */\nexport const STATUS_OPTIONS = [\n { value: 'all', label: 'All' },\n { value: 'available', label: 'Available' },\n { value: 'claimed', label: 'Claimed' },\n { value: 'resolved', label: 'Resolved' },\n { value: 'cancelled', label: 'Cancelled' },\n { value: 'expired', label: 'Expired' },\n];\n\n/** Shared filter bar for escalation list pages. */\nexport function EscalationFilterBar({\n filters,\n setFilter,\n roles,\n types,\n showStatus = false,\n showSearch = true,\n actions,\n}: {\n filters: { role: string; type: string; priority: string; status?: string; search?: string };\n setFilter: (key: any, value: string) => void;\n roles: string[];\n types: string[];\n showStatus?: boolean;\n // Free-text search lives here by default, but the faceted page folds it into\n // the drawer instead so there's a single search surface.\n showSearch?: boolean;\n actions?: React.ReactNode;\n}) {\n return (\n <FilterBar actions={actions}>\n {showStatus && (\n <>\n <FilterSelect\n label=\"Status\"\n value={filters.status ?? ''}\n onChange={(v) => setFilter('status', v)}\n options={STATUS_OPTIONS}\n />\n <FilterDivider />\n </>\n )}\n <FilterSelect\n label=\"Role\"\n value={filters.role}\n onChange={(v) => setFilter('role', v)}\n options={roles.map((r) => ({ value: r, label: r }))}\n />\n <FilterDivider />\n <FilterSelect\n label=\"Type\"\n value={filters.type}\n onChange={(v) => setFilter('type', v)}\n options={types.map((t) => ({ value: t, label: t }))}\n />\n <FilterDivider />\n <FilterSelect\n label=\"Priority\"\n value={filters.priority}\n onChange={(v) => setFilter('priority', v)}\n options={PRIORITY_OPTIONS}\n />\n {showSearch && (\n <>\n <FilterDivider />\n <FilterInput\n label=\"Search\"\n value={filters.search ?? ''}\n onChange={(v) => setFilter('search', v)}\n placeholder=\"ID, workflow, origin…\"\n />\n </>\n )}\n </FilterBar>\n );\n}\n"],"names":["CELL_TEXT","StatusDot","row","isAckEscalation","color","jsx","Bell","Circle","isEffectivelyClaimed","MetadataCell","metadata","open","setOpen","useState","keys","preview","jsxs","e","v","ChevronRight","JsonViewer","ESCALATION_COLUMNS","WorkflowPill","RolePill","PriorityBadge","formatDateTime","formatAgoCompact","TIME_LEFT_COLUMN","Clock","CountdownTimer","PRIORITY_OPTIONS","STATUS_OPTIONS","EscalationFilterBar","filters","setFilter","roles","types","showStatus","showSearch","actions","FilterBar","Fragment","FilterSelect","FilterDivider","r","t","FilterInput"],"mappings":"ybAgBA,MAAMA,EAAY,0EAGlB,SAASC,EAAU,CAAE,IAAAC,GAAoC,CACvD,GAAIC,EAAgBD,CAAG,EAAG,CACxB,MAAME,EAAQF,EAAI,SAAW,WAAa,sBAAwB,qBAClE,OAAOG,EAAAA,IAACC,EAAA,CAAK,UAAW,oBAAoBF,CAAK,GAAI,CACvD,CACA,OAAIF,EAAI,SAAW,WACVG,EAAAA,IAACE,EAAA,CAAO,UAAU,8DAAA,CAA+D,EAEtFL,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MAAOA,EAAG,MAAOA,GAAI,CAAA,CAAA,QAEnDD,EAAA,EAAc,EACftC,EAAAA,IAACqC,EAAA,CACC,MAAM,OACN,MAAOT,EAAQ,KACf,SAAWf,GAAMgB,EAAU,OAAQhB,CAAC,EACpC,QAASkB,EAAM,IAAKS,IAAO,CAAE,MAAOA,EAAG,MAAOA,GAAI,CAAA,CAAA,QAEnDF,EAAA,EAAc,EACftC,EAAAA,IAACqC,EAAA,CACC,MAAM,WACN,MAAOT,EAAQ,SACf,SAAWf,GAAMgB,EAAU,WAAYhB,CAAC,EACxC,QAASY,CAAA,CAAA,EAEVQ,GACCtB,EAAAA,KAAAyB,WAAA,CACE,SAAA,CAAApC,EAAAA,IAACsC,EAAA,EAAc,EACftC,EAAAA,IAACyC,EAAA,CACC,MAAM,SACN,MAAOb,EAAQ,QAAU,GACzB,SAAWf,GAAMgB,EAAU,SAAUhB,CAAC,EACtC,YAAY,uBAAA,CAAA,CACd,CAAA,CACF,CAAA,EAEJ,CAEJ"}
1
+ {"version":3,"file":"escalation-columns-DU4Jyxxo.js","sources":["../../src/pages/operator/escalation-columns.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { Circle, Bell, Clock, ChevronRight } from 'lucide-react';\nimport type { Column } from '../../components/common/data/DataTable';\nimport { FilterBar, FilterSelect, FilterInput, FilterDivider } from '../../components/common/data/FilterBar';\nimport { PriorityBadge } from '../../components/common/display/PriorityBadge';\nimport { RolePill } from '../../components/common/display/RolePill';\nimport { WorkflowPill } from '../../components/common/display/WorkflowPill';\nimport { CountdownTimer } from '../../components/common/display/CountdownTimer';\nimport { JsonViewer } from '../../components/common/data/JsonViewer';\nimport { formatAgoCompact, formatDateTime } from '../../lib/format';\nimport { isEffectivelyClaimed, isAckEscalation } from '../../lib/escalation';\nimport type { LTEscalationRecord } from '../../api/types';\n\n// Shared cell text: a consistent resting shade for every cell, sharpening to\n// the primary text colour when the row is hovered. Cells (and pills via their\n// `inherit` tone) all read this single source so the whole row darkens as one.\nconst CELL_TEXT = 'text-text-secondary transition-colors group-hover/row:text-text-primary';\n\n/** Status dot — rendered inline before summary. */\nfunction StatusDot({ row }: { row: LTEscalationRecord }) {\n if (isAckEscalation(row)) {\n const color = row.status === 'resolved' ? 'text-status-success' : 'text-text-tertiary';\n return <Bell className={`w-3 h-3 shrink-0 ${color}`} />;\n }\n if (row.status === 'resolved') {\n return <Circle className=\"w-2.5 h-2.5 shrink-0 fill-status-success text-status-success\" />;\n }\n if (row.status === 'cancelled') {\n return <Circle className=\"w-2.5 h-2.5 shrink-0 fill-status-error text-status-error\" />;\n }\n if (isEffectivelyClaimed(row)) {\n return <Circle className=\"w-2.5 h-2.5 shrink-0 fill-status-warning text-status-warning\" />;\n }\n // pending (unclaimed)\n return <Circle className=\"w-2.5 h-2.5 shrink-0 fill-status-active text-status-active\" />;\n}\n\n/**\n * Metadata cell — a compact `{ key, key +N }` preview that expands inline to the\n * pretty-printed JSON. The same metadata the faceted query filters on, visible per row.\n */\nfunction MetadataCell({ metadata }: { metadata: Record<string, unknown> | null }) {\n const [open, setOpen] = useState(false);\n if (!metadata || Object.keys(metadata).length === 0) {\n return <span className=\"text-[11px] text-text-tertiary\">—</span>;\n }\n const keys = Object.keys(metadata);\n const preview = `${keys.slice(0, 2).join(', ')}${keys.length > 2 ? ` +${keys.length - 2}` : ''}`;\n // Width is fixed by the wrapper so toggling never changes the column width —\n // the JSON viewer reveals with an animated row-height transition, and long\n // lines scroll horizontally inside the cell rather than widening it.\n return (\n <div className=\"w-full\">\n <button\n onClick={(e) => { e.stopPropagation(); setOpen((v) => !v); }}\n className={`inline-flex max-w-full items-center gap-1 font-mono text-[11px] ${CELL_TEXT}`}\n title={open ? 'Collapse metadata' : 'Expand metadata'}\n >\n <ChevronRight className={`h-3 w-3 shrink-0 transition-transform ${open ? 'rotate-90' : ''}`} />\n <span className=\"truncate\">{`{ ${preview} }`}</span>\n </button>\n <div\n className={`grid transition-[grid-template-rows] duration-200 ease-out ${open ? 'grid-rows-[1fr]' : 'grid-rows-[0fr]'}`}\n >\n <div className=\"overflow-hidden\">\n <div className=\"mt-1 overflow-x-auto\" onClick={(e) => e.stopPropagation()}>\n {/* defaultCollapsed → root expanded, nested objects collapsed (one level). */}\n <JsonViewer data={metadata} defaultCollapsed />\n </div>\n </div>\n </div>\n </div>\n );\n}\n\n/** Base columns shared by all escalation list pages. */\nexport const ESCALATION_COLUMNS: Column<LTEscalationRecord>[] = [\n {\n key: 'description',\n label: 'Summary',\n render: (row) => (\n <div className=\"flex items-center gap-2 overflow-hidden\">\n <span className=\"shrink-0\"><StatusDot row={row} /></span>\n <span className={`truncate text-xs ${CELL_TEXT}`}>{row.description || row.type}</span>\n </div>\n ),\n className: 'max-w-0',\n },\n {\n key: 'workflow_type',\n label: 'Workflow',\n // The workflow function name (e.g. `richForm`, `basicSignal`) lives in\n // workflow_type; `type` is the escalation category. Fall back to type for\n // standalone escalations with no workflow.\n render: (row) => <WorkflowPill type={row.workflow_type || row.type} />,\n className: 'w-40 whitespace-nowrap',\n },\n {\n key: 'metadata',\n label: 'Metadata',\n render: (row) => <MetadataCell metadata={row.metadata} />,\n // Fixed width — never grows on expand (the viewer reveals via row-height).\n // Given extra room (borrowed from priority/ago/actions) so JSON wraps less.\n className: 'w-80 max-w-[19rem] align-top',\n },\n {\n key: 'role',\n label: 'Role',\n render: (row) => (\n <span className={CELL_TEXT}>\n <RolePill role={row.role} size=\"md\" tone=\"inherit\" />\n </span>\n ),\n className: 'w-28',\n },\n {\n key: 'priority',\n label: 'Priority',\n render: (row) => (\n <span className={CELL_TEXT}>\n <PriorityBadge priority={row.priority} size=\"sm\" tone=\"inherit\" />\n </span>\n ),\n className: 'w-14',\n sortable: true,\n },\n {\n key: 'created_time',\n label: 'Created',\n render: (row) => (\n <span className={`text-[11px] font-mono whitespace-nowrap ${CELL_TEXT}`} title={row.created_at}>\n {formatDateTime(row.created_at)}\n </span>\n ),\n className: 'w-40 whitespace-nowrap',\n },\n {\n key: 'created_at',\n label: 'Ago',\n render: (row) => (\n <span className={`text-xs tabular-nums ${CELL_TEXT}`} title={row.created_at}>\n {formatAgoCompact(row.created_at)}\n </span>\n ),\n className: 'w-12 whitespace-nowrap',\n sortable: true,\n },\n];\n\n/** Time-remaining column for claimed escalations — aligns with checkbox column on All Escalations. */\nexport const TIME_LEFT_COLUMN: Column<LTEscalationRecord> = {\n key: 'expires',\n label: (<Clock className=\"w-3.5 h-3.5 text-text-tertiary\" />) as any,\n render: (row) =>\n row.assigned_until ? (\n <CountdownTimer until={row.assigned_until} />\n ) : (\n <span className=\"text-xs text-text-tertiary\">—</span>\n ),\n className: 'w-16 whitespace-nowrap',\n};\n\n/** Status icon column — color-coded filled circle, or bell for ACK/notification escalations. */\nexport const STATUS_COLUMN: Column<LTEscalationRecord> = {\n key: 'status',\n label: '',\n render: (row) => {\n if (isAckEscalation(row)) {\n const color = row.status === 'resolved' ? 'text-status-success' : 'text-text-tertiary';\n return <Bell className={`w-3 h-3 ${color}`} />;\n }\n if (row.status === 'resolved') {\n return <Circle className=\"w-2.5 h-2.5 fill-status-success text-status-success\" />;\n }\n if (isEffectivelyClaimed(row)) {\n return <Circle className=\"w-2.5 h-2.5 fill-status-warning text-status-warning\" />;\n }\n // pending (unclaimed)\n return <Circle className=\"w-2.5 h-2.5 fill-text-tertiary text-text-tertiary\" />;\n },\n className: 'w-8',\n};\n\n/** Claimed-only status icon (always orange, or bell for ACK). */\nexport const CLAIMED_STATUS_COLUMN: Column<LTEscalationRecord> = {\n key: 'status',\n label: '',\n render: (row) =>\n isAckEscalation(row)\n ? <Bell className=\"w-3 h-3 text-status-warning\" />\n : <Circle className=\"w-2.5 h-2.5 fill-status-warning text-status-warning\" />,\n className: 'w-8',\n};\n\n/** Priority filter options shared by both pages. */\nexport const PRIORITY_OPTIONS = [\n { value: '1', label: 'P1' },\n { value: '2', label: 'P2' },\n { value: '3', label: 'P3' },\n { value: '4', label: 'P4' },\n];\n\n/** Status filter options for escalation list pages. `all` spans every status so a\n * metadata search (e.g. one order id) returns its escalations regardless of status. */\nexport const STATUS_OPTIONS = [\n { value: 'all', label: 'All' },\n { value: 'available', label: 'Available' },\n { value: 'claimed', label: 'Claimed' },\n { value: 'resolved', label: 'Resolved' },\n { value: 'cancelled', label: 'Cancelled' },\n { value: 'expired', label: 'Expired' },\n];\n\n/** Shared filter bar for escalation list pages. */\nexport function EscalationFilterBar({\n filters,\n setFilter,\n roles,\n types,\n showStatus = false,\n showSearch = true,\n actions,\n}: {\n filters: { role: string; type: string; priority: string; status?: string; search?: string };\n setFilter: (key: any, value: string) => void;\n roles: string[];\n types: string[];\n showStatus?: boolean;\n // Free-text search lives here by default, but the faceted page folds it into\n // the drawer instead so there's a single search surface.\n showSearch?: boolean;\n actions?: React.ReactNode;\n}) {\n return (\n <FilterBar actions={actions}>\n {showStatus && (\n <>\n <FilterSelect\n label=\"Status\"\n value={filters.status ?? ''}\n onChange={(v) => setFilter('status', v)}\n options={STATUS_OPTIONS}\n />\n <FilterDivider />\n </>\n )}\n <FilterSelect\n label=\"Role\"\n value={filters.role}\n onChange={(v) => setFilter('role', v)}\n options={roles.map((r) => ({ value: r, label: r }))}\n />\n <FilterDivider />\n <FilterSelect\n label=\"Type\"\n value={filters.type}\n onChange={(v) => setFilter('type', v)}\n options={types.map((t) => ({ value: t, label: t }))}\n />\n <FilterDivider />\n <FilterSelect\n label=\"Priority\"\n value={filters.priority}\n onChange={(v) => setFilter('priority', v)}\n options={PRIORITY_OPTIONS}\n />\n {showSearch && (\n <>\n <FilterDivider />\n <FilterInput\n label=\"Search\"\n value={filters.search ?? ''}\n onChange={(v) => setFilter('search', v)}\n placeholder=\"ID, workflow, origin…\"\n />\n </>\n )}\n </FilterBar>\n );\n}\n"],"names":["CELL_TEXT","StatusDot","row","isAckEscalation","color","jsx","Bell","Circle","isEffectivelyClaimed","MetadataCell","metadata","open","setOpen","useState","keys","preview","jsxs","e","v","ChevronRight","JsonViewer","ESCALATION_COLUMNS","WorkflowPill","RolePill","PriorityBadge","formatDateTime","formatAgoCompact","TIME_LEFT_COLUMN","Clock","CountdownTimer","PRIORITY_OPTIONS","STATUS_OPTIONS","EscalationFilterBar","filters","setFilter","roles","types","showStatus","showSearch","actions","FilterBar","Fragment","FilterSelect","FilterDivider","r","t","FilterInput"],"mappings":"ybAgBA,MAAMA,EAAY,0EAGlB,SAASC,EAAU,CAAE,IAAAC,GAAoC,CACvD,GAAIC,EAAgBD,CAAG,EAAG,CACxB,MAAME,EAAQF,EAAI,SAAW,WAAa,sBAAwB,qBAClE,OAAOG,EAAAA,IAACC,EAAA,CAAK,UAAW,oBAAoBF,CAAK,GAAI,CACvD,CACA,OAAIF,EAAI,SAAW,WACVG,EAAAA,IAACE,EAAA,CAAO,UAAU,8DAAA,CAA+D,EAEtFL,EAAI,SAAW,YACVG,EAAAA,IAACE,EAAA,CAAO,UAAU,0DAAA,CAA2D,EAElFC,EAAqBN,CAAG,EACnBG,EAAAA,IAACE,EAAA,CAAO,UAAU,8DAAA,CAA+D,EAGnFF,EAAAA,IAACE,EAAA,CAAO,UAAU,4DAAA,CAA6D,CACxF,CAMA,SAASE,EAAa,CAAE,SAAAC,GAA0D,CAChF,KAAM,CAACC,EAAMC,CAAO,EAAIC,EAAAA,SAAS,EAAK,EACtC,GAAI,CAACH,GAAY,OAAO,KAAKA,CAAQ,EAAE,SAAW,EAChD,OAAOL,EAAAA,IAAC,OAAA,CAAK,UAAU,iCAAiC,SAAA,IAAC,EAE3D,MAAMS,EAAO,OAAO,KAAKJ,CAAQ,EAC3BK,EAAU,GAAGD,EAAK,MAAM,EAAG,CAAC,EAAE,KAAK,IAAI,CAAC,GAAGA,EAAK,OAAS,EAAI,KAAKA,EAAK,OAAS,CAAC,GAAK,EAAE,GAI9F,OACEE,EAAAA,KAAC,MAAA,CAAI,UAAU,SACb,SAAA,CAAAA,EAAAA,KAAC,SAAA,CACC,QAAUC,GAAM,CAAEA,EAAE,gBAAA,EAAmBL,EAASM,GAAM,CAACA,CAAC,CAAG,E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C,EACA,MAAAC,EACA,MAAAC,EACA,WAAAC,EAAa,GACb,WAAAC,EAAa,GACb,QAAAC,CACF,EAUG,CACD,OACEvB,OAACwB,GAAU,QAAAD,EACR,SAAA,CAAAF,GACCrB,EAAAA,KAAAyB,WAAA,CACE,SAAA,CAAApC,EAAAA,IAACqC,EAAA,CACC,MAAM,SACN,MAAOT,EAAQ,QAAU,GACzB,SAAWf,GAAMgB,EAAU,SAAUhB,CAAC,EACtC,QAASa,CAAA,CAAA,QAEVY,EAAA,CAAA,CAAc,CAAA,EACjB,EAEFtC,EAAAA,IAACqC,EAAA,CACC,MAAM,OACN,MAAOT,EAAQ,KACf,SAAWf,GAAMgB,EAAU,OAAQhB,CAAC,EACpC,QAASiB,EAAM,IAAKS,IAAO,CAAE,MAAOA,EAAG,MAAOA,GAAI,CAAA,CAAA,QAEnDD,EAAA,EAAc,EACftC,EAAAA,IAACqC,EAAA,CACC,MAAM,OACN,MAAOT,EAAQ,KACf,SAAWf,GAAMgB,EAAU,OAAQhB,CAAC,EACpC,QAASkB,EAAM,IAAKS,IAAO,CAAE,MAAOA,EAAG,MAAOA,GAAI,CAAA,CAAA,QAEnDF,EAAA,EAAc,EACftC,EAAAA,IAACqC,EAAA,CACC,MAAM,WACN,MAAOT,EAAQ,SACf,SAAWf,GAAMgB,EAAU,WAAYhB,CAAC,EACxC,QAASY,CAAA,CAAA,EAEVQ,GACCtB,EAAAA,KAAAyB,WAAA,CACE,SAAA,CAAApC,EAAAA,IAACsC,EAAA,EAAc,EACftC,EAAAA,IAACyC,EAAA,CACC,MAAM,SACN,MAAOb,EAAQ,QAAU,GACzB,SAAWf,GAAMgB,EAAU,SAAUhB,CAAC,EACtC,YAAY,uBAAA,CAAA,CACd,CAAA,CACF,CAAA,EAEJ,CAEJ"}
@@ -1,2 +1,2 @@
1
- import{a as i,j as e}from"./vendor-query-B2UbickB.js";import{P as ye}from"./PageHeaderWithStats-yex5WmHB.js";import{F as we,b as ke}from"./FilterBar-BQ2JGg8U.js";import{u as Ne}from"./useFilterParams-x-Dg0Vgz.js";import{u as ve}from"./useNamespace-C88ZxGoX.js";import{a as ee,u as Ce,b as $e,c as Se,d as _e}from"./controlplane-B7VJTlZD.js";import{M as Te}from"./Modal-CSrxpXeM.js";import{O as K,ay as U,P as Ee,az as Z,aA as J,o as te,I as Re,aB as Me,a6 as Pe,R as Ae,y as Le,aC as We,E as Qe,Z as Fe,au as Oe}from"./vendor-icons-CEWCGPeJ.js";import{C as I}from"./CollapsibleSection-Cx99mqNN.js";import{T as Be}from"./TaskQueuePill-Lgn2obNU.js";import{D as ze}from"./DataTable-ZWgVQg7F.js";import{C as W,c as Ie,J as Je}from"./index-Dgw1KKpq.js";import{R as De,a as Y}from"./RowActions-BA9L9djf.js";import{f as Ue}from"./vendor-react-CXumBFUA.js";import"./EmptyState-BcsfPq9T.js";const Ve=[{label:"15m",value:"15m"},{label:"30m",value:"30m"},{label:"1h",value:"1h"},{label:"1d",value:"1d"},{label:"7d",value:"7d"}],se={pong:"text-status-success",ping:"text-accent",throttle:"text-status-warning",job:"text-purple-400",work:"text-text-secondary",activate:"text-status-error",cron:"text-text-tertiary",user:"text-text-secondary"},He={pong:"roll call",ping:"ping",throttle:"throttle",job:"job",work:"work",activate:"activate",cron:"cron",user:"user"},qe=250;function M(t){return!!t.worker_topic}function P(t){return typeof t.throttle=="number"&&t.throttle!==0}function V(t){return t===void 0||t===0?"Normal":t===-1?"Paused":t>=864e5?`${(t/864e5).toFixed(0)}d`:t>=36e5?`${(t/36e5).toFixed(1)}h`:t>=6e4?`${(t/6e4).toFixed(1)}m`:t>=1e3?`${(t/1e3).toFixed(1)}s`:`${t}ms`}function Ge(t){if(!t)return null;const s=t.match(/^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})\.(\d+)$/);if(s){const[,r,n,o,u,l,m,d]=s;return new Date(`${r}-${n}-${o}T${u}:${l}:${m}.${d}Z`)}const a=new Date(t);return isNaN(a.getTime())?null:a}function Ke(t){const s=Ge(t);if(!s)return"--";const a=Date.now()-s.getTime();if(a<0||isNaN(a))return"--";const r=Math.floor(a/1e3);if(r<60)return`${r}s`;const n=Math.floor(r/60);if(n<60)return`${n}m`;const o=Math.floor(n/60);return o<24?`${o}h ${n%60}m`:`${Math.floor(o/24)}d ${o%24}h`}function ne(t){return t.replace(/^hmsh:[^:]+:x:/,"")||"(engine)"}function F(t){const s=t.match(/^([^:]+)::(.+?)-[A-Za-z0-9_]{10,}$/);return s?s[2]:t.length>20?t.slice(0,20)+"...":t}function Ze(t){const s=t.match(/^([^:]+)::/);return(s==null?void 0:s[1])||""}const re=[{key:"pong",label:"Roll Call",description:"Node health check responses"},{key:"ping",label:"Ping",description:"Health check broadcasts"},{key:"throttle",label:"Throttle",description:"Throttle commands"},{key:"job",label:"Job",description:"Job lifecycle events"},{key:"work",label:"Work",description:"Worker dispatch events"},{key:"activate",label:"Activate",description:"Worker activation"},{key:"cron",label:"Cron",description:"Cron schedule triggers"},{key:"user",label:"User",description:"User-defined messages"}];function B(t){return`${t.engine_id}-${t.worker_topic||"engine"}`}function Ye(t){const s=new Map;for(const a of t){if(!a.worker_topic)continue;const r=a.worker_topic;s.has(r)||s.set(r,[]),s.get(r).push(a)}return s}function T(t){let s=0,a=0,r=0;for(const n of t)if(n.counts)for(const[o,u]of Object.entries(n.counts))s+=u,o==="200"?a+=u:o==="500"&&(r+=u);return{total:s,success:a,errors:r}}function Xe(t){let s=0;for(const a of t)typeof a.stream_depth=="number"&&(s+=a.stream_depth);return s}function et(t){if(t.length===0)return"healthy";if(t.every(r=>r.throttle===-1))return"paused";const{errors:a}=T(t);return a>0||t.some(P)?"degraded":"healthy"}function tt({activeAppId:t,allProfiles:s,profiles:a}){const r=ee(),[n,o]=i.useState(new Set),[u,l]=i.useState(!1),[m,d]=i.useState([]);i.useEffect(()=>{o(new Set)},[t]);const k=i.useCallback(p=>{o(C=>{const f=new Set(C),$=B(p);return f.has($)?f.delete($):f.add($),f})},[]),b=i.useCallback(()=>{n.size===a.length?o(new Set):o(new Set(a.map(B)))},[a,n.size]),j=i.useMemo(()=>{const p=a.filter(N=>n.has(B(N)));if(p.length===0)return[];if(p.length===s.length)return[{label:"Entire Mesh"}];const C=p.filter(N=>!M(N)),f=p.filter(M),$=[];for(const N of C)$.push({label:`Engine ${N.engine_id}`,guid:N.engine_id,scope:"engines"});const A=new Map;for(const N of f){const R=N.worker_topic;A.has(R)||A.set(R,[]),A.get(R).push(N)}for(const[N,R]of A){const O=s.filter(L=>L.worker_topic===N);if(R.length===O.length)$.push({label:N,topic:N});else for(const L of R)$.push({label:`${N} ${L.engine_id}`,guid:L.engine_id})}return $},[a,s,n]);return{selectedIds:n,setSelectedIds:o,toggleCheckbox:k,toggleAll:b,throttleModalOpen:u,throttleTargets:m,selectedThrottleTargets:j,throttleMutation:r,handleBulkThrottle:p=>{const C=m.length>0?m:j;for(const f of C)r.mutate({appId:t,throttle:p,...f.topic?{topic:f.topic}:{},...f.guid?{guid:f.guid}:{},...f.scope?{scope:f.scope}:{}});l(!1),d([])},handleRowClick:(p,C)=>{const f=M(p)?`${p.worker_topic} ${p.engine_id}`:`Engine ${p.engine_id}`;d([{label:f,guid:p.engine_id,scope:C||(M(p)?"workers":"engines")}]),l(!0)},handleBulkThrottleOpen:()=>{d(j),l(!0)},handleResumeThrottle:(p,C)=>{const f=C||(M(p)?"workers":"engines");r.mutate({appId:t,throttle:0,guid:p.engine_id,scope:f})},handleResumeQueue:p=>{r.mutate({appId:t,throttle:0,topic:p})},handleQueueThrottle:p=>{d([{label:p,topic:p}]),l(!0)},closeThrottleModal:()=>{l(!1),d([])}}}const st=[{label:"Resume",ms:0},{label:"0.5s",ms:500},{label:"1s",ms:1e3},{label:"5s",ms:5e3},{label:"30s",ms:3e4},{label:"Pause",ms:-1}];function nt({target:t}){const s=t.label==="Entire Mesh",a=t.label==="All Engines"||t.label.startsWith("Engine "),r=s?"bg-status-error/10 text-status-error":a?"bg-blue-500/10 text-blue-500":"bg-accent/[0.06] text-text-secondary",n=t.scope==="engines"?"engine only":t.scope==="workers"?"worker only":t.guid?"guid":t.topic?"topic":"mesh";return e.jsxs("span",{className:`inline-flex items-center gap-1.5 px-2 py-0.5 text-[10px] font-medium rounded-lg ${r}`,children:[t.label,e.jsx("span",{className:"text-[8px] opacity-50",children:n})]})}function rt({open:t,onClose:s,targets:a,onApply:r,isPending:n}){const[o,u]=i.useState("");return e.jsx(Te,{open:t,onClose:s,title:"Adjust Throttle",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary mb-2",children:"Targets"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:a.map((l,m)=>e.jsx(nt,{target:l},l.guid||l.topic||m))})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary mb-2",children:"Presets"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:st.map(l=>e.jsx("button",{onClick:()=>r(l.ms),disabled:n,className:`px-3 py-1.5 text-xs rounded transition-colors ${l.ms===-1?"bg-status-error/10 text-status-error hover:bg-status-error/20":l.ms===0?"bg-status-success/10 text-status-success hover:bg-status-success/20":"bg-surface-sunken text-text-secondary hover:bg-surface-hover"} disabled:opacity-50`,children:l.label},l.label))})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary mb-2",children:"Custom delay (seconds)"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("input",{type:"number",step:"0.1",min:"0",value:o,onChange:l=>u(l.target.value),placeholder:"e.g. 2.5",className:"input text-xs py-1.5 px-3 w-28"}),e.jsx("button",{onClick:()=>{const l=parseFloat(o);isNaN(l)||l<0||r(Math.round(l*1e3))},disabled:n,className:"btn-primary text-xs py-1.5 px-4 disabled:opacity-50",children:"Apply"})]})]})]})})}function at(){const{data:t}=Ce(),s=ee(),[a,r]=i.useState(null),[n,o]=i.useState(!1),u=(t==null?void 0:t.apps)??[],l=i.useCallback(async(d,k="all")=>{if(u.length===0)return;o(!0);const b=await Promise.allSettled(u.map(v=>s.mutateAsync({appId:v.appId,throttle:d,...k!=="all"?{scope:k}:{}}))),j=b.filter(v=>v.status==="rejected").length;j>0&&console.error(`Emergency throttle: ${j}/${b.length} apps failed`),o(!1),r(null)},[u,s]),m=d=>d==="engines"?"engines":d==="workers"?"workers":"everything";return a?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-xs text-status-error",children:["Pause ",m(a.scope),"?"]}),e.jsx("button",{onClick:()=>l(a.ms,a.scope),disabled:n,className:"px-2.5 py-1 text-xs rounded-md bg-status-error text-white hover:bg-status-error/90 transition-colors disabled:opacity-50",children:n?e.jsx(K,{className:"w-3.5 h-3.5 animate-spin"}):"Confirm"}),e.jsx("button",{onClick:()=>r(null),disabled:n,className:"px-2.5 py-1 text-xs text-text-tertiary hover:text-text-primary transition-colors disabled:opacity-50",children:"Cancel"})]}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>r({ms:-1,scope:"all"}),disabled:n,className:"flex items-center gap-1.5 px-2.5 py-1 text-xs rounded-md text-status-error/80 hover:text-status-error hover:bg-status-error/10 transition-colors disabled:opacity-50",title:"Pause all engines and workers",children:[e.jsx(U,{className:"w-3.5 h-3.5"}),"Pause All"]}),e.jsxs("button",{onClick:()=>l(0),disabled:n,className:"flex items-center gap-1.5 px-2.5 py-1 text-xs rounded-md text-status-success/80 hover:text-status-success hover:bg-status-success/10 transition-colors disabled:opacity-50",title:"Resume all engines and workers",children:[n?e.jsx(K,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(Ee,{className:"w-3.5 h-3.5"}),"Resume All"]})]})}function ot({byStream:t,onNodeFilter:s}){const[a,r]=i.useState(!1);if(i.useEffect(()=>{r(!1);const d=requestAnimationFrame(()=>r(!0));return()=>cancelAnimationFrame(d)},[t]),t.length===0)return e.jsx("p",{className:"text-xs text-text-tertiary py-4 text-center",children:"No activity in this period"});const n=t.filter(d=>d.stream_type==="engine"),o=t.filter(d=>d.stream_type==="worker"),u=Math.max(...t.map(d=>d.count)),l=d=>{const k=u>0?d.count/u*100:0,b=d.stream_type==="engine",j=b?"(all engines)":ne(d.stream_name),v=b?"bg-blue-500/70":"bg-accent/60",y=b?"text-blue-500":"text-text-tertiary";return e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:`text-[9px] font-mono ${y} w-36 truncate text-right shrink-0`,title:d.stream_name,children:j}),e.jsx("div",{className:"flex-1 h-4 bg-surface-sunken rounded overflow-hidden",children:e.jsx("div",{className:`h-full ${v} rounded transition-all duration-500 ease-out`,style:{width:a?`${k}%`:"0%"}})}),e.jsx("span",{className:"text-[10px] font-mono tabular-nums text-text-secondary w-12 text-right shrink-0",children:d.count.toLocaleString()})]},`${d.stream_type}-${d.stream_name}`)},m="text-[9px] uppercase tracking-widest font-semibold mb-1 cursor-pointer hover:underline";return e.jsxs("div",{className:"space-y-1.5",children:[n.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:`${m} text-blue-500/70 hover:text-blue-500`,onClick:()=>s==null?void 0:s("engines"),children:"Engine Stream"}),n.map(l),o.length>0&&e.jsx("div",{className:"h-2"})]}),o.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:`${m} text-accent/70 hover:text-accent`,onClick:()=>s==null?void 0:s("workers"),children:"Worker Streams"}),o.map(l)]})]})}function lt({queue:t,workers:s,expanded:a,onToggle:r,onWorkerClick:n,onResumeThrottle:o,onQueueThrottle:u,onResumeQueue:l,byStream:m,activeDuration:d}){const k=i.useMemo(()=>{const c=m.find(g=>g.stream_type==="worker"&&ne(g.stream_name)===t);return(c==null?void 0:c.count)??0},[m,t]),b=i.useMemo(()=>et(s),[s]),j=i.useMemo(()=>Xe(s),[s]),{errors:v}=i.useMemo(()=>T(s),[s]),y=b==="paused"?"bg-status-error":b==="degraded"?"bg-status-warning":"bg-status-success",x=i.useMemo(()=>[...s].sort((c,g)=>T([g]).total-T([c]).total),[s]),w=i.useMemo(()=>[{key:"engine_id",label:"Router",render:c=>{var p;const g=c.engine_id.replace(/^[^:]+::/,"").replace(/-[A-Za-z0-9_]{10,}$/,"")||c.engine_id,E=((p=c.engine_id.match(/^([^:]+)::/))==null?void 0:p[1])||"";return e.jsxs("div",{className:"flex items-center gap-2",title:c.engine_id,children:[e.jsx("span",{className:"text-xs text-text-secondary truncate max-w-[180px]",children:g}),E&&e.jsx("span",{className:"text-[9px] text-text-tertiary/50",children:E})]})}},{key:"processed",label:"Processed",render:c=>{const g=T([c]);return e.jsx("span",{className:"text-xs font-mono tabular-nums text-text-tertiary",children:g.total>0?g.total.toLocaleString():"--"})},className:"w-24"},{key:"throttle",label:"Throttle",render:c=>{const g=c.throttle;return g===-1?e.jsx("span",{className:"text-xs text-status-error font-medium",children:"Paused"}):g&&g>0?e.jsx("span",{className:"text-xs text-status-warning font-medium",children:V(g)}):e.jsx("span",{className:"text-xs text-text-tertiary",children:"0"})},className:"w-24"},{key:"actions",label:"",render:c=>e.jsxs(De,{children:[P(c)&&e.jsx(Y,{icon:Z,title:"Resume (remove throttle)",onClick:()=>o(c),colorClass:"text-text-tertiary hover:text-status-success"}),e.jsx(Y,{icon:J,title:"Adjust throttle",onClick:()=>n(c)})]}),className:"w-16"}],[n,o]);return e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>r(t),className:"group/row relative flex items-center gap-3 w-full py-2 hover:bg-surface-hover transition-colors text-left rounded",children:[e.jsx("span",{className:`w-2 h-2 rounded-full shrink-0 ${y}`,title:b}),e.jsx(te,{className:`w-3.5 h-3.5 text-text-tertiary/50 transition-transform duration-200 ${a?"rotate-90":""}`,strokeWidth:2}),e.jsx(Be,{queue:t,size:"sm"}),e.jsx("span",{className:"flex-1"}),v>0&&e.jsxs("span",{className:"text-[10px] text-status-error font-medium mr-2",children:[v," errors"]}),j>0&&e.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-status-warning w-20",children:[e.jsx(Re,{className:"w-3 h-3 shrink-0",strokeWidth:1.5}),e.jsx("span",{className:"font-mono tabular-nums",children:j.toLocaleString()})]}),e.jsxs("span",{className:`flex items-center gap-1 text-xs w-24 ${s.some(P)?"text-status-warning":"text-text-tertiary"}`,children:[e.jsx(Me,{className:"w-3 h-3 shrink-0",strokeWidth:1.5}),e.jsx("span",{className:"font-mono tabular-nums",children:s.length}),e.jsx("span",{children:"workers"})]}),e.jsx("span",{className:"flex items-center gap-1 text-xs font-mono text-text-tertiary w-28 justify-end mr-16",children:k>0?e.jsxs(e.Fragment,{children:[e.jsx(Pe,{className:"w-3 h-3 shrink-0",strokeWidth:1.5}),k.toLocaleString()," in ",d]}):e.jsx("span",{className:"text-text-tertiary/40",children:"—"})}),e.jsxs("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 opacity-0 group-hover/row:opacity-100 transition-opacity flex items-center gap-2",children:[s.some(P)&&e.jsx(Z,{className:"w-4 h-4 text-text-tertiary hover:text-status-success",strokeWidth:1.5,onClick:c=>{c.stopPropagation(),l(t)}}),e.jsx(J,{className:"w-4 h-4 text-text-tertiary hover:text-accent",strokeWidth:1.5,onClick:c=>{c.stopPropagation(),u(t)}})]})]}),e.jsx(W,{open:a,children:e.jsx("div",{className:"ml-6",children:e.jsx(ze,{columns:w,data:x,keyFn:B,onRowClick:n,emptyMessage:"No workers",inline:!0})})})]})}let it=0;function ct(t){const s=t.data||{},a=s.topic?String(s.topic):"",r=s.guid?String(s.guid).slice(0,8):"";switch(t.type){case"pong":return a?`Worker ${r}... on "${a}" responded`:`Engine ${r}... responded`;case"ping":return"Roll call broadcast";case"throttle":{const n=s.throttle,o=a?`queue "${a}"`:r?`node ${r}...`:"all nodes";return`${V(n)} applied to ${o}`}case"job":return`Job ${r?r+"...":""} ${s.status||"updated"}`;case"work":return`Dispatched to "${a||"worker"}" ${r?"("+r+"...)":""}`;case"activate":return`Worker "${a||"unknown"}" activated`;case"cron":return`Cron triggered ${a?'"'+a+'"':""}`;default:return a||r||t.type}}function ut(t){const s=[];let a=0;for(;a<t.length;){const r=t[a];if(r.type==="pong"){let n=a+1;for(;n<t.length&&t[n].type==="pong";)n++;const o=t.slice(a,n);if(o.length>=3)s.push({kind:"group",type:"pong",count:o.length,firstTimestamp:o[o.length-1].timestamp,lastTimestamp:o[0].timestamp,events:o});else for(const u of o)s.push({kind:"single",event:u});a=n}else s.push({kind:"single",event:r}),a++}return s}function ae({event:t}){const[s,a]=i.useState(!1);return e.jsxs("div",{className:"border-b border-surface-border/50 last:border-b-0",children:[e.jsxs("button",{onClick:()=>a(!s),className:"flex items-center gap-2 py-1.5 w-full text-left hover:bg-surface-hover/50 transition-colors",children:[e.jsx("span",{className:"text-[9px] font-mono text-text-tertiary whitespace-nowrap tabular-nums shrink-0",children:new Date(t.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}),e.jsx("span",{className:`text-[9px] font-medium px-1 py-0.5 rounded ${se[t.type]||"text-text-tertiary"} bg-surface-sunken whitespace-nowrap shrink-0`,children:He[t.type]||t.type}),e.jsx("span",{className:"text-[9px] text-text-secondary flex-1 min-w-0 truncate",children:ct(t)}),e.jsx("svg",{className:`w-2.5 h-2.5 text-text-tertiary shrink-0 transition-transform duration-150 ${s?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),e.jsx(W,{open:s,children:e.jsx("div",{className:"pb-2",children:e.jsx(Je,{data:t.data})})})]})}function dt({group:t}){const[s,a]=i.useState(!1),r=t.events.filter(o=>{var u;return!((u=o.data)!=null&&u.topic)}).length,n=t.count-r;return e.jsxs("div",{className:"border-b border-surface-border/50 last:border-b-0",children:[e.jsxs("button",{onClick:()=>a(!s),className:"flex items-center gap-2 py-1.5 w-full text-left hover:bg-surface-hover/50 transition-colors",children:[e.jsx("span",{className:"text-[9px] font-mono text-text-tertiary whitespace-nowrap tabular-nums shrink-0",children:new Date(t.lastTimestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}),e.jsx("span",{className:`text-[9px] font-medium px-1 py-0.5 rounded ${se.pong} bg-surface-sunken whitespace-nowrap shrink-0`,children:"roll call"}),e.jsxs("span",{className:"text-[9px] text-text-secondary flex-1 min-w-0 truncate",children:[t.count," nodes responded",r>0&&n>0?` (${r} engine${r!==1?"s":""}, ${n} worker${n!==1?"s":""})`:r>0?` (${r} engine${r!==1?"s":""})`:` (${n} worker${n!==1?"s":""})`]}),e.jsx("svg",{className:`w-2.5 h-2.5 text-text-tertiary shrink-0 transition-transform duration-150 ${s?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),e.jsx(W,{open:s,children:e.jsx("div",{className:"ml-4",children:t.events.map(o=>e.jsx(ae,{event:o},o.id))})})]})}function xt({channels:t,onToggle:s,customFilter:a,onCustomFilterChange:r}){return e.jsxs("div",{className:"space-y-3 pb-3 border-b border-surface-border mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary",children:"Channels"}),e.jsx("p",{className:"text-[9px] text-text-tertiary",children:"Unchecked channels are dropped before buffering"})]}),e.jsx("div",{className:"grid grid-cols-2 gap-1",children:re.map(n=>e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer py-0.5",children:[e.jsx("input",{type:"checkbox",checked:t.has(n.key),onChange:()=>s(n.key),className:"w-3 h-3 rounded border-border accent-accent"}),e.jsx("span",{className:"text-[10px] text-text-secondary",title:n.description,children:n.label})]},n.key))}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Text Filter"}),e.jsx("input",{type:"text",value:a,onChange:n=>r(n.target.value),placeholder:"pong",className:"input text-[10px] font-mono py-1 px-2 w-full"}),e.jsxs("p",{className:"text-[9px] text-text-tertiary mt-1",children:["Filter by event type, e.g. ",e.jsx("span",{className:"font-mono",children:"pong"}),", ",e.jsx("span",{className:"font-mono",children:"throttle"}),", or any text in the event data."]})]})]})}function pt({bridgeActive:t}){const[s,a]=i.useState(!1),[r,n]=i.useState(!1),[o,u]=i.useState([]),[l,m]=i.useState(()=>new Set(re.map(x=>x.key))),[d,k]=i.useState(""),b=i.useRef(l);i.useEffect(()=>{b.current=l},[l]);const j=i.useRef(d);i.useEffect(()=>{j.current=d},[d]);const v=x=>{m(w=>{const c=new Set(w);return c.has(x)?c.delete(x):c.add(x),c})};Ie("lt.events.mesh.>",i.useCallback(x=>{var g;const w=((g=x.type)==null?void 0:g.replace("mesh.",""))||"unknown";if(!b.current.has(w))return;const c=j.current;c&&!`${w} ${JSON.stringify(x.data||x)}`.toLowerCase().includes(c.toLowerCase())||u(E=>[{id:++it,type:w,timestamp:x.timestamp||new Date().toISOString(),data:x.data||x},...E].slice(0,qe))},[]));const y=()=>u([]);return e.jsxs("div",{className:"border-l border-surface-border pl-6 pt-4 min-h-[300px] sticky top-14 self-start max-h-[calc(100vh-8rem)] flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary",children:"Event Stream"}),e.jsx(Ae,{className:`w-3 h-3 ${t?"text-status-success animate-pulse":"text-text-tertiary"}`}),e.jsx("span",{className:"text-[9px] text-text-tertiary",children:t?"Live":"..."}),e.jsxs("span",{className:"ml-auto flex items-center gap-1",children:[e.jsx("button",{onClick:()=>{a(x=>!x),n(!1)},className:`p-1 rounded transition-colors ${s?"text-accent bg-accent/10":"text-text-tertiary hover:text-text-primary"}`,title:"Configure channels",children:e.jsx(Le,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:()=>{n(x=>!x),a(!1)},className:`p-1 rounded transition-colors ${r?"text-accent bg-accent/10":"text-text-tertiary hover:text-text-primary"}`,title:"View raw JSON",children:e.jsx(We,{className:"w-3.5 h-3.5"})}),o.length>0&&e.jsx("button",{onClick:y,className:"p-1 rounded text-text-tertiary hover:text-text-primary transition-colors",title:"Clear events",children:e.jsx(Qe,{className:"w-3.5 h-3.5"})})]})]}),e.jsx(W,{open:s,children:e.jsx(xt,{channels:l,onToggle:v,customFilter:d,onCustomFilterChange:k})}),e.jsx(W,{open:r,children:e.jsx("div",{className:"pb-3 border-b border-surface-border mb-3",children:e.jsx("pre",{className:"text-[9px] font-mono text-text-tertiary bg-surface-sunken rounded-lg p-3 max-h-[50vh] overflow-auto whitespace-pre-wrap",children:JSON.stringify(o.slice(0,50),null,2)})})}),o.length>0&&e.jsxs("p",{className:"text-[9px] text-text-tertiary mb-2",children:[o.length," events"]}),e.jsx("div",{className:"flex-1 overflow-y-auto",children:o.length===0?e.jsx("p",{className:"text-xs text-text-tertiary py-6 text-center",children:t?"Waiting for events...":"Subscribing..."}):ut(o).map((x,w)=>x.kind==="group"?e.jsx(dt,{group:x},`grp-${w}`):e.jsx(ae,{event:x.event},x.event.id))})]})}function mt(t){const s=[],a=[],r=[];for(const n of t)P(n)?r.push(n):n.is_scout||T([n]).total>0?s.push(n):a.push(n);return s.sort((n,o)=>n.is_scout&&!o.is_scout?-1:!n.is_scout&&o.is_scout?1:T([o]).total-T([n]).total),a.sort((n,o)=>F(n.engine_id).localeCompare(F(o.engine_id))),r.sort((n,o)=>F(n.engine_id).localeCompare(F(o.engine_id))),{active:s,idle:a,paused:r}}function D({engine:t,isFirst:s,onThrottle:a}){const r=F(t.engine_id),n=Ze(t.engine_id),o=T([t]),u=t.stream_depth??0,l=P(t);return e.jsxs("div",{className:"group/row flex items-center gap-3 py-2 hover:bg-surface-hover/50 transition-colors rounded px-1",children:[l?e.jsx(U,{className:"w-3.5 h-3.5 text-status-warning shrink-0",strokeWidth:1.5}):e.jsx(Fe,{className:`w-3.5 h-3.5 shrink-0 ${o.total>0||t.is_scout?"text-status-success":"text-text-tertiary/30"}`,strokeWidth:1.5}),e.jsx("span",{className:`${s?"text-base font-medium":"text-xs"} text-text-primary truncate max-w-[180px]`,title:t.engine_id,children:r}),n&&e.jsx("span",{className:"text-[10px] text-text-tertiary/50",children:n}),t.is_scout&&e.jsx("span",{className:"text-[9px] text-amber-500 uppercase tracking-widest",children:"scout"}),e.jsx("span",{className:"flex-1"}),l&&e.jsx("span",{className:"text-[10px] text-status-warning",children:t.throttle===-1?"Paused":V(t.throttle)}),o.total>0&&e.jsx("span",{className:"text-[10px] font-mono tabular-nums text-text-tertiary w-16 text-right",children:o.total.toLocaleString()}),u>0&&e.jsxs("span",{className:`text-[10px] font-mono tabular-nums w-14 text-right ${u>100?"text-status-warning":"text-text-tertiary/50"}`,children:[u.toLocaleString()," q"]}),e.jsx("span",{className:"text-[10px] font-mono text-text-tertiary/40 w-12 text-right",children:Ke(t.inited)}),e.jsx("span",{className:"opacity-0 group-hover/row:opacity-100 transition-opacity",children:e.jsx("button",{onClick:m=>{m.stopPropagation(),a(t)},className:"text-text-tertiary hover:text-accent transition-colors",title:l?"Resume / adjust throttle":"Pause / throttle",children:e.jsx(J,{className:"w-3.5 h-3.5",strokeWidth:1.5})})})]})}function X({label:t,engines:s,onThrottle:a}){const[r,n]=i.useState(!1);return s.length===0?null:e.jsxs("div",{className:"mt-1",children:[e.jsxs("button",{onClick:()=>n(!r),className:"flex items-center gap-1.5 text-[10px] text-text-tertiary hover:text-text-secondary transition-colors py-1",children:[e.jsx(te,{className:`w-3 h-3 transition-transform duration-200 ${r?"rotate-90":""}`,strokeWidth:2}),s.length," ",t]}),e.jsx(W,{open:r,children:e.jsx("div",{className:"ml-1",children:s.map(o=>e.jsx(D,{engine:o,onThrottle:a},o.engine_id))})})]})}function ht({engines:t,onThrottle:s,isLoading:a}){const{active:r,idle:n,paused:o}=i.useMemo(()=>mt(t),[t]);return a?e.jsx("p",{className:"text-xs text-text-tertiary",children:"Discovering engines..."}):t.length===0?e.jsx("p",{className:"text-xs text-text-tertiary",children:"No engines found."}):r.length===0&&n.length===0?e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-3 py-2",children:[e.jsx(U,{className:"w-4 h-4 text-status-error shrink-0",strokeWidth:1.5}),e.jsxs("span",{className:"text-base text-status-error font-medium",children:["All ",t.length," engines paused"]})]}),e.jsx("p",{className:"text-[10px] text-text-tertiary ml-7",children:"Messages are accumulating. Resume at least one engine to restore processing."}),e.jsx("div",{className:"ml-1 mt-2",children:o.map(u=>e.jsx(D,{engine:u,onThrottle:s},u.engine_id))})]}):e.jsxs("div",{children:[r.map((u,l)=>e.jsx(D,{engine:u,isFirst:l===0,onThrottle:s},u.engine_id)),e.jsx(X,{label:"idle",engines:n,onThrottle:s}),e.jsx(X,{label:"paused",engines:o,onThrottle:s})]})}function gt({collapsed:t,toggleSection:s,activeDuration:a,streamStats:r,isLoading:n,queueMap:o,expandedQueues:u,toggleQueue:l,allQueuesExpanded:m,toggleAllQueues:d,handleRowClick:k,handleResumeThrottle:b,handleQueueThrottle:j,handleResumeQueue:v,engines:y,bridgeActive:x}){return e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-[1fr_340px] gap-6",children:[e.jsxs("div",{className:"flex flex-col gap-12 mt-10",children:[e.jsx(I,{title:`Message Volume (${a})`,sectionKey:"volume",isCollapsed:!!t.volume,onToggle:s,contentClassName:"mt-4 ml-7",children:e.jsx(ot,{byStream:(r==null?void 0:r.byStream)??[],onNodeFilter:()=>{},onQueueFilter:()=>{}})}),e.jsx(I,{title:`Engine Routers (${y.length})`,sectionKey:"engines",isCollapsed:!!t.engines,onToggle:s,contentClassName:"mt-4 ml-7",children:e.jsx(ht,{engines:y,onThrottle:k,isLoading:n})}),e.jsx(I,{title:"Worker Routers",sectionKey:"queues",isCollapsed:!!t.queues,onToggle:s,contentClassName:"mt-4 ml-7 flex flex-col gap-0",children:n?e.jsx("p",{className:"text-xs text-text-tertiary",children:"Discovering mesh nodes..."}):o.size===0?e.jsx("p",{className:"text-xs text-text-tertiary",children:'No worker routers found. Click "Roll Call" to discover.'}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex justify-end mb-2",children:e.jsx("button",{onClick:d,className:"text-[10px] text-accent hover:underline",children:m?"Collapse all":"Expand all"})}),[...o.entries()].sort(([w],[c])=>w.localeCompare(c)).map(([w,c])=>e.jsx(lt,{queue:w,workers:c,expanded:u.has(w),onToggle:l,onWorkerClick:k,onResumeThrottle:b,onQueueThrottle:j,onResumeQueue:v,byStream:(r==null?void 0:r.byStream)??[],activeDuration:a},w))]})})]}),e.jsx(pt,{bridgeActive:x})]})}function Mt(){const{namespace:t,available:s}=ve(),{filters:a,setFilter:r}=Ne({filters:{app_id:"",duration:"1h"}}),n=a.app_id||t,o=a.duration||"1h",u=$e(),l=6e4,{data:m,isLoading:d,error:k,refetch:b,isFetching:j}=Se(n,l),{data:v}=_e(n,o,void 0,l),y=i.useMemo(()=>[...(m==null?void 0:m.profiles)??[]].sort((S,_)=>{const z=S.worker_topic||S.stream||"",Q=_.worker_topic||_.stream||"";return!S.worker_topic&&_.worker_topic?-1:S.worker_topic&&!_.worker_topic?1:z.localeCompare(Q)}),[m==null?void 0:m.profiles]),x=i.useMemo(()=>y.filter(h=>!M(h)),[y]),w=i.useMemo(()=>y.filter(M),[y]),c=i.useMemo(()=>Ye(y),[y]),g=y.filter(P).length,E=i.useMemo(()=>{const h=new Set(s);return n&&h.add(n),[...h].sort().map(S=>({value:S,label:S}))},[s,n]),[p]=Ue(),C=p.get("queue"),[f,$]=i.useState(()=>C?new Set([C]):new Set),A=i.useCallback(h=>{$(S=>{const _=S.has(h),z=_?new Set:new Set([h]),Q=new URLSearchParams(window.location.search);_?Q.delete("queue"):Q.set("queue",h);const G=Q.toString();return window.history.pushState(null,"",`${window.location.pathname}${G?`?${G}`:""}`),z})},[]),N=c.size>0&&[...c.keys()].every(h=>f.has(h)),R=i.useCallback(()=>{$(N?new Set:new Set(c.keys()))},[N,c]),O="lt:controlplane:collapsed",[L,oe]=i.useState(()=>{try{const h=JSON.parse(localStorage.getItem(O)||"{}");return C&&(h.queues=!1),h}catch{return{}}}),le=i.useCallback(h=>{oe(S=>{const _={...S,[h]:!S[h]};return localStorage.setItem(O,JSON.stringify(_)),_})},[]),{throttleModalOpen:ie,throttleTargets:H,selectedThrottleTargets:ce,throttleMutation:ue,handleBulkThrottle:de,handleRowClick:xe,handleResumeThrottle:pe,handleResumeQueue:me,handleQueueThrottle:he,closeThrottleModal:ge}=tt({activeAppId:n,allProfiles:y,profiles:y}),fe=i.useMemo(()=>{const h=[{label:"Engines",value:x.length,dotClass:"bg-blue-500"},{label:"Workers",value:w.length,dotClass:"bg-text-secondary"},{label:"Topics",value:c.size}];return g>0&&h.push({label:"Throttled",value:g,dotClass:"bg-status-warning"}),h},[x.length,w.length,c.size,g]),[q,be]=i.useState(!1),je=i.useCallback(()=>{u.mutate({appId:n},{onSuccess:()=>be(!0)})},[n,u]);return i.useEffect(()=>{!q&&n&&je()},[n]),e.jsxs("div",{children:[e.jsx(ye,{title:"Routers",docsHash:"#docs:dashboard.md:task-queues",stats:fe,actions:e.jsx(at,{})}),e.jsxs(we,{actions:e.jsx("div",{className:"flex items-center gap-1",children:Ve.map(h=>e.jsx("button",{onClick:()=>r("duration",h.value),className:`px-3 py-1 text-xs rounded-full transition-colors ${o===h.value?"bg-accent text-text-inverse":"text-text-tertiary hover:text-text-primary hover:bg-surface-hover"}`,children:h.label},h.value))}),children:[e.jsx(ke,{label:"Application",value:a.app_id,onChange:h=>r("app_id",h),options:E}),e.jsxs("button",{onClick:()=>b(),disabled:j,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs text-text-tertiary hover:text-text-primary transition-colors disabled:opacity-50",children:[e.jsx(Oe,{className:`w-3.5 h-3.5 ${j?"animate-spin":""}`}),"Roll Call"]})]}),k&&e.jsx("div",{className:"mb-6 px-4 py-3 rounded bg-status-error/10 border border-status-error/20",children:e.jsx("p",{className:"text-xs text-status-error font-medium",children:k.message==="Session expired"?"Session expired — please log in again.":`Failed to load mesh data: ${k.message}`})}),e.jsx(gt,{collapsed:L,toggleSection:le,activeDuration:o,streamStats:v,isLoading:d,queueMap:c,expandedQueues:f,toggleQueue:A,allQueuesExpanded:N,toggleAllQueues:R,handleRowClick:xe,handleResumeThrottle:pe,handleQueueThrottle:he,handleResumeQueue:me,engines:x,bridgeActive:q}),e.jsx(rt,{open:ie,onClose:ge,targets:H.length>0?H:ce,onApply:de,isPending:ue.isPending})]})}export{Mt as ControlPlanePage};
2
- //# sourceMappingURL=index-e97M6GoI.js.map
1
+ import{a as i,j as e}from"./vendor-query-B2UbickB.js";import{P as ye}from"./PageHeaderWithStats-CcVAji-7.js";import{F as we,b as ke}from"./FilterBar-BQ2JGg8U.js";import{u as Ne}from"./useFilterParams-x-Dg0Vgz.js";import{u as ve}from"./useNamespace-BDsKfT0f.js";import{a as ee,u as Ce,b as $e,c as Se,d as _e}from"./controlplane-C9j2mwX8.js";import{M as Te}from"./Modal-CSrxpXeM.js";import{O as K,ax as U,P as Ee,ay as Z,az as J,o as te,I as Re,aA as Me,a6 as Pe,R as Ae,y as Le,aB as We,E as Qe,Z as Fe,au as Oe}from"./vendor-icons-BaQqUm-e.js";import{C as I}from"./CollapsibleSection-Ne-Q3QFM.js";import{T as Be}from"./TaskQueuePill-DyvtL8X4.js";import{D as ze}from"./DataTable-ZWgVQg7F.js";import{C as W,c as Ie,J as Je}from"./index-BoZydcaW.js";import{R as De,a as Y}from"./RowActions-BA9L9djf.js";import{f as Ue}from"./vendor-react-CXumBFUA.js";import"./EmptyState-BcsfPq9T.js";const Ve=[{label:"15m",value:"15m"},{label:"30m",value:"30m"},{label:"1h",value:"1h"},{label:"1d",value:"1d"},{label:"7d",value:"7d"}],se={pong:"text-status-success",ping:"text-accent",throttle:"text-status-warning",job:"text-purple-400",work:"text-text-secondary",activate:"text-status-error",cron:"text-text-tertiary",user:"text-text-secondary"},He={pong:"roll call",ping:"ping",throttle:"throttle",job:"job",work:"work",activate:"activate",cron:"cron",user:"user"},qe=250;function M(t){return!!t.worker_topic}function P(t){return typeof t.throttle=="number"&&t.throttle!==0}function V(t){return t===void 0||t===0?"Normal":t===-1?"Paused":t>=864e5?`${(t/864e5).toFixed(0)}d`:t>=36e5?`${(t/36e5).toFixed(1)}h`:t>=6e4?`${(t/6e4).toFixed(1)}m`:t>=1e3?`${(t/1e3).toFixed(1)}s`:`${t}ms`}function Ge(t){if(!t)return null;const s=t.match(/^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})\.(\d+)$/);if(s){const[,r,n,o,u,l,m,d]=s;return new Date(`${r}-${n}-${o}T${u}:${l}:${m}.${d}Z`)}const a=new Date(t);return isNaN(a.getTime())?null:a}function Ke(t){const s=Ge(t);if(!s)return"--";const a=Date.now()-s.getTime();if(a<0||isNaN(a))return"--";const r=Math.floor(a/1e3);if(r<60)return`${r}s`;const n=Math.floor(r/60);if(n<60)return`${n}m`;const o=Math.floor(n/60);return o<24?`${o}h ${n%60}m`:`${Math.floor(o/24)}d ${o%24}h`}function ne(t){return t.replace(/^hmsh:[^:]+:x:/,"")||"(engine)"}function F(t){const s=t.match(/^([^:]+)::(.+?)-[A-Za-z0-9_]{10,}$/);return s?s[2]:t.length>20?t.slice(0,20)+"...":t}function Ze(t){const s=t.match(/^([^:]+)::/);return(s==null?void 0:s[1])||""}const re=[{key:"pong",label:"Roll Call",description:"Node health check responses"},{key:"ping",label:"Ping",description:"Health check broadcasts"},{key:"throttle",label:"Throttle",description:"Throttle commands"},{key:"job",label:"Job",description:"Job lifecycle events"},{key:"work",label:"Work",description:"Worker dispatch events"},{key:"activate",label:"Activate",description:"Worker activation"},{key:"cron",label:"Cron",description:"Cron schedule triggers"},{key:"user",label:"User",description:"User-defined messages"}];function B(t){return`${t.engine_id}-${t.worker_topic||"engine"}`}function Ye(t){const s=new Map;for(const a of t){if(!a.worker_topic)continue;const r=a.worker_topic;s.has(r)||s.set(r,[]),s.get(r).push(a)}return s}function T(t){let s=0,a=0,r=0;for(const n of t)if(n.counts)for(const[o,u]of Object.entries(n.counts))s+=u,o==="200"?a+=u:o==="500"&&(r+=u);return{total:s,success:a,errors:r}}function Xe(t){let s=0;for(const a of t)typeof a.stream_depth=="number"&&(s+=a.stream_depth);return s}function et(t){if(t.length===0)return"healthy";if(t.every(r=>r.throttle===-1))return"paused";const{errors:a}=T(t);return a>0||t.some(P)?"degraded":"healthy"}function tt({activeAppId:t,allProfiles:s,profiles:a}){const r=ee(),[n,o]=i.useState(new Set),[u,l]=i.useState(!1),[m,d]=i.useState([]);i.useEffect(()=>{o(new Set)},[t]);const k=i.useCallback(p=>{o(C=>{const f=new Set(C),$=B(p);return f.has($)?f.delete($):f.add($),f})},[]),b=i.useCallback(()=>{n.size===a.length?o(new Set):o(new Set(a.map(B)))},[a,n.size]),j=i.useMemo(()=>{const p=a.filter(N=>n.has(B(N)));if(p.length===0)return[];if(p.length===s.length)return[{label:"Entire Mesh"}];const C=p.filter(N=>!M(N)),f=p.filter(M),$=[];for(const N of C)$.push({label:`Engine ${N.engine_id}`,guid:N.engine_id,scope:"engines"});const A=new Map;for(const N of f){const R=N.worker_topic;A.has(R)||A.set(R,[]),A.get(R).push(N)}for(const[N,R]of A){const O=s.filter(L=>L.worker_topic===N);if(R.length===O.length)$.push({label:N,topic:N});else for(const L of R)$.push({label:`${N} ${L.engine_id}`,guid:L.engine_id})}return $},[a,s,n]);return{selectedIds:n,setSelectedIds:o,toggleCheckbox:k,toggleAll:b,throttleModalOpen:u,throttleTargets:m,selectedThrottleTargets:j,throttleMutation:r,handleBulkThrottle:p=>{const C=m.length>0?m:j;for(const f of C)r.mutate({appId:t,throttle:p,...f.topic?{topic:f.topic}:{},...f.guid?{guid:f.guid}:{},...f.scope?{scope:f.scope}:{}});l(!1),d([])},handleRowClick:(p,C)=>{const f=M(p)?`${p.worker_topic} ${p.engine_id}`:`Engine ${p.engine_id}`;d([{label:f,guid:p.engine_id,scope:C||(M(p)?"workers":"engines")}]),l(!0)},handleBulkThrottleOpen:()=>{d(j),l(!0)},handleResumeThrottle:(p,C)=>{const f=C||(M(p)?"workers":"engines");r.mutate({appId:t,throttle:0,guid:p.engine_id,scope:f})},handleResumeQueue:p=>{r.mutate({appId:t,throttle:0,topic:p})},handleQueueThrottle:p=>{d([{label:p,topic:p}]),l(!0)},closeThrottleModal:()=>{l(!1),d([])}}}const st=[{label:"Resume",ms:0},{label:"0.5s",ms:500},{label:"1s",ms:1e3},{label:"5s",ms:5e3},{label:"30s",ms:3e4},{label:"Pause",ms:-1}];function nt({target:t}){const s=t.label==="Entire Mesh",a=t.label==="All Engines"||t.label.startsWith("Engine "),r=s?"bg-status-error/10 text-status-error":a?"bg-blue-500/10 text-blue-500":"bg-accent/[0.06] text-text-secondary",n=t.scope==="engines"?"engine only":t.scope==="workers"?"worker only":t.guid?"guid":t.topic?"topic":"mesh";return e.jsxs("span",{className:`inline-flex items-center gap-1.5 px-2 py-0.5 text-[10px] font-medium rounded-lg ${r}`,children:[t.label,e.jsx("span",{className:"text-[8px] opacity-50",children:n})]})}function rt({open:t,onClose:s,targets:a,onApply:r,isPending:n}){const[o,u]=i.useState("");return e.jsx(Te,{open:t,onClose:s,title:"Adjust Throttle",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary mb-2",children:"Targets"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:a.map((l,m)=>e.jsx(nt,{target:l},l.guid||l.topic||m))})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary mb-2",children:"Presets"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:st.map(l=>e.jsx("button",{onClick:()=>r(l.ms),disabled:n,className:`px-3 py-1.5 text-xs rounded transition-colors ${l.ms===-1?"bg-status-error/10 text-status-error hover:bg-status-error/20":l.ms===0?"bg-status-success/10 text-status-success hover:bg-status-success/20":"bg-surface-sunken text-text-secondary hover:bg-surface-hover"} disabled:opacity-50`,children:l.label},l.label))})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary mb-2",children:"Custom delay (seconds)"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("input",{type:"number",step:"0.1",min:"0",value:o,onChange:l=>u(l.target.value),placeholder:"e.g. 2.5",className:"input text-xs py-1.5 px-3 w-28"}),e.jsx("button",{onClick:()=>{const l=parseFloat(o);isNaN(l)||l<0||r(Math.round(l*1e3))},disabled:n,className:"btn-primary text-xs py-1.5 px-4 disabled:opacity-50",children:"Apply"})]})]})]})})}function at(){const{data:t}=Ce(),s=ee(),[a,r]=i.useState(null),[n,o]=i.useState(!1),u=(t==null?void 0:t.apps)??[],l=i.useCallback(async(d,k="all")=>{if(u.length===0)return;o(!0);const b=await Promise.allSettled(u.map(v=>s.mutateAsync({appId:v.appId,throttle:d,...k!=="all"?{scope:k}:{}}))),j=b.filter(v=>v.status==="rejected").length;j>0&&console.error(`Emergency throttle: ${j}/${b.length} apps failed`),o(!1),r(null)},[u,s]),m=d=>d==="engines"?"engines":d==="workers"?"workers":"everything";return a?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-xs text-status-error",children:["Pause ",m(a.scope),"?"]}),e.jsx("button",{onClick:()=>l(a.ms,a.scope),disabled:n,className:"px-2.5 py-1 text-xs rounded-md bg-status-error text-white hover:bg-status-error/90 transition-colors disabled:opacity-50",children:n?e.jsx(K,{className:"w-3.5 h-3.5 animate-spin"}):"Confirm"}),e.jsx("button",{onClick:()=>r(null),disabled:n,className:"px-2.5 py-1 text-xs text-text-tertiary hover:text-text-primary transition-colors disabled:opacity-50",children:"Cancel"})]}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>r({ms:-1,scope:"all"}),disabled:n,className:"flex items-center gap-1.5 px-2.5 py-1 text-xs rounded-md text-status-error/80 hover:text-status-error hover:bg-status-error/10 transition-colors disabled:opacity-50",title:"Pause all engines and workers",children:[e.jsx(U,{className:"w-3.5 h-3.5"}),"Pause All"]}),e.jsxs("button",{onClick:()=>l(0),disabled:n,className:"flex items-center gap-1.5 px-2.5 py-1 text-xs rounded-md text-status-success/80 hover:text-status-success hover:bg-status-success/10 transition-colors disabled:opacity-50",title:"Resume all engines and workers",children:[n?e.jsx(K,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(Ee,{className:"w-3.5 h-3.5"}),"Resume All"]})]})}function ot({byStream:t,onNodeFilter:s}){const[a,r]=i.useState(!1);if(i.useEffect(()=>{r(!1);const d=requestAnimationFrame(()=>r(!0));return()=>cancelAnimationFrame(d)},[t]),t.length===0)return e.jsx("p",{className:"text-xs text-text-tertiary py-4 text-center",children:"No activity in this period"});const n=t.filter(d=>d.stream_type==="engine"),o=t.filter(d=>d.stream_type==="worker"),u=Math.max(...t.map(d=>d.count)),l=d=>{const k=u>0?d.count/u*100:0,b=d.stream_type==="engine",j=b?"(all engines)":ne(d.stream_name),v=b?"bg-blue-500/70":"bg-accent/60",y=b?"text-blue-500":"text-text-tertiary";return e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:`text-[9px] font-mono ${y} w-36 truncate text-right shrink-0`,title:d.stream_name,children:j}),e.jsx("div",{className:"flex-1 h-4 bg-surface-sunken rounded overflow-hidden",children:e.jsx("div",{className:`h-full ${v} rounded transition-all duration-500 ease-out`,style:{width:a?`${k}%`:"0%"}})}),e.jsx("span",{className:"text-[10px] font-mono tabular-nums text-text-secondary w-12 text-right shrink-0",children:d.count.toLocaleString()})]},`${d.stream_type}-${d.stream_name}`)},m="text-[9px] uppercase tracking-widest font-semibold mb-1 cursor-pointer hover:underline";return e.jsxs("div",{className:"space-y-1.5",children:[n.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:`${m} text-blue-500/70 hover:text-blue-500`,onClick:()=>s==null?void 0:s("engines"),children:"Engine Stream"}),n.map(l),o.length>0&&e.jsx("div",{className:"h-2"})]}),o.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:`${m} text-accent/70 hover:text-accent`,onClick:()=>s==null?void 0:s("workers"),children:"Worker Streams"}),o.map(l)]})]})}function lt({queue:t,workers:s,expanded:a,onToggle:r,onWorkerClick:n,onResumeThrottle:o,onQueueThrottle:u,onResumeQueue:l,byStream:m,activeDuration:d}){const k=i.useMemo(()=>{const c=m.find(g=>g.stream_type==="worker"&&ne(g.stream_name)===t);return(c==null?void 0:c.count)??0},[m,t]),b=i.useMemo(()=>et(s),[s]),j=i.useMemo(()=>Xe(s),[s]),{errors:v}=i.useMemo(()=>T(s),[s]),y=b==="paused"?"bg-status-error":b==="degraded"?"bg-status-warning":"bg-status-success",x=i.useMemo(()=>[...s].sort((c,g)=>T([g]).total-T([c]).total),[s]),w=i.useMemo(()=>[{key:"engine_id",label:"Router",render:c=>{var p;const g=c.engine_id.replace(/^[^:]+::/,"").replace(/-[A-Za-z0-9_]{10,}$/,"")||c.engine_id,E=((p=c.engine_id.match(/^([^:]+)::/))==null?void 0:p[1])||"";return e.jsxs("div",{className:"flex items-center gap-2",title:c.engine_id,children:[e.jsx("span",{className:"text-xs text-text-secondary truncate max-w-[180px]",children:g}),E&&e.jsx("span",{className:"text-[9px] text-text-tertiary/50",children:E})]})}},{key:"processed",label:"Processed",render:c=>{const g=T([c]);return e.jsx("span",{className:"text-xs font-mono tabular-nums text-text-tertiary",children:g.total>0?g.total.toLocaleString():"--"})},className:"w-24"},{key:"throttle",label:"Throttle",render:c=>{const g=c.throttle;return g===-1?e.jsx("span",{className:"text-xs text-status-error font-medium",children:"Paused"}):g&&g>0?e.jsx("span",{className:"text-xs text-status-warning font-medium",children:V(g)}):e.jsx("span",{className:"text-xs text-text-tertiary",children:"0"})},className:"w-24"},{key:"actions",label:"",render:c=>e.jsxs(De,{children:[P(c)&&e.jsx(Y,{icon:Z,title:"Resume (remove throttle)",onClick:()=>o(c),colorClass:"text-text-tertiary hover:text-status-success"}),e.jsx(Y,{icon:J,title:"Adjust throttle",onClick:()=>n(c)})]}),className:"w-16"}],[n,o]);return e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>r(t),className:"group/row relative flex items-center gap-3 w-full py-2 hover:bg-surface-hover transition-colors text-left rounded",children:[e.jsx("span",{className:`w-2 h-2 rounded-full shrink-0 ${y}`,title:b}),e.jsx(te,{className:`w-3.5 h-3.5 text-text-tertiary/50 transition-transform duration-200 ${a?"rotate-90":""}`,strokeWidth:2}),e.jsx(Be,{queue:t,size:"sm"}),e.jsx("span",{className:"flex-1"}),v>0&&e.jsxs("span",{className:"text-[10px] text-status-error font-medium mr-2",children:[v," errors"]}),j>0&&e.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-status-warning w-20",children:[e.jsx(Re,{className:"w-3 h-3 shrink-0",strokeWidth:1.5}),e.jsx("span",{className:"font-mono tabular-nums",children:j.toLocaleString()})]}),e.jsxs("span",{className:`flex items-center gap-1 text-xs w-24 ${s.some(P)?"text-status-warning":"text-text-tertiary"}`,children:[e.jsx(Me,{className:"w-3 h-3 shrink-0",strokeWidth:1.5}),e.jsx("span",{className:"font-mono tabular-nums",children:s.length}),e.jsx("span",{children:"workers"})]}),e.jsx("span",{className:"flex items-center gap-1 text-xs font-mono text-text-tertiary w-28 justify-end mr-16",children:k>0?e.jsxs(e.Fragment,{children:[e.jsx(Pe,{className:"w-3 h-3 shrink-0",strokeWidth:1.5}),k.toLocaleString()," in ",d]}):e.jsx("span",{className:"text-text-tertiary/40",children:"—"})}),e.jsxs("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 opacity-0 group-hover/row:opacity-100 transition-opacity flex items-center gap-2",children:[s.some(P)&&e.jsx(Z,{className:"w-4 h-4 text-text-tertiary hover:text-status-success",strokeWidth:1.5,onClick:c=>{c.stopPropagation(),l(t)}}),e.jsx(J,{className:"w-4 h-4 text-text-tertiary hover:text-accent",strokeWidth:1.5,onClick:c=>{c.stopPropagation(),u(t)}})]})]}),e.jsx(W,{open:a,children:e.jsx("div",{className:"ml-6",children:e.jsx(ze,{columns:w,data:x,keyFn:B,onRowClick:n,emptyMessage:"No workers",inline:!0})})})]})}let it=0;function ct(t){const s=t.data||{},a=s.topic?String(s.topic):"",r=s.guid?String(s.guid).slice(0,8):"";switch(t.type){case"pong":return a?`Worker ${r}... on "${a}" responded`:`Engine ${r}... responded`;case"ping":return"Roll call broadcast";case"throttle":{const n=s.throttle,o=a?`queue "${a}"`:r?`node ${r}...`:"all nodes";return`${V(n)} applied to ${o}`}case"job":return`Job ${r?r+"...":""} ${s.status||"updated"}`;case"work":return`Dispatched to "${a||"worker"}" ${r?"("+r+"...)":""}`;case"activate":return`Worker "${a||"unknown"}" activated`;case"cron":return`Cron triggered ${a?'"'+a+'"':""}`;default:return a||r||t.type}}function ut(t){const s=[];let a=0;for(;a<t.length;){const r=t[a];if(r.type==="pong"){let n=a+1;for(;n<t.length&&t[n].type==="pong";)n++;const o=t.slice(a,n);if(o.length>=3)s.push({kind:"group",type:"pong",count:o.length,firstTimestamp:o[o.length-1].timestamp,lastTimestamp:o[0].timestamp,events:o});else for(const u of o)s.push({kind:"single",event:u});a=n}else s.push({kind:"single",event:r}),a++}return s}function ae({event:t}){const[s,a]=i.useState(!1);return e.jsxs("div",{className:"border-b border-surface-border/50 last:border-b-0",children:[e.jsxs("button",{onClick:()=>a(!s),className:"flex items-center gap-2 py-1.5 w-full text-left hover:bg-surface-hover/50 transition-colors",children:[e.jsx("span",{className:"text-[9px] font-mono text-text-tertiary whitespace-nowrap tabular-nums shrink-0",children:new Date(t.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}),e.jsx("span",{className:`text-[9px] font-medium px-1 py-0.5 rounded ${se[t.type]||"text-text-tertiary"} bg-surface-sunken whitespace-nowrap shrink-0`,children:He[t.type]||t.type}),e.jsx("span",{className:"text-[9px] text-text-secondary flex-1 min-w-0 truncate",children:ct(t)}),e.jsx("svg",{className:`w-2.5 h-2.5 text-text-tertiary shrink-0 transition-transform duration-150 ${s?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),e.jsx(W,{open:s,children:e.jsx("div",{className:"pb-2",children:e.jsx(Je,{data:t.data})})})]})}function dt({group:t}){const[s,a]=i.useState(!1),r=t.events.filter(o=>{var u;return!((u=o.data)!=null&&u.topic)}).length,n=t.count-r;return e.jsxs("div",{className:"border-b border-surface-border/50 last:border-b-0",children:[e.jsxs("button",{onClick:()=>a(!s),className:"flex items-center gap-2 py-1.5 w-full text-left hover:bg-surface-hover/50 transition-colors",children:[e.jsx("span",{className:"text-[9px] font-mono text-text-tertiary whitespace-nowrap tabular-nums shrink-0",children:new Date(t.lastTimestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}),e.jsx("span",{className:`text-[9px] font-medium px-1 py-0.5 rounded ${se.pong} bg-surface-sunken whitespace-nowrap shrink-0`,children:"roll call"}),e.jsxs("span",{className:"text-[9px] text-text-secondary flex-1 min-w-0 truncate",children:[t.count," nodes responded",r>0&&n>0?` (${r} engine${r!==1?"s":""}, ${n} worker${n!==1?"s":""})`:r>0?` (${r} engine${r!==1?"s":""})`:` (${n} worker${n!==1?"s":""})`]}),e.jsx("svg",{className:`w-2.5 h-2.5 text-text-tertiary shrink-0 transition-transform duration-150 ${s?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),e.jsx(W,{open:s,children:e.jsx("div",{className:"ml-4",children:t.events.map(o=>e.jsx(ae,{event:o},o.id))})})]})}function xt({channels:t,onToggle:s,customFilter:a,onCustomFilterChange:r}){return e.jsxs("div",{className:"space-y-3 pb-3 border-b border-surface-border mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary",children:"Channels"}),e.jsx("p",{className:"text-[9px] text-text-tertiary",children:"Unchecked channels are dropped before buffering"})]}),e.jsx("div",{className:"grid grid-cols-2 gap-1",children:re.map(n=>e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer py-0.5",children:[e.jsx("input",{type:"checkbox",checked:t.has(n.key),onChange:()=>s(n.key),className:"w-3 h-3 rounded border-border accent-accent"}),e.jsx("span",{className:"text-[10px] text-text-secondary",title:n.description,children:n.label})]},n.key))}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Text Filter"}),e.jsx("input",{type:"text",value:a,onChange:n=>r(n.target.value),placeholder:"pong",className:"input text-[10px] font-mono py-1 px-2 w-full"}),e.jsxs("p",{className:"text-[9px] text-text-tertiary mt-1",children:["Filter by event type, e.g. ",e.jsx("span",{className:"font-mono",children:"pong"}),", ",e.jsx("span",{className:"font-mono",children:"throttle"}),", or any text in the event data."]})]})]})}function pt({bridgeActive:t}){const[s,a]=i.useState(!1),[r,n]=i.useState(!1),[o,u]=i.useState([]),[l,m]=i.useState(()=>new Set(re.map(x=>x.key))),[d,k]=i.useState(""),b=i.useRef(l);i.useEffect(()=>{b.current=l},[l]);const j=i.useRef(d);i.useEffect(()=>{j.current=d},[d]);const v=x=>{m(w=>{const c=new Set(w);return c.has(x)?c.delete(x):c.add(x),c})};Ie("lt.events.mesh.>",i.useCallback(x=>{var g;const w=((g=x.type)==null?void 0:g.replace("mesh.",""))||"unknown";if(!b.current.has(w))return;const c=j.current;c&&!`${w} ${JSON.stringify(x.data||x)}`.toLowerCase().includes(c.toLowerCase())||u(E=>[{id:++it,type:w,timestamp:x.timestamp||new Date().toISOString(),data:x.data||x},...E].slice(0,qe))},[]));const y=()=>u([]);return e.jsxs("div",{className:"border-l border-surface-border pl-6 pt-4 min-h-[300px] sticky top-14 self-start max-h-[calc(100vh-8rem)] flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary",children:"Event Stream"}),e.jsx(Ae,{className:`w-3 h-3 ${t?"text-status-success animate-pulse":"text-text-tertiary"}`}),e.jsx("span",{className:"text-[9px] text-text-tertiary",children:t?"Live":"..."}),e.jsxs("span",{className:"ml-auto flex items-center gap-1",children:[e.jsx("button",{onClick:()=>{a(x=>!x),n(!1)},className:`p-1 rounded transition-colors ${s?"text-accent bg-accent/10":"text-text-tertiary hover:text-text-primary"}`,title:"Configure channels",children:e.jsx(Le,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:()=>{n(x=>!x),a(!1)},className:`p-1 rounded transition-colors ${r?"text-accent bg-accent/10":"text-text-tertiary hover:text-text-primary"}`,title:"View raw JSON",children:e.jsx(We,{className:"w-3.5 h-3.5"})}),o.length>0&&e.jsx("button",{onClick:y,className:"p-1 rounded text-text-tertiary hover:text-text-primary transition-colors",title:"Clear events",children:e.jsx(Qe,{className:"w-3.5 h-3.5"})})]})]}),e.jsx(W,{open:s,children:e.jsx(xt,{channels:l,onToggle:v,customFilter:d,onCustomFilterChange:k})}),e.jsx(W,{open:r,children:e.jsx("div",{className:"pb-3 border-b border-surface-border mb-3",children:e.jsx("pre",{className:"text-[9px] font-mono text-text-tertiary bg-surface-sunken rounded-lg p-3 max-h-[50vh] overflow-auto whitespace-pre-wrap",children:JSON.stringify(o.slice(0,50),null,2)})})}),o.length>0&&e.jsxs("p",{className:"text-[9px] text-text-tertiary mb-2",children:[o.length," events"]}),e.jsx("div",{className:"flex-1 overflow-y-auto",children:o.length===0?e.jsx("p",{className:"text-xs text-text-tertiary py-6 text-center",children:t?"Waiting for events...":"Subscribing..."}):ut(o).map((x,w)=>x.kind==="group"?e.jsx(dt,{group:x},`grp-${w}`):e.jsx(ae,{event:x.event},x.event.id))})]})}function mt(t){const s=[],a=[],r=[];for(const n of t)P(n)?r.push(n):n.is_scout||T([n]).total>0?s.push(n):a.push(n);return s.sort((n,o)=>n.is_scout&&!o.is_scout?-1:!n.is_scout&&o.is_scout?1:T([o]).total-T([n]).total),a.sort((n,o)=>F(n.engine_id).localeCompare(F(o.engine_id))),r.sort((n,o)=>F(n.engine_id).localeCompare(F(o.engine_id))),{active:s,idle:a,paused:r}}function D({engine:t,isFirst:s,onThrottle:a}){const r=F(t.engine_id),n=Ze(t.engine_id),o=T([t]),u=t.stream_depth??0,l=P(t);return e.jsxs("div",{className:"group/row flex items-center gap-3 py-2 hover:bg-surface-hover/50 transition-colors rounded px-1",children:[l?e.jsx(U,{className:"w-3.5 h-3.5 text-status-warning shrink-0",strokeWidth:1.5}):e.jsx(Fe,{className:`w-3.5 h-3.5 shrink-0 ${o.total>0||t.is_scout?"text-status-success":"text-text-tertiary/30"}`,strokeWidth:1.5}),e.jsx("span",{className:`${s?"text-base font-medium":"text-xs"} text-text-primary truncate max-w-[180px]`,title:t.engine_id,children:r}),n&&e.jsx("span",{className:"text-[10px] text-text-tertiary/50",children:n}),t.is_scout&&e.jsx("span",{className:"text-[9px] text-amber-500 uppercase tracking-widest",children:"scout"}),e.jsx("span",{className:"flex-1"}),l&&e.jsx("span",{className:"text-[10px] text-status-warning",children:t.throttle===-1?"Paused":V(t.throttle)}),o.total>0&&e.jsx("span",{className:"text-[10px] font-mono tabular-nums text-text-tertiary w-16 text-right",children:o.total.toLocaleString()}),u>0&&e.jsxs("span",{className:`text-[10px] font-mono tabular-nums w-14 text-right ${u>100?"text-status-warning":"text-text-tertiary/50"}`,children:[u.toLocaleString()," q"]}),e.jsx("span",{className:"text-[10px] font-mono text-text-tertiary/40 w-12 text-right",children:Ke(t.inited)}),e.jsx("span",{className:"opacity-0 group-hover/row:opacity-100 transition-opacity",children:e.jsx("button",{onClick:m=>{m.stopPropagation(),a(t)},className:"text-text-tertiary hover:text-accent transition-colors",title:l?"Resume / adjust throttle":"Pause / throttle",children:e.jsx(J,{className:"w-3.5 h-3.5",strokeWidth:1.5})})})]})}function X({label:t,engines:s,onThrottle:a}){const[r,n]=i.useState(!1);return s.length===0?null:e.jsxs("div",{className:"mt-1",children:[e.jsxs("button",{onClick:()=>n(!r),className:"flex items-center gap-1.5 text-[10px] text-text-tertiary hover:text-text-secondary transition-colors py-1",children:[e.jsx(te,{className:`w-3 h-3 transition-transform duration-200 ${r?"rotate-90":""}`,strokeWidth:2}),s.length," ",t]}),e.jsx(W,{open:r,children:e.jsx("div",{className:"ml-1",children:s.map(o=>e.jsx(D,{engine:o,onThrottle:a},o.engine_id))})})]})}function ht({engines:t,onThrottle:s,isLoading:a}){const{active:r,idle:n,paused:o}=i.useMemo(()=>mt(t),[t]);return a?e.jsx("p",{className:"text-xs text-text-tertiary",children:"Discovering engines..."}):t.length===0?e.jsx("p",{className:"text-xs text-text-tertiary",children:"No engines found."}):r.length===0&&n.length===0?e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-3 py-2",children:[e.jsx(U,{className:"w-4 h-4 text-status-error shrink-0",strokeWidth:1.5}),e.jsxs("span",{className:"text-base text-status-error font-medium",children:["All ",t.length," engines paused"]})]}),e.jsx("p",{className:"text-[10px] text-text-tertiary ml-7",children:"Messages are accumulating. Resume at least one engine to restore processing."}),e.jsx("div",{className:"ml-1 mt-2",children:o.map(u=>e.jsx(D,{engine:u,onThrottle:s},u.engine_id))})]}):e.jsxs("div",{children:[r.map((u,l)=>e.jsx(D,{engine:u,isFirst:l===0,onThrottle:s},u.engine_id)),e.jsx(X,{label:"idle",engines:n,onThrottle:s}),e.jsx(X,{label:"paused",engines:o,onThrottle:s})]})}function gt({collapsed:t,toggleSection:s,activeDuration:a,streamStats:r,isLoading:n,queueMap:o,expandedQueues:u,toggleQueue:l,allQueuesExpanded:m,toggleAllQueues:d,handleRowClick:k,handleResumeThrottle:b,handleQueueThrottle:j,handleResumeQueue:v,engines:y,bridgeActive:x}){return e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-[1fr_340px] gap-6",children:[e.jsxs("div",{className:"flex flex-col gap-12 mt-10",children:[e.jsx(I,{title:`Message Volume (${a})`,sectionKey:"volume",isCollapsed:!!t.volume,onToggle:s,contentClassName:"mt-4 ml-7",children:e.jsx(ot,{byStream:(r==null?void 0:r.byStream)??[],onNodeFilter:()=>{},onQueueFilter:()=>{}})}),e.jsx(I,{title:`Engine Routers (${y.length})`,sectionKey:"engines",isCollapsed:!!t.engines,onToggle:s,contentClassName:"mt-4 ml-7",children:e.jsx(ht,{engines:y,onThrottle:k,isLoading:n})}),e.jsx(I,{title:"Worker Routers",sectionKey:"queues",isCollapsed:!!t.queues,onToggle:s,contentClassName:"mt-4 ml-7 flex flex-col gap-0",children:n?e.jsx("p",{className:"text-xs text-text-tertiary",children:"Discovering mesh nodes..."}):o.size===0?e.jsx("p",{className:"text-xs text-text-tertiary",children:'No worker routers found. Click "Roll Call" to discover.'}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex justify-end mb-2",children:e.jsx("button",{onClick:d,className:"text-[10px] text-accent hover:underline",children:m?"Collapse all":"Expand all"})}),[...o.entries()].sort(([w],[c])=>w.localeCompare(c)).map(([w,c])=>e.jsx(lt,{queue:w,workers:c,expanded:u.has(w),onToggle:l,onWorkerClick:k,onResumeThrottle:b,onQueueThrottle:j,onResumeQueue:v,byStream:(r==null?void 0:r.byStream)??[],activeDuration:a},w))]})})]}),e.jsx(pt,{bridgeActive:x})]})}function Mt(){const{namespace:t,available:s}=ve(),{filters:a,setFilter:r}=Ne({filters:{app_id:"",duration:"1h"}}),n=a.app_id||t,o=a.duration||"1h",u=$e(),l=6e4,{data:m,isLoading:d,error:k,refetch:b,isFetching:j}=Se(n,l),{data:v}=_e(n,o,void 0,l),y=i.useMemo(()=>[...(m==null?void 0:m.profiles)??[]].sort((S,_)=>{const z=S.worker_topic||S.stream||"",Q=_.worker_topic||_.stream||"";return!S.worker_topic&&_.worker_topic?-1:S.worker_topic&&!_.worker_topic?1:z.localeCompare(Q)}),[m==null?void 0:m.profiles]),x=i.useMemo(()=>y.filter(h=>!M(h)),[y]),w=i.useMemo(()=>y.filter(M),[y]),c=i.useMemo(()=>Ye(y),[y]),g=y.filter(P).length,E=i.useMemo(()=>{const h=new Set(s);return n&&h.add(n),[...h].sort().map(S=>({value:S,label:S}))},[s,n]),[p]=Ue(),C=p.get("queue"),[f,$]=i.useState(()=>C?new Set([C]):new Set),A=i.useCallback(h=>{$(S=>{const _=S.has(h),z=_?new Set:new Set([h]),Q=new URLSearchParams(window.location.search);_?Q.delete("queue"):Q.set("queue",h);const G=Q.toString();return window.history.pushState(null,"",`${window.location.pathname}${G?`?${G}`:""}`),z})},[]),N=c.size>0&&[...c.keys()].every(h=>f.has(h)),R=i.useCallback(()=>{$(N?new Set:new Set(c.keys()))},[N,c]),O="lt:controlplane:collapsed",[L,oe]=i.useState(()=>{try{const h=JSON.parse(localStorage.getItem(O)||"{}");return C&&(h.queues=!1),h}catch{return{}}}),le=i.useCallback(h=>{oe(S=>{const _={...S,[h]:!S[h]};return localStorage.setItem(O,JSON.stringify(_)),_})},[]),{throttleModalOpen:ie,throttleTargets:H,selectedThrottleTargets:ce,throttleMutation:ue,handleBulkThrottle:de,handleRowClick:xe,handleResumeThrottle:pe,handleResumeQueue:me,handleQueueThrottle:he,closeThrottleModal:ge}=tt({activeAppId:n,allProfiles:y,profiles:y}),fe=i.useMemo(()=>{const h=[{label:"Engines",value:x.length,dotClass:"bg-blue-500"},{label:"Workers",value:w.length,dotClass:"bg-text-secondary"},{label:"Topics",value:c.size}];return g>0&&h.push({label:"Throttled",value:g,dotClass:"bg-status-warning"}),h},[x.length,w.length,c.size,g]),[q,be]=i.useState(!1),je=i.useCallback(()=>{u.mutate({appId:n},{onSuccess:()=>be(!0)})},[n,u]);return i.useEffect(()=>{!q&&n&&je()},[n]),e.jsxs("div",{children:[e.jsx(ye,{title:"Routers",docsHash:"#docs:dashboard.md:task-queues",stats:fe,actions:e.jsx(at,{})}),e.jsxs(we,{actions:e.jsx("div",{className:"flex items-center gap-1",children:Ve.map(h=>e.jsx("button",{onClick:()=>r("duration",h.value),className:`px-3 py-1 text-xs rounded-full transition-colors ${o===h.value?"bg-accent text-text-inverse":"text-text-tertiary hover:text-text-primary hover:bg-surface-hover"}`,children:h.label},h.value))}),children:[e.jsx(ke,{label:"Application",value:a.app_id,onChange:h=>r("app_id",h),options:E}),e.jsxs("button",{onClick:()=>b(),disabled:j,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs text-text-tertiary hover:text-text-primary transition-colors disabled:opacity-50",children:[e.jsx(Oe,{className:`w-3.5 h-3.5 ${j?"animate-spin":""}`}),"Roll Call"]})]}),k&&e.jsx("div",{className:"mb-6 px-4 py-3 rounded bg-status-error/10 border border-status-error/20",children:e.jsx("p",{className:"text-xs text-status-error font-medium",children:k.message==="Session expired"?"Session expired — please log in again.":`Failed to load mesh data: ${k.message}`})}),e.jsx(gt,{collapsed:L,toggleSection:le,activeDuration:o,streamStats:v,isLoading:d,queueMap:c,expandedQueues:f,toggleQueue:A,allQueuesExpanded:N,toggleAllQueues:R,handleRowClick:xe,handleResumeThrottle:pe,handleQueueThrottle:he,handleResumeQueue:me,engines:x,bridgeActive:q}),e.jsx(rt,{open:ie,onClose:ge,targets:H.length>0?H:ce,onApply:de,isPending:ue.isPending})]})}export{Mt as ControlPlanePage};
2
+ //# sourceMappingURL=index-BBQggGcf.js.map